@pianity/arsnap-adapter / Exports
- clearLogs
- connect
- deleteWallet
- getActiveAddress
- getActivePublicKey
- getAllAddresses
- getDappsPermissions
- getLogs
- getPermissions
- getWalletNames
- importWallet
- isEnabled
- isUnlocked
- renameWallet
- requestPermissions
- revokeAllPermissions
- revokeDappPermission
- revokePermission
- sendWinstonTo
- setActiveAddress
- signBytes
- signTx
Ƭ LogEntry: Object
Name | Type |
---|---|
info |
RpcLogInfo |
origin |
string |
timestamp |
number |
Ƭ RpcLogInfo: { [K in keyof RpcMethods]: Object[K] & { [K in keyof RpcMethods]: Object }[K] }[keyof RpcMethods
]
Ƭ RpcMethods: Object
Name | Type |
---|---|
clear_logs |
() => Promise <null > |
delete_wallet |
(address : string ) => Promise <null > |
get_active_address |
() => Promise <string > |
get_active_public_key |
() => Promise <string > |
get_all_addresses |
() => Promise <string []> |
get_dapps_permissions |
() => Promise <[dappOrigin: string, permissions: RpcPermission[]][]> |
get_logs |
() => Promise <[dappOrigin: string, logs: LogEntry[]][]> |
get_permissions |
() => Promise <RpcPermission []> |
get_wallet_names |
() => Promise <[address: string, name: string][]> |
import_wallet |
(wallet : JWKInterface , name? : string ) => Promise <{ address : string ; name : string }> |
is_enabled |
() => Promise <boolean > |
rename_wallet |
(address : string , name : string ) => Promise <null > |
request_permissions |
(permissions : RpcPermission []) => Promise <"granted" | "already_granted" | "declined" > |
revoke_all_permissions |
() => Promise <null > |
revoke_dapp_permissions |
(dappOrigin : string , permissions : RpcPermission []) => Promise <null > |
revoke_permissions |
(permissions : RpcPermission []) => Promise <null > |
set_active_address |
(address : string ) => Promise <null > |
sign_bytes |
(bytes : Uint8Array , saltLength : number ) => Promise <Uint8Array > |
Ƭ RpcParam: { [K in keyof RpcMethods]: Object }[keyof RpcMethods
]
Ƭ RpcPermission: Exclude
<{ [K in keyof RpcMethods]: typeof RPC_PERMISSIONS[K] }[keyof typeof RPC_PERMISSIONS
], null
>
Ƭ RpcResponse: { [K in keyof RpcMethods]: ReturnType<RpcMethods[K]> }[keyof RpcMethods
]
• Const
RPC_PERMISSIONS: Object
Name | Type |
---|---|
clear_logs |
"CLEAR_LOGS" |
delete_wallet |
"DELETE_WALLET" |
get_active_address |
"GET_ACTIVE_ADDRESS" |
get_active_public_key |
"GET_ACTIVE_PUBLIC_KEY" |
get_all_addresses |
"GET_ALL_ADDRESSES" |
get_dapps_permissions |
"GET_DAPPS_PERMISSIONS" |
get_logs |
"GET_LOGS" |
get_permissions |
null |
get_wallet_names |
"GET_ALL_ADDRESSES" |
import_wallet |
"IMPORT_WALLET" |
is_enabled |
null |
rename_wallet |
"RENAME_WALLET" |
request_permissions |
null |
revoke_all_permissions |
null |
revoke_dapp_permissions |
"REVOKE_DAPP_PERMISSIONS" |
revoke_permissions |
null |
set_active_address |
"SET_ACTIVE_ADDRESS" |
sign_bytes |
"SIGN" |
▸ clearLogs(): Promise
<null
>
Promise
<null
>
Requires
"CLEAR_LOGS"
▸ connect(): Promise
<void
>
Promise
<void
>
▸ deleteWallet(address
): Promise
<null
>
Name | Type |
---|---|
address |
string |
Promise
<null
>
Requires
"DELETE_WALLET"
▸ getActiveAddress(): Promise
<string
>
Get the address of the currently active wallet.
Promise
<string
>
Requires
"GET_ACTIVE_ADDRESS"
▸ getActivePublicKey(): Promise
<string
>
Get the public key of the currently active wallet.
Promise
<string
>
Requires
"GET_ACTIVE_PUBLIC_KEY"
▸ getAllAddresses(): Promise
<string
[]>
Get addresses for all the stored wallets.
Promise
<string
[]>
Requires
"GET_ALL_ADDRESSES"
▸ getDappsPermissions(): Promise
<[dappOrigin: string, permissions: RpcPermission[]][]>
Get permisssions granted for all dApps.
Promise
<[dappOrigin: string, permissions: RpcPermission[]][]>
Requires
"GET_DAPPS_PERMISSIONS"
▸ getLogs(): Promise
<[dappOrigin: string, logs: LogEntry[]][]>
Promise
<[dappOrigin: string, logs: LogEntry[]][]>
Requires
"GET_LOGS"
▸ getPermissions(): Promise
<RpcPermission
[]>
Get the permissions granted to current dApp.
Promise
<RpcPermission
[]>
▸ getWalletNames(): Promise
<[address: string, name: string][]>
Get all the addresses and their names.
Promise
<[address: string, name: string][]>
Requires
"GET_ALL_ADDRESSES"
▸ importWallet(wallet
, name?
): Promise
<{ address
: string
; name
: string
}>
Name | Type |
---|---|
wallet |
JWKInterface |
name? |
string |
Promise
<{ address
: string
; name
: string
}>
Requires
"IMPORT_WALLET"
▸ isEnabled(): Promise
<boolean
>
Promise
<boolean
>
▸ isUnlocked(timeout?
): Promise
<boolean
| "timeout"
>
WARNING: This function relies on an experimental Metamask API.
Name | Type | Default value |
---|---|---|
timeout |
number |
5 |
Promise
<boolean
| "timeout"
>
▸ renameWallet(address
, name
): Promise
<null
>
Name | Type |
---|---|
address |
string |
name |
string |
Promise
<null
>
Requires
"RENAME_WALLET"
▸ requestPermissions(permissions
): Promise
<"granted"
| "already_granted"
| "declined"
>
Request permissions for the current dApp.
Name | Type |
---|---|
permissions |
RpcPermission [] |
Promise
<"granted"
| "already_granted"
| "declined"
>
▸ revokeAllPermissions(): Promise
<null
>
Revoke all the granted permissions for the current dApp.
Promise
<null
>
▸ revokeDappPermission(dappOrigin
, permissions
): Promise
<null
>
Revoke permissions for the specified dApp.
Name | Type |
---|---|
dappOrigin |
string |
permissions |
RpcPermission [] |
Promise
<null
>
Requires
"REVOKE_DAPP_PERMISSIONS"
▸ revokePermission(permissions
): Promise
<null
>
Revoke permissions for the current dApp.
Name | Type |
---|---|
permissions |
RpcPermission [] |
Promise
<null
>
▸ sendWinstonTo(arweave
, winston
, recipient
): Promise
<void
>
Send winston
winstons using the current active wallet.
Name | Type | Description |
---|---|---|
arweave |
default |
Arweave client used to send the transaction |
winston |
string |
Amount of winstons to send (1 winston = 0.000000000001 AR) |
recipient |
string |
Address that should receive the winstons |
Promise
<void
>
Requires
- ["GET_ACTIVE_PUBLIC_KEY", "SIGN"]
▸ setActiveAddress(address
): Promise
<null
>
Name | Type |
---|---|
address |
string |
Promise
<null
>
Requires
"SET_ACTIVE_ADDRESS"
▸ signBytes(bytes
, saltLength
): Promise
<Uint8Array
>
Sign bytes with the currently active wallet.
Name | Type |
---|---|
bytes |
Uint8Array |
saltLength |
number |
Promise
<Uint8Array
>
Requires
"SIGN"
▸ signTx(tx
): Promise
<void
>
Sign a transaction with the current active wallet.
Name | Type | Description |
---|---|---|
tx |
default |
The transaction to sign |
Promise
<void
>
Requires
- ["GET_ACTIVE_PUBLIC_KEY", "SIGN"]