0.1.6-beta-1 • Published 2 years ago

@kanalabs/mirai v0.1.6-beta-1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Mirai

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

Installation

npm i @kanalabs/mirai

Supported Networks

Mainnets:

- AptosMainnet
- Arbitrum
- Avalanche
- Base
- Bifrost
- Bsc
- Chiado
- Flare
- Fuji
- Fuse
- Gnosis
- Klaytn
- Linea
- Mainnet
- Mantle
- Optimism
- Polygon
- Scroll

Testnets:

- AptosTestnet
- ArbitrumGoerli
- BaseGoerli
- BifrostTestnet
- BscTestnet
- FlareTestnet
- FuseSparknet
- Goerli
- KlaytnTestnet
- KromaTestnet
- LineaTestnet
- Mumbai
- OptimismGoerli
- RSKTestnet
- Sepolia
- ScrollSepolia
- VerseTestnet

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. Returns KanaWallet address Note Pass network to initialize the SDK instance of a particular network Ex: initialize("mumbai") call without parameters to initialize the SDK instances for all available networks at once Ex: initialize()
getNativeBalance(network?: NetworkNames)To get the native token balance of the smart wallet. Returns native token balance Note Pass network to get balance for one particular network Ex: getNativeBalance("mumbai") call without parameters to get native tokrn balance of all available networks at once Ex: getNativeBalance()
destroy(network?: NetworkNames)To destroy the SDK instance. Note Pass network to destroy the SDK instance of a particular network Ex: destroy("mumbai") call without parameters to destroy the SDK instances for all available networks at once Ex: destroy()
setCurrentInstance(network: NetworkNames)To set the default SDK instance. Returns the SDK instance of the given network Example setCurrentInstance(NetworkNames.Mumbai) This will return the SDK instance of mumbai and you can use seleted methods without passing the network parameter and they will work as usual
erc20(tokenAddress: string, network?: NetworkNames)To get the ERC20 token instance for building ERC20 transactions. Returns the ERC20 contract instance Note Pass network parameter with token address if the token is in defferent network than the current default network pass only the token address if both token network and current default network are same Ex: const erc20 = sdk.erc20('0xb33EaAd8d922B1083446DC23f610c2567fB5180f', NetworkNames.Polygon)
erc721(collectionAddress: string, network?: NetworkNames)To get the ERC721 collection instance for building ERC721 transactions. Returns the ERC721 contract instance Note Pass network parameter with collection address if the collection is in defferent network than the current default network pass only the collection address if both collection network and current default network are same Ex: const erc721 = sdk.erc721('0x7EAc1dE03B5d12ce6F1799b9FA9795393D256f12', NetworkNames.Mumbai)
isNetworkActive(networkName: string): booleanTo check if the given network is available and active. Returns bool Example const isActive = isNetworkActive(networkName)
getProvider(network: NetworkNames): providers.JsonRpcProviderTo get the Rpc Provider for the given network. Returns providers.JsonRpcProvider Example const isActive = isNetworkActive(networkName)

Available Methods in SDK

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

2 years ago

0.2.7

2 years ago

0.2.5

2 years ago

0.2.4

2 years ago

0.2.3

2 years ago

0.2.2

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.10

2 years ago

0.1.8

2 years ago

0.1.9

2 years ago

0.1.7

2 years ago

0.1.6-beta-2

2 years ago

0.1.6-beta-1

2 years ago

0.1.6-beta

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.2

2 years ago

0.1.3

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago