0.2.8 • Published 11 days ago

@kanalabs/mirai v0.2.8

Weekly downloads
-
License
MIT
Repository
github
Last release
11 days ago

Mirai

Mirai - Account Abstraction SDK (EVM + non-EVM)

Installation

npm i @kanalabs/mirai

Supported Networks

Mainnets:

- AptosMainnet
- mainnet (Ethereum)
- polygon
- optimism
- linea
- gnosis
- mantle
- avalanche
- base
- bsc
- klaytn
- scroll
- flare
- bifrost

Testnets:

- AptosTestnet
- bscTestnet
- KlaytnTestnet
- ScrollSepolia
- FuseSparknet
- goerli
- mumbai
- sepolia
- flareTestnet
- bifrostTestnet

Available Properties in SDKGateway

PropertiesDescription
instancesReturns all initialized instances
currentNetworkReturns the current default network
currentInstanceReturns the current default SDK instance
contractAddressReturns KanaWallet address for initialized chains
walletProviderReturns the wallet provider which used to init the sdk
activeNetworksReturns available networks with their respective status

Available Methods in SDKGateway

MethodsDescription
initialize(network?: NetworkNames)To initialize the SDK instance specify a network,and
and return the result of initialization.
getNativeBalance(network?: NetworkNames)To get the native token balance of the smart wallet.
Returns native token balance.
setCurrentInstance(network: NetworkNames)To set the default SDK instance and retrieve the SDK
instance associated with the specified network.
erc20(tokenAddress: string,network?: NetworkNames)To get the ERC20 token instance for building ERC20
transactions. Returns the ERC20 contract instance.
erc721(collectionAddress: string,To get the ERC721 collection instance for building
network?: NetworkNames)ERC721 transactions.Returns the ERC721 contractinstance
erc1155(collectionAddress: string,To get the ERC1155 collection instance for building
network?: NetworkNames)ERC1155 transactions. Returns the ERC1155 contract
instance transactions.Returns the ERC721
isNetworkActive(networkName: string): booleanTo check if the given network is available and active.
Returns bool
Example const isActive = isNetworkActive (networkName)
transactions. Returns the ERC20 contract instance.
getProvider(network: NetworkNames)To get the RPC Provider for the given network.
providers.JsonRpcProviderReturns providers.JsonRpcProvider
Example const provider = getProvider(networkName)
destroy(network: NetworkNames)To destroy the SDK instance specifying a network for
destruction, or destroying all instances if no network
is provided.
Example const provider = getProvider(networkName)
getAptosInstance(network: NetworkNames)To get the RPC Provider for the given network.
Retrieve the Aptos SDK instance

Available Methods in SDK

MethodsDescription
getCounterFactualAddress(): PromiseTo get the KanaWallet address
signMessage(dto: SignMessageDto): PromiseTo sign a message
getNativeBalance(): PromiseTo get the native token balance of the wallet
getTokenBalance(tokenAddress: string)To get the ERC20 token balance of the wallet
: Promise
addUserOpsToBatch(tx: UserOpsRequest)To add transactions to the batch
: Promise
clearUserOpsFromBatch(): PromiseTo clear the transactions in the batch
estimate(gasDetails?: TransactionGasInfoForUserOp)To estimate transactions added to the batch and get the
: Promisefee data for the UserOp
send(userOp: UserOperationStruct): PromiseTo sign the UserOp and send it to the bundler .
Returns userOp
createSession(dto?: CreateSessionDto)To sign create a session
: Promise
getUserOpReceipt(userOpHash: string)To get the transaction hash
getGasFee(): PromiseTo get the Gas data
destroy(): voidTo destroy the instance

Helpers

Available Properties in ERC20

PropertiesDescription
nameReturns the name of the token
symbolReturns the symbol (ticker) of the token.
decimalsReturns the number of decimal places that the token uses
totalSupplyReturns the total supply of the token in its smallest units.
balanceOfReturns the token balance of a specific address (owner)
allowanceReturns the amount of tokens that the spender is allowed to spend
approveAllows the owner to approve a spender to spend
decreaseAllowanceDecreases the amount of tokens that a spender is allowed to spend
increaseAllowanceIncreases the amount of tokens that a spender is allowed
transferAllows the sender to transfer a certain amount of tokens
transferFromAllows the spender to transfer a certain amount of tokens

Available Properties in ERC721

PropertiesDescription
nameReturns the name of the NFT contract
symbolReturns the symbol (ticker) of the NFT contract
balanceOfReturns the number of NFTs owned by a specific address (owner).
ownerofReturns the address of the owner of a specific NFT identified
getApprovedReturns the address that has been approved to take ownership
isApprovedForAllReturns whether a specific operator address is approved
tokenURIReturns the metadata URI associated with a specific NFT identified
safeTransferFromSafely transfers the ownership of a specific NFT from the sender
transferFromTransfers the ownership of a specific NFT
approveApproves another address (to) to take ownership of a specific NFT
setApprovalForAllSets or revokes operator status for an address to manage all NFTs

Available Properties in ERC1155

PropertiesDescription
balanceOfReturns the amount of tokens of token type id owned by account
balanceOfBatchReturns the balances of multiple token IDs for multiple accounts
setApprovalForAllGrants permission to operator to transfer tokens
isApprovedForAllReturns true if operator is approved to transfer tokens.
safeTransferFromSafely transfers specific token type and quantity
safeBatchTransferFromSafely transfers multiple token types and quantities
uriReturns the URI of that tokenId

Available Properties in DATASERVICE

PropertiesDescription
getAccountBalancesReturns the account balances for the particular address
getTransactionReturns the transaction history for the particular transactions
getNftsListReturns the nfts list for the particular address

Available Properties in PAYMASTER

PropertiesDescription
addWhitelistTo add a whitelist using the specified accountAddress and chain ID
checkWhitelistTo check a whitelist using the specified accountAddress and chain ID
depositWhitelistTo Deposit using the specified amount and chain ID
getSponsorBalanceTo get a sponsor balance using the specified sponsorAddress and chain ID
0.2.8

11 days ago

0.2.7

22 days ago

0.2.5

29 days ago

0.2.4

1 month ago

0.2.3

1 month ago

0.2.2

2 months ago

0.2.1

2 months ago

0.2.0

2 months ago

0.1.10

2 months ago

0.1.8

2 months ago

0.1.9

2 months ago

0.1.7

2 months ago

0.1.6-beta-2

3 months ago

0.1.6-beta-1

3 months ago

0.1.6-beta

3 months ago

0.1.5

3 months ago

0.1.4

3 months ago

0.1.2

5 months ago

0.1.3

5 months ago

0.1.1

5 months ago

0.1.0

6 months ago

0.0.10

7 months ago

0.0.9

7 months ago

0.0.8

8 months ago

0.0.7

8 months ago

0.0.6

8 months ago

0.0.5

8 months ago

0.0.4

8 months ago

0.0.3

9 months ago

0.0.2

9 months ago

0.0.1

10 months ago