Constructor
new Wallet(client, accessOptions)
Creates an instance of token history api.
Parameters:
Name | Type | Description |
---|---|---|
client |
ApiClient | The Api client to use to connect with KAS. |
accessOptions |
AccessOptions | An instance of AccessOptions including |
Members
auth :string
Type:
- string
accessKeyId :string
Type:
- string
secretAccessKey :string
Type:
- string
chainId :string
Type:
- string
accessOptions :AccessOptions
Type:
apiInstances :object
Type:
- object
client :object
Type:
- object
accountApi :AccountApi
Type:
basicTransactionApi :BasicTransactionApi
Type:
fdTransactionPaidByKASApi :FeeDelegatedTransactionPaidByKASApi
Type:
fdTransactionPaidByUserApi :FeeDelegatedTransactionPaidByUserApi
Type:
multisigTransactionManagementApi :MultisigTransactionManagementApi
Type:
statisticsApi :StatisticsApi
Type:
keyApi :KeyApi
Type:
registrationApi :RegistrationApi
Type:
Methods
(async) migrateAccounts(accounts) → {RegistrationStatusResponse}
Migrates Klaytn accounts to KAS Wallet API.
This function needs Node API. Therefore, it is essential to have initialized to use Node API.
Node API initialization is possible through caver.initKASAPI or caver.initNodeAPI.
Example
const accounts = [
{
address: '0xc756f6809bc34c2458fcb82fb16d5add3dbad9e3',
key: '0x{private key1}',
nonce: 0,
},
{
address: '0x5bae5e458ad1a9b210bf0a10434c39be1a5b7983',
key: [
'0x{private key2}',
'0x{private key3}',
],
},
{
address: '0x5bae5e458ad1a9b210bf0a10434c39be1a5b7983',
key: [
[
'0x{private key4}',
'0x{private key5}',
],
[
'0x{private key6}',
],
[
'0x{private key7}',
'0x{private key8}',
],
],
nonce: 4,
}
]
const ret = await caver.kas.wallet.migarateAccounts(accounts)
Parameters:
Name | Type | Description |
---|---|---|
accounts |
Array.<MigrationAccount> | An array of account objects migrated into KAS. |
Returns:
createAccount(callbackopt) → {Account}
Creates Klaytn Account through KAS Wallet API.
POST /v2/account
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
callback |
function |
<optional> |
The callback function to call. |
Returns:
- Type
- Account
getAccountList(queryOptionsopt, callbackopt) → {Accounts}
Retrieves the list of accounts created using the KAS Wallet API.
GET /v2/account
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
queryOptions |
WalletQueryOptions |
<optional> |
Filters required when retrieving data. |
callback |
function |
<optional> |
The callback function to call. |
Returns:
- Type
- Accounts
getAccount(address, callbackopt) → {Account}
Retrieves an account created using the KAS Wallet API.
GET /v2/account/{address}
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
address |
string | The address of Klaytn account. |
|
callback |
function |
<optional> |
The callback function to call. |
Returns:
- Type
- Account
getAccountListByPublicKey(publicKey, callbackopt) → {AccountsByPubkey}
Retrieves the list of Klaytn accounts with the corresponding public key.
GET /v2/pubkey/{public-key}/account
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
publicKey |
string | The public key to search. |
|
callback |
function |
<optional> |
The callback function to call. |
Returns:
- Type
- AccountsByPubkey
deleteAccount(address, callbackopt) → {AccountStatus}
Deletes an account created using the KAS Wallet API.
DELETE /v2/account/{address}
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
address |
string | The address of Klaytn account to delete from KAS Wallet API service. |
|
callback |
function |
<optional> |
The callback function to call. |
Returns:
- Type
- AccountStatus
disableAccount(address, callbackopt) → {AccountSummary}
Deactivates Klaytn Account.
PUT /v2/account/{address}/disable
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
address |
string | The address of Klaytn account to disable from KAS Wallet API service. |
|
callback |
function |
<optional> |
The callback function to call. |
Returns:
- Type
- AccountSummary
enableAccount(address, callbackopt) → {AccountSummary}
Activates Klaytn Account.
PUT /v2/account/{address}/enable
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
address |
string | The address of Klaytn account to enable from KAS Wallet API service. |
|
callback |
function |
<optional> |
The callback function to call. |
Returns:
- Type
- AccountSummary
signTransaction(address, transactionId, callbackopt) → {Signature}
Signs the transaction with this transactionId with that Klaytn account.
POST /v2/account/{address}/tx/{transaction-id}/sign
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
address |
string | The address of the Klaytn account you want to use for signing. |
|
transactionId |
string | The ID of the transaction you want to sign. |
|
callback |
function |
<optional> |
The callback function to call. |
Returns:
- Type
- Signature
updateToMultiSigAccount(address, accountKeyWeightedMultiSig, callbackopt) → {MultisigAccount}
Signs the transaction with this transactionId with that Klaytn account.
PUT /v2/account/{address}/multisig
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
address |
string | The address of the Klaytn account you want to use for signing. |
|
accountKeyWeightedMultiSig |
object | AccountKeyWeightedMultiSig | The ID of the transaction you want to sign. |
|
callback |
function |
<optional> |
The callback function to call. |
Returns:
- Type
- MultisigAccount
requestLegacyTransaction(transaction, callbackopt) → {TransactionResult}
Create LegacyTransaction.
POST /v2/tx/legacy
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
transaction |
LegacyTransactionRequest | Transaction to be requested to KAS. |
|
callback |
function |
<optional> |
The callback function to call. |
Returns:
- Type
- TransactionResult
requestValueTransfer(transaction, callbackopt) → {TransactionResult}
Create ValueTransfer or ValueTransferMemo.
POST /v2/tx/value
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
transaction |
ValueTransferTransactionRequest | Transaction to be requested to KAS. |
|
callback |
function |
<optional> |
The callback function to call. |
Returns:
- Type
- TransactionResult
requestSmartContractDeploy(transaction, callbackopt) → {TransactionResult}
Create SmartContractDeploy.
POST /v2/tx/contract/deploy
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
transaction |
ContractDeployTransactionRequest | Transaction to be requested to KAS. |
|
callback |
function |
<optional> |
The callback function to call. |
Returns:
- Type
- TransactionResult
requestSmartContractExecution(transaction, callbackopt) → {TransactionResult}
Create SmartContractExecution.
POST /v2/tx/contract/execute
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
transaction |
ContractExecutionTransactionRequest | Transaction to be requested to KAS. |
|
callback |
function |
<optional> |
The callback function to call. |
Returns:
- Type
- TransactionResult
requestCancel(transaction, callbackopt) → {TransactionResult}
Create Cancel.
DELETE /v2/tx
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
transaction |
CancelTransactionRequest | Transaction to be requested to KAS. |
|
callback |
function |
<optional> |
The callback function to call. |
Returns:
- Type
- TransactionResult
requestChainDataAnchoring(transaction, callbackopt) → {TransactionResult}
Create ChainDataAnchoring.
POST /v2/tx/anchor
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
transaction |
AnchorTransactionRequest | Transaction to be requested to KAS. |
|
callback |
function |
<optional> |
The callback function to call. |
Returns:
- Type
- TransactionResult
requestRawTransaction(rlpRequest, callbackopt) → {TransactionResult}
Create transaction through RLP-encoded string.
POST /v2/tx/rlp
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
rlpRequest |
ProcessRLPRequest | The object that includes rlp request informations. |
|
callback |
function |
<optional> |
The callback function to call. |
Returns:
- Type
- TransactionResult
requestAccountUpdate(transaction, callbackopt) → {TransactionResult}
Create AccountUpdate.
PUT /v2/tx/account
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
transaction |
AccountUpdateTransactionRequest | Transaction to be requested to KAS. |
|
callback |
function |
<optional> |
The callback function to call. |
Returns:
- Type
- TransactionResult
getTransaction(transactionHash, callbackopt) → {TransactionReceipt}
Retrieves the transaction by the transaction hash value.
GET /v2/tx/{transaction-hash}
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
transactionHash |
string | The hash of the transaction. |
|
callback |
function |
<optional> |
The callback function to call. |
Returns:
- Type
- TransactionReceipt
callContract(contractAddress, methodName, callArgumentsopt, sendOptionsopt, callbackopt) → {ContractCallResponse}
Call the contract. You can view certain value in the contract and validate that you can submit executable transaction.
POST /v2/tx/contract/call
Example
const contractAddress = '0x7278841B4300639A8827dc9f8345CC49ef876804'
// with send options
const sendOptions = {
from: '0x0aFA15F32D1F1283c09d5d2034957A7E79b7ae21',
gas: 300000,
value: 0,
}
const ret = await caver.kas.wallet.callContract(contractAddress, 'increase', callArguments)
// with call arguments
const callArguments = [
{
type: 'address',
value: '0x0aFA15F32D1F1283c09d5d2034957A7E79b7ae21',
},
]
const ret = await caver.kas.wallet.callContract(contractAddress, 'isMinter', callArguments)
// with call arguments and send options
const callArguments = [
{
type: 'address',
value: '0x0aFA15F32D1F1283c09d5d2034957A7E79b7ae21',
},
{ type: 'uint256', value: 1 }
]
const sendOptions = {
from: '0x0aFA15F32D1F1283c09d5d2034957A7E79b7ae21',
gas: 300000,
value: 0,
}
const ret = await caver.kas.wallet.callContract(contractAddress, 'transfer', callArguments, sendOptions)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
contractAddress |
string | The krn string to search. |
|
methodName |
string | The method name to call. |
|
callArguments |
Array.<object> |
<optional> |
|
sendOptions |
object |
<optional> |
|
callback |
function |
<optional> |
The callback function to call. |
Returns:
- Type
- ContractCallResponse
requestFDValueTransferPaidByGlobalFeePayer(transaction, callbackopt) → {FDTransactionResult}
Create FeeDelegatedValueTransfer, FeeDelegatedValueTransferMemo,
FeeDelegatedValueTransferWithRatio or FeeDelegatedValueTransferMemoWithRatio.
POST /v2/tx/fd/value
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
transaction |
FDValueTransferTransactionRequest | Transaction to be requested to KAS. |
|
callback |
function |
<optional> |
The callback function to call. |
Returns:
- Type
- FDTransactionResult
requestFDSmartContractDeployPaidByGlobalFeePayer(transaction, callbackopt) → {FDTransactionResult}
Create FeeDelegatedSmartContractDeploy.
POST /v2/tx/fd/contract/deploy
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
transaction |
FDContractDeployTransactionRequest | Transaction to be requested to KAS. |
|
callback |
function |
<optional> |
The callback function to call. |
Returns:
- Type
- FDTransactionResult
requestFDSmartContractExecutionPaidByGlobalFeePayer(transaction, callbackopt) → {FDTransactionResult}
Create FeeDelegatedSmartContractExecution.
POST /v2/tx/fd/contract/execute
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
transaction |
FDContractExecutionTransactionRequest | Transaction to be requested to KAS. |
|
callback |
function |
<optional> |
The callback function to call. |
Returns:
- Type
- FDTransactionResult
requestFDCancelPaidByGlobalFeePayer(transaction, callbackopt) → {FDTransactionResult}
Create FeeDelegatedCancel.
DELETE /v2/tx/fd
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
transaction |
FDCancelTransactionRequest | Transaction to be requested to KAS. |
|
callback |
function |
<optional> |
The callback function to call. |
Returns:
- Type
- FDTransactionResult
requestFDChainDataAnchoringPaidByGlobalFeePayer(transaction, callbackopt) → {FDTransactionResult}
Create FeeDelegatedChainDataAnchoring.
POST /v2/tx/fd/anchor
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
transaction |
FDAnchorTransactionRequest | Transaction to be requested to KAS. |
|
callback |
function |
<optional> |
The callback function to call. |
Returns:
- Type
- FDTransactionResult
requestFDRawTransactionPaidByGlobalFeePayer(rlpRequest, callbackopt) → {FDTransactionResult}
Create transaction through RLP-encoded string.
POST /v2/tx/fd/rlp
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
rlpRequest |
FDProcessRLPRequest | The object that includes rlp request informations. |
|
callback |
function |
<optional> |
The callback function to call. |
Returns:
- Type
- FDTransactionResult
requestFDAccountUpdatePaidByGlobalFeePayer(transaction, callbackopt) → {FDTransactionResult}
Create FeeDelegatedAccountUpdate.
PUT /v2/tx/fd/account
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
transaction |
FDAccountUpdateTransactionRequest | Transaction to be requested to KAS. |
|
callback |
function |
<optional> |
The callback function to call. |
Returns:
- Type
- FDTransactionResult
requestFDValueTransferPaidByUser(transaction, callbackopt) → {FDTransactionResult}
Create FeeDelegatedValueTransfer, FeeDelegatedValueTransferMemo,
FeeDelegatedValueTransferWithRatio or FeeDelegatedValueTransferMemoWithRatio.
POST /v2/tx/fd-user/value
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
transaction |
FDUserValueTransferTransactionRequest | Transaction to be requested to KAS. |
|
callback |
function |
<optional> |
The callback function to call. |
Returns:
- Type
- FDTransactionResult
requestFDSmartContractDeployPaidByUser(transaction, callbackopt) → {FDTransactionResult}
Create FeeDelegatedSmartContractDeploy.
POST /v2/tx/fd-user/contract/deploy
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
transaction |
FDUserContractDeployTransactionRequest | Transaction to be requested to KAS. |
|
callback |
function |
<optional> |
The callback function to call. |
Returns:
- Type
- FDTransactionResult
requestFDSmartContractExecutionPaidByUser(transaction, callbackopt) → {FDTransactionResult}
Create FeeDelegatedSmartContractExecution.
POST /v2/tx/fd-user/contract/execute
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
transaction |
FDUserContractExecutionTransactionRequest | Transaction to be requested to KAS. |
|
callback |
function |
<optional> |
The callback function to call. |
Returns:
- Type
- FDTransactionResult
requestFDCancelPaidByUser(transaction, callbackopt) → {FDTransactionResult}
Create FeeDelegatedCancel.
DELETE /v2/tx/fd-user
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
transaction |
FDUserCancelTransactionRequest | Transaction to be requested to KAS. |
|
callback |
function |
<optional> |
The callback function to call. |
Returns:
- Type
- FDTransactionResult
requestFDChainDataAnchoringPaidByUser(transaction, callbackopt) → {FDTransactionResult}
Create FeeDelegatedChainDataAnchoring.
POST /v2/tx/fd-user/anchor
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
transaction |
FDUserAnchorTransactionRequest | Transaction to be requested to KAS. |
|
callback |
function |
<optional> |
The callback function to call. |
Returns:
- Type
- FDTransactionResult
requestFDRawTransactionPaidByUser(rlpRequest, callbackopt) → {FDTransactionResult}
Create transaction through RLP-encoded string.
POST /v2/tx/fd-user/rlp
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
rlpRequest |
FDUserProcessRLPRequest | The object that includes rlp request informations. |
|
callback |
function |
<optional> |
The callback function to call. |
Returns:
- Type
- FDTransactionResult
requestFDAccountUpdatePaidByUser(transaction, callbackopt) → {FDTransactionResult}
Create FeeDelegatedAccountUpdate.
PUT /v2/tx/fd-user/account
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
transaction |
FDUserAccountUpdateTransactionRequest | Transaction to be requested to KAS. |
|
callback |
function |
<optional> |
The callback function to call. |
Returns:
- Type
- FDTransactionResult
getMultiSigTransactionList(address, queryOptionsopt, callbackopt) → {MultisigTransactions}
Retrieves the list of pending transactions among transactions sent from the account.
GET /v2/multisig/account/{address}/tx
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
address |
string | Account address with multi-signature key or signer account address. |
|
queryOptions |
WalletQueryOptions |
<optional> |
Filters required when retrieving data. |
callback |
function |
<optional> |
The callback function to call. |
Returns:
- Type
- MultisigTransactions
signMultiSigTransction(address, transactionId, callbackopt) → {MultisigTransactionStatus}
Signs a pending transaction with the Klaytn account created by KAS.
POST /v2/multisig/account/{address}/tx/{transaction-id}/sign
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
address |
string | Account address to use for signing. |
|
transactionId |
string | The transaction id to sign. |
|
callback |
function |
<optional> |
The callback function to call. |
Returns:
appendSignatures(transactionId, sigs, callbackopt) → {MultisigTransactionStatus}
Signs a pending transaction with the Klaytn account created by KAS.
POST /v2/multisig/tx/{transaction-id}/sign
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
transactionId |
string | The transacion id. |
|
sigs |
string | The signatures to appen. |
|
callback |
function |
<optional> |
The callback function to call. |
Returns:
getAccountCount(callbackopt) → {AccountCountByAccountID}
Return the number of accounts in KAS.
GET /v2/stat/count
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
callback |
function |
<optional> |
The callback function to call. |
Returns:
getAccountCountByKRN(krn, callbackopt) → {AccountCountByKRN}
Return the number of accounts by KRN in KAS.
GET /v2/stat/count/krn
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
krn |
string | The krn string to search. |
|
callback |
function |
<optional> |
The callback function to call. |
Returns:
- Type
- AccountCountByKRN
createKeys(numberOfKeys, callbackopt) → {KeyCreationResponse}
Create keys in KAS.
POST /v2/key
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
numberOfKeys |
number | The number of keys to create. |
|
callback |
function |
<optional> |
The callback function to call. |
Returns:
- Type
- KeyCreationResponse
getKey(keyId, callbackopt) → {Key}
Find key information from KAS.
GET /v2/key/{key-id}
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
keyId |
string | The key id to find from KAS. |
|
callback |
function |
<optional> |
The callback function to call. |
Returns:
- Type
- Key
signMessage(keyId, dataToSign, krnopt, callbackopt) → {KeySignDataResponse}
Sign the data using key.
POST /v2/key/{key-id}/sign
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
keyId |
string | The key id to use for signing. |
|
dataToSign |
string | The data to sign. |
|
krn |
string |
<optional> |
The krn string. |
callback |
function |
<optional> |
The callback function to call. |
Returns:
- Type
- KeySignDataResponse
registerAccounts(accounts, callbackopt) → {RegistrationStatusResponse}
Register account which used before.
POST /v2/registration/account
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
accounts |
Array.<object> | The account information to be registered in KAS. |
|
callback |
function |
<optional> |
The callback function to call. |