- nahmii-sdk
- Wallet ⏏
- new Wallet(signer, provider)
- .provider ⇒
NahmiiProvider
- .address ⇒
String
- .signerKey ⇒
ethers.SignerKey
|undefined
- .getNahmiiBalance() ⇒
Promise
- .getNahmiiStagedBalance(symbol) ⇒
Promise.<BigNumber>
- .getReceipts([fromNonce], [limit], [asc]) ⇒
Promise
- .depositEth(amountEth, [options]) ⇒
Promise
- .getDepositAllowance(symbol) ⇒
Promise.<BigNumber>
- .approveTokenDeposit(amount, symbol, [options]) ⇒
Promise
- .completeTokenDeposit(amount, symbol, [options]) ⇒
Promise
- .withdraw(monetaryAmount, [options]) ⇒
Promise
- .unstage(monetaryAmount, [options]) ⇒
Promise
- .getAddress() ⇒
Promise.<string>
- .signMessage(message) ⇒
Promise.<string>
- .sign(transaction) ⇒
Promise.<string>
- .getBalance([blockTag]) ⇒
Promise.<BigNumber>
- .getTransactionCount([blockTag]) ⇒
Promise.<number>
- .sendTransaction(transaction) ⇒
Promise.<TransactionResponse>
- Wallet ⏏
Wallet A class for performing various operations on a wallet.
Create a Wallet from either a private key or custom signing functions
Param | Type | Description |
---|---|---|
signer | string | object |
A private key, or information required for the wallet to have signing capabilities |
provider | NahmiiProvider |
A NahmiiProvider instance |
The Nahmii Provider used by this wallet instance.
Kind: instance property of Wallet
Returns the address for this wallet, required by ethers Wallet methods.
Kind: instance property of Wallet
If used with software wallet, returns an object containing signer related information and logic such as the private key, otherwise undefined
Kind: instance property of Wallet
Returns: ethers.SignerKey
| undefined
- The private key or undefined
Retrieves available nahmii balance for current wallet.
Kind: instance method of Wallet
Returns: Promise
- A promise that resolves into a mapping from symbol to human readable amount.
Retrieves nahmii staged balance for a currency of the current wallet.
Kind: instance method of Wallet
Param | Type | Description |
---|---|---|
symbol | string |
The currency symbol |
Retrieves all receipts for effectuated payments for the wallet using filter/pagination criteria.
Kind: instance method of Wallet
Returns: Promise
- A promise that resolves into an array of payment receipts
Param | Type | Default | Description |
---|---|---|---|
[fromNonce] | number |
Filter payment receipts greater or equal to specific nonce. | |
[limit] | number |
The max number of payment receipts to return. | |
[asc] | boolean |
false |
Return payment receipts in asc order. |
Initiates the deposit of ETH from the on-chain balance of the wallet to nahmii.
Kind: instance method of Wallet
Returns: Promise
- A promise that resolves into a transaction with a hash.
Param | Type | Description |
---|---|---|
amountEth | number | string |
The amount of ETH to deposit. |
[options] |
Example
const {hash} = await wallet.depositEth('1.1', {gasLimit: 200000});
const receipt = await wallet.provider.getTransactionConfirmation(hash);
Retrieve current deposit allowance for the specified symbol.
Kind: instance method of Wallet
Param | Type | Description |
---|---|---|
symbol | string |
The currency symbol |
Initiates the deposit of a token from the wallet's on-chain balance to nahmii by calling the approve method of the token smart contract.
Kind: instance method of Wallet
Returns: Promise
- A promise that resolves into a transaction with a hash.
See: https://docs.ethers.io/ethers.js/html/api-providers.html#transaction-receipts
Param | Type | Description |
---|---|---|
amount | number | string |
The amount of currency to deposit. |
symbol | string |
The currency symbol |
[options] |
Example
const {hash} = await wallet.depositToken('1.1', 'HBT', {gasLimit: 200000});
const receipt = await wallet.provider.getTransactionConfirmation(hash);
Initiates the completion of a deposit of a token from a wallet's on-chain balance to nahmii by calling the depositTokens method of the nahmii clientFund smart contract. Requires approveTokenDeposit to have been called first.
Kind: instance method of Wallet
Returns: Promise
- A promise that resolves into a transaction with a hash.
Param | Type | Description |
---|---|---|
amount | number | string |
The amount of currency to deposit. |
symbol | string |
The currency symbol |
[options] |
Example
const {hash} = await wallet.completeTokenDepsoit('1.1', 'HBT', {gasLimit: 200000});
const receipt = await wallet.provider.getTransactionConfirmation(hash);
Withdraw an amount of ETH or ERC20 tokens from nahmii to base layer.
Kind: instance method of Wallet
Returns: Promise
- A promise that resolves into transaction hash.
Param | Type | Description |
---|---|---|
monetaryAmount | MonetaryAmount |
The amount to withdraw from nahmii. |
[options] |
Example
let amountBN = ethers.utils.parseUnits('1.1', 18);
let currency = '0x0000000000000000000000000000000000000000'
let monetaryAmount = new nahmii.MonetaryAmount(amountBN, currency, 0)
let hashObj = await wallet.withdraw(monetaryAmount, {gasLimit: 200000});
Unstage an amount of ETH or ERC20 tokens from staged balance back to nahmii available balance.
Kind: instance method of Wallet
Returns: Promise
- A promise that resolves into transaction hash.
Param | Type | Description |
---|---|---|
monetaryAmount | MonetaryAmount |
The amount unstage from staged balance. |
[options] |
Example
let amountBN = ethers.utils.parseUnits('1.1', 18);
let currency = '0x0000000000000000000000000000000000000000'
let monetaryAmount = new nahmii.MonetaryAmount(amountBN, currency, 0)
let hashObj = await wallet.unstage(monetaryAmount, {gasLimit: 200000});
Retrieves the wallet address.
Kind: instance method of Wallet
Returns: Promise.<string>
- - The wallet address as a hexadecimal string
Signs message and returns a Promise that resolves to the flat-format signature. If message is a string, it is converted to UTF-8 bytes, otherwise it is preserved as a binary representation of the Arrayish data.
Kind: instance method of Wallet
Param |
---|
message |
Signs transaction and returns a Promise that resolves to the signed transaction as a hex string. In general, the sendTransaction method is preferred to sign, as it can automatically populate values asynchronously.
Kind: instance method of Wallet
Param |
---|
transaction |
Returns the wallet instance on-chain ETH balance
Kind: instance method of Wallet
Param | Type | Description |
---|---|---|
[blockTag] | string |
A block number to calculate from |
Returns the wallet instance on-chain transaction count
Kind: instance method of Wallet
Param | Type | Description |
---|---|---|
[blockTag] | string |
A block number to calculate from |
Sends the transaction to the network and returns a Promise that resolves to a Transaction Response. Any properties that are not provided will be populated from the network. See: https://docs.ethers.io/ethers.js/html/api-providers.html#transaction-request
Kind: instance method of Wallet
Param | Type | Description |
---|---|---|
transaction | object |
An unsigned Ethereum transaction |