Constructor
new CaverExtKAS(chainId, accessKeyId, secretAccessKey)
Creates an instance of caver extension KAS.
This constructor sets the configurations used by each KAS API services with parameters.
When initializing the KAS API in the constructor, initialize the authentication key used in the Node API, Wallet API, Token History API, and Anchor API at once with KAS Production URL as default.
If you want to initialize each service or use an endpoint URL other than the production URL set as default,
you need to initialize it for each service using initNodeAPI, initTokenHistoryAPI, initWalletAPI, and initAnchorAPI.
Example
const CaverExtKAS = require('caver-js-ext-kas')
const caver = new CaverExtKAS(1001, 'accessKeyId', 'secretAccessKey')
Parameters:
Name | Type | Description |
---|---|---|
chainId |
number | The chain id. |
accessKeyId |
string | The access key id. |
secretAccessKey |
string | The secret access key. |
Members
wallet :KASWallet
The wallet member variable of CaverExtKAS is a KASWallet that operates by using the KAS Wallet API.
If you want to use the in-memory wallet provided by caver-js as it is, you can create an instance of KeyringContainer with const keyringContainer = new caver.keyringContainer()
.
Type:
kas :KAS
Type:
Methods
initKASAPI(chainId, accessKeyId, secretAccessKey) → {void}
Sets chain id and authentication key. This function sets the configurations used by each KAS API services.
Example
caver.initKASAPI(1001, 'accessKeyId', 'secretAccessKey')
Parameters:
Name | Type | Description |
---|---|---|
chainId |
number | The chain id. |
accessKeyId |
string | The access key id. |
secretAccessKey |
string | The secret access key. |
Returns:
- Type
- void
initNodeAPI(chainId, accessKeyId, secretAccessKey, urlopt) → {void}
Sets chain id and authentication key for Node API.
Example
caver.initNodeAPI(1001, 'accessKeyId', 'secretAccessKey')
caver.initNodeAPI(1001, 'accessKeyId', 'secretAccessKey', 'Node API url to use')
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
chainId |
number | The chain id. |
|
accessKeyId |
string | The access key id. |
|
secretAccessKey |
string | The secret access key. |
|
url |
string |
<optional> |
The end point url. |
Returns:
- Type
- void
initTokenHistoryAPI(chainId, accessKeyId, secretAccessKey, urlopt) → {void}
Sets chain id and authentication key for Token History API.
Example
caver.initTokenHistoryAPI(1001, 'accessKeyId', 'secretAccessKey')
caver.initTokenHistoryAPI(1001, 'accessKeyId', 'secretAccessKey', 'Token History API url to use')
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
chainId |
number | The chain id. |
|
accessKeyId |
string | The access key id. |
|
secretAccessKey |
string | The secret access key. |
|
url |
string |
<optional> |
The end point url. |
Returns:
- Type
- void
initWalletAPI(chainId, accessKeyId, secretAccessKey, urlopt) → {void}
Sets chain id and authentication key for Wallet API.
Example
caver.initWalletAPI(1001, 'accessKeyId', 'secretAccessKey')
caver.initWalletAPI(1001, 'accessKeyId', 'secretAccessKey', 'Wallet API url to use')
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
chainId |
number | The chain id. |
|
accessKeyId |
string | The access key id. |
|
secretAccessKey |
string | The secret access key. |
|
url |
string |
<optional> |
The end point url. |
Returns:
- Type
- void
initAnchorAPI(chainId, accessKeyId, secretAccessKey, urlopt) → {void}
Sets chain id and authentication key for Anchor API.
Example
caver.initAnchorAPI(1001, 'accessKeyId', 'secretAccessKey')
caver.initAnchorAPI(1001, 'accessKeyId', 'secretAccessKey', 'Anchor API url to use')
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
chainId |
number | The chain id. |
|
accessKeyId |
string | The access key id. |
|
secretAccessKey |
string | The secret access key. |
|
url |
string |
<optional> |
The end point url. |
Returns:
- Type
- void
initKIP17API(chainId, accessKeyId, secretAccessKey, urlopt) → {void}
Sets chain id and authentication key for KIP17 API.
Example
caver.initKIP17API(1001, 'accessKeyId', 'secretAccessKey')
caver.initKIP17API(1001, 'accessKeyId', 'secretAccessKey', 'KIP-17 API url to use')
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
chainId |
number | The chain id. |
|
accessKeyId |
string | The access key id. |
|
secretAccessKey |
string | The secret access key. |
|
url |
string |
<optional> |
The end point url. |
Returns:
- Type
- void