@txnlab/use-wallet 2.8.2 → 3.0.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1009
- package/dist/index.cjs +5636 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +543 -0
- package/dist/index.d.ts +463 -897
- package/dist/index.js +5601 -0
- package/dist/index.js.map +1 -0
- package/package.json +52 -120
- package/dist/cjs/index.js +0 -3954
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/jest.config.d.ts +0 -11
- package/dist/cjs/jest.setup.d.ts +0 -0
- package/dist/cjs/src/algod/index.d.ts +0 -10
- package/dist/cjs/src/clients/algosigner/client.d.ts +0 -37
- package/dist/cjs/src/clients/algosigner/constants.d.ts +0 -2
- package/dist/cjs/src/clients/algosigner/index.d.ts +0 -2
- package/dist/cjs/src/clients/algosigner/types.d.ts +0 -39
- package/dist/cjs/src/clients/base/base.d.ts +0 -46
- package/dist/cjs/src/clients/base/index.d.ts +0 -2
- package/dist/cjs/src/clients/custom/client.d.ts +0 -18
- package/dist/cjs/src/clients/custom/constants.d.ts +0 -1
- package/dist/cjs/src/clients/custom/index.d.ts +0 -2
- package/dist/cjs/src/clients/custom/types.d.ts +0 -25
- package/dist/cjs/src/clients/daffi/client.d.ts +0 -34
- package/dist/cjs/src/clients/daffi/constants.d.ts +0 -1
- package/dist/cjs/src/clients/daffi/index.d.ts +0 -2
- package/dist/cjs/src/clients/daffi/types.d.ts +0 -27
- package/dist/cjs/src/clients/defly/client.d.ts +0 -34
- package/dist/cjs/src/clients/defly/constants.d.ts +0 -1
- package/dist/cjs/src/clients/defly/index.d.ts +0 -2
- package/dist/cjs/src/clients/defly/types.d.ts +0 -32
- package/dist/cjs/src/clients/exodus/client.d.ts +0 -33
- package/dist/cjs/src/clients/exodus/constants.d.ts +0 -1
- package/dist/cjs/src/clients/exodus/index.d.ts +0 -2
- package/dist/cjs/src/clients/exodus/types.d.ts +0 -34
- package/dist/cjs/src/clients/index.d.ts +0 -19
- package/dist/cjs/src/clients/kibisis/client.d.ts +0 -73
- package/dist/cjs/src/clients/kibisis/constants.d.ts +0 -37
- package/dist/cjs/src/clients/kibisis/index.d.ts +0 -2
- package/dist/cjs/src/clients/kibisis/types.d.ts +0 -86
- package/dist/cjs/src/clients/kibisis/utils.d.ts +0 -9
- package/dist/cjs/src/clients/kibisis/utils.test.d.ts +0 -1
- package/dist/cjs/src/clients/kmd/client.d.ts +0 -30
- package/dist/cjs/src/clients/kmd/constants.d.ts +0 -1
- package/dist/cjs/src/clients/kmd/index.d.ts +0 -2
- package/dist/cjs/src/clients/kmd/types.d.ts +0 -32
- package/dist/cjs/src/clients/lute/client.d.ts +0 -34
- package/dist/cjs/src/clients/lute/constants.d.ts +0 -1
- package/dist/cjs/src/clients/lute/index.d.ts +0 -2
- package/dist/cjs/src/clients/lute/types.d.ts +0 -15
- package/dist/cjs/src/clients/magic/client.d.ts +0 -35
- package/dist/cjs/src/clients/magic/constants.d.ts +0 -1
- package/dist/cjs/src/clients/magic/index.d.ts +0 -2
- package/dist/cjs/src/clients/magic/types.d.ts +0 -27
- package/dist/cjs/src/clients/mnemonic/client.d.ts +0 -35
- package/dist/cjs/src/clients/mnemonic/constants.d.ts +0 -1
- package/dist/cjs/src/clients/mnemonic/index.d.ts +0 -2
- package/dist/cjs/src/clients/mnemonic/types.d.ts +0 -21
- package/dist/cjs/src/clients/myalgo/client.d.ts +0 -33
- package/dist/cjs/src/clients/myalgo/constants.d.ts +0 -1
- package/dist/cjs/src/clients/myalgo/index.d.ts +0 -2
- package/dist/cjs/src/clients/myalgo/types.d.ts +0 -19
- package/dist/cjs/src/clients/pera/client.d.ts +0 -34
- package/dist/cjs/src/clients/pera/constants.d.ts +0 -1
- package/dist/cjs/src/clients/pera/index.d.ts +0 -2
- package/dist/cjs/src/clients/pera/types.d.ts +0 -27
- package/dist/cjs/src/clients/walletconnect2/client.d.ts +0 -36
- package/dist/cjs/src/clients/walletconnect2/constants.d.ts +0 -5
- package/dist/cjs/src/clients/walletconnect2/index.d.ts +0 -2
- package/dist/cjs/src/clients/walletconnect2/types.d.ts +0 -28
- package/dist/cjs/src/clients/walletconnect2/utils.d.ts +0 -2
- package/dist/cjs/src/constants/constants.d.ts +0 -20
- package/dist/cjs/src/constants/index.d.ts +0 -1
- package/dist/cjs/src/context/WalletContext.d.ts +0 -8
- package/dist/cjs/src/hooks/index.d.ts +0 -2
- package/dist/cjs/src/hooks/useInitializeProviders.d.ts +0 -10
- package/dist/cjs/src/hooks/useInitializeProviders.test.d.ts +0 -4
- package/dist/cjs/src/hooks/useWallet.d.ts +0 -31
- package/dist/cjs/src/hooks/useWallet.test.d.ts +0 -4
- package/dist/cjs/src/index.d.ts +0 -6
- package/dist/cjs/src/media/audio.d.ts +0 -1
- package/dist/cjs/src/store/index.d.ts +0 -2
- package/dist/cjs/src/store/state/debugStore.d.ts +0 -6
- package/dist/cjs/src/store/state/walletStore.d.ts +0 -52
- package/dist/cjs/src/testUtils/mockAccounts.d.ts +0 -3
- package/dist/cjs/src/testUtils/mockClients.d.ts +0 -45
- package/dist/cjs/src/types/api.d.ts +0 -14
- package/dist/cjs/src/types/index.d.ts +0 -4
- package/dist/cjs/src/types/node.d.ts +0 -44
- package/dist/cjs/src/types/providers.d.ts +0 -148
- package/dist/cjs/src/types/utilities.d.ts +0 -1
- package/dist/cjs/src/types/wallet.d.ts +0 -54
- package/dist/cjs/src/utils/clearAccounts.d.ts +0 -2
- package/dist/cjs/src/utils/clearAccounts.test.d.ts +0 -1
- package/dist/cjs/src/utils/debugLog.d.ts +0 -3
- package/dist/cjs/src/utils/encodeNFDTransactionArray.spec.d.ts +0 -1
- package/dist/cjs/src/utils/encodeNFDTransactionsArray.d.ts +0 -2
- package/dist/cjs/src/utils/encoding.d.ts +0 -4
- package/dist/cjs/src/utils/index.d.ts +0 -3
- package/dist/cjs/src/utils/initializeProviders.d.ts +0 -3
- package/dist/cjs/src/utils/initializeProviders.test.d.ts +0 -4
- package/dist/cjs/src/utils/providers.d.ts +0 -3
- package/dist/cjs/src/utils/providers.spec.d.ts +0 -1
- package/dist/cjs/src/utils/reconnectProviders.d.ts +0 -2
- package/dist/cjs/src/utils/reconnectProviders.test.d.ts +0 -1
- package/dist/cjs/src/utils/svgToBase64.d.ts +0 -1
- package/dist/cjs/src/utils/types.d.ts +0 -2
- package/dist/esm/index.js +0 -3931
- package/dist/esm/jest.config.d.ts +0 -11
- package/dist/esm/jest.setup.d.ts +0 -0
- package/dist/esm/src/algod/index.d.ts +0 -10
- package/dist/esm/src/clients/algosigner/client.d.ts +0 -37
- package/dist/esm/src/clients/algosigner/constants.d.ts +0 -2
- package/dist/esm/src/clients/algosigner/index.d.ts +0 -2
- package/dist/esm/src/clients/algosigner/types.d.ts +0 -39
- package/dist/esm/src/clients/base/base.d.ts +0 -46
- package/dist/esm/src/clients/base/index.d.ts +0 -2
- package/dist/esm/src/clients/custom/client.d.ts +0 -18
- package/dist/esm/src/clients/custom/constants.d.ts +0 -1
- package/dist/esm/src/clients/custom/index.d.ts +0 -2
- package/dist/esm/src/clients/custom/types.d.ts +0 -25
- package/dist/esm/src/clients/daffi/client.d.ts +0 -34
- package/dist/esm/src/clients/daffi/constants.d.ts +0 -1
- package/dist/esm/src/clients/daffi/index.d.ts +0 -2
- package/dist/esm/src/clients/daffi/types.d.ts +0 -27
- package/dist/esm/src/clients/defly/client.d.ts +0 -34
- package/dist/esm/src/clients/defly/constants.d.ts +0 -1
- package/dist/esm/src/clients/defly/index.d.ts +0 -2
- package/dist/esm/src/clients/defly/types.d.ts +0 -32
- package/dist/esm/src/clients/exodus/client.d.ts +0 -33
- package/dist/esm/src/clients/exodus/constants.d.ts +0 -1
- package/dist/esm/src/clients/exodus/index.d.ts +0 -2
- package/dist/esm/src/clients/exodus/types.d.ts +0 -34
- package/dist/esm/src/clients/index.d.ts +0 -19
- package/dist/esm/src/clients/kibisis/client.d.ts +0 -73
- package/dist/esm/src/clients/kibisis/constants.d.ts +0 -37
- package/dist/esm/src/clients/kibisis/index.d.ts +0 -2
- package/dist/esm/src/clients/kibisis/types.d.ts +0 -86
- package/dist/esm/src/clients/kibisis/utils.d.ts +0 -9
- package/dist/esm/src/clients/kibisis/utils.test.d.ts +0 -1
- package/dist/esm/src/clients/kmd/client.d.ts +0 -30
- package/dist/esm/src/clients/kmd/constants.d.ts +0 -1
- package/dist/esm/src/clients/kmd/index.d.ts +0 -2
- package/dist/esm/src/clients/kmd/types.d.ts +0 -32
- package/dist/esm/src/clients/lute/client.d.ts +0 -34
- package/dist/esm/src/clients/lute/constants.d.ts +0 -1
- package/dist/esm/src/clients/lute/index.d.ts +0 -2
- package/dist/esm/src/clients/lute/types.d.ts +0 -15
- package/dist/esm/src/clients/magic/client.d.ts +0 -35
- package/dist/esm/src/clients/magic/constants.d.ts +0 -1
- package/dist/esm/src/clients/magic/index.d.ts +0 -2
- package/dist/esm/src/clients/magic/types.d.ts +0 -27
- package/dist/esm/src/clients/mnemonic/client.d.ts +0 -35
- package/dist/esm/src/clients/mnemonic/constants.d.ts +0 -1
- package/dist/esm/src/clients/mnemonic/index.d.ts +0 -2
- package/dist/esm/src/clients/mnemonic/types.d.ts +0 -21
- package/dist/esm/src/clients/myalgo/client.d.ts +0 -33
- package/dist/esm/src/clients/myalgo/constants.d.ts +0 -1
- package/dist/esm/src/clients/myalgo/index.d.ts +0 -2
- package/dist/esm/src/clients/myalgo/types.d.ts +0 -19
- package/dist/esm/src/clients/pera/client.d.ts +0 -34
- package/dist/esm/src/clients/pera/constants.d.ts +0 -1
- package/dist/esm/src/clients/pera/index.d.ts +0 -2
- package/dist/esm/src/clients/pera/types.d.ts +0 -27
- package/dist/esm/src/clients/walletconnect2/client.d.ts +0 -36
- package/dist/esm/src/clients/walletconnect2/constants.d.ts +0 -5
- package/dist/esm/src/clients/walletconnect2/index.d.ts +0 -2
- package/dist/esm/src/clients/walletconnect2/types.d.ts +0 -28
- package/dist/esm/src/clients/walletconnect2/utils.d.ts +0 -2
- package/dist/esm/src/constants/constants.d.ts +0 -20
- package/dist/esm/src/constants/index.d.ts +0 -1
- package/dist/esm/src/context/WalletContext.d.ts +0 -8
- package/dist/esm/src/hooks/index.d.ts +0 -2
- package/dist/esm/src/hooks/useInitializeProviders.d.ts +0 -10
- package/dist/esm/src/hooks/useInitializeProviders.test.d.ts +0 -4
- package/dist/esm/src/hooks/useWallet.d.ts +0 -31
- package/dist/esm/src/hooks/useWallet.test.d.ts +0 -4
- package/dist/esm/src/index.d.ts +0 -6
- package/dist/esm/src/media/audio.d.ts +0 -1
- package/dist/esm/src/store/index.d.ts +0 -2
- package/dist/esm/src/store/state/debugStore.d.ts +0 -6
- package/dist/esm/src/store/state/walletStore.d.ts +0 -52
- package/dist/esm/src/testUtils/mockAccounts.d.ts +0 -3
- package/dist/esm/src/testUtils/mockClients.d.ts +0 -45
- package/dist/esm/src/types/api.d.ts +0 -14
- package/dist/esm/src/types/index.d.ts +0 -4
- package/dist/esm/src/types/node.d.ts +0 -44
- package/dist/esm/src/types/providers.d.ts +0 -148
- package/dist/esm/src/types/utilities.d.ts +0 -1
- package/dist/esm/src/types/wallet.d.ts +0 -54
- package/dist/esm/src/utils/clearAccounts.d.ts +0 -2
- package/dist/esm/src/utils/clearAccounts.test.d.ts +0 -1
- package/dist/esm/src/utils/debugLog.d.ts +0 -3
- package/dist/esm/src/utils/encodeNFDTransactionArray.spec.d.ts +0 -1
- package/dist/esm/src/utils/encodeNFDTransactionsArray.d.ts +0 -2
- package/dist/esm/src/utils/encoding.d.ts +0 -4
- package/dist/esm/src/utils/index.d.ts +0 -3
- package/dist/esm/src/utils/initializeProviders.d.ts +0 -3
- package/dist/esm/src/utils/initializeProviders.test.d.ts +0 -4
- package/dist/esm/src/utils/providers.d.ts +0 -3
- package/dist/esm/src/utils/providers.spec.d.ts +0 -1
- package/dist/esm/src/utils/reconnectProviders.d.ts +0 -2
- package/dist/esm/src/utils/reconnectProviders.test.d.ts +0 -1
- package/dist/esm/src/utils/svgToBase64.d.ts +0 -1
- package/dist/esm/src/utils/types.d.ts +0 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,977 +1,543 @@
|
|
|
1
|
+
import { Store } from '@tanstack/store';
|
|
1
2
|
import algosdk from 'algosdk';
|
|
2
|
-
import { PeraWalletConnect } from '@perawallet/connect';
|
|
3
|
-
import { DeflyWalletConnect } from '@blockshake/defly-connect';
|
|
4
|
-
import { DaffiWalletConnect } from '@daffiwallet/connect';
|
|
5
|
-
import LuteConnect from 'lute-connect';
|
|
6
|
-
import { Magic } from 'magic-sdk';
|
|
7
|
-
import { AlgorandExtension } from '@magic-ext/algorand';
|
|
8
|
-
import MyAlgoConnect from '@randlabs/myalgo-connect';
|
|
9
|
-
import { WalletConnectModalSignOptions, WalletConnectModalSign } from '@walletconnect/modal-sign-html';
|
|
10
|
-
import React from 'react';
|
|
11
|
-
import * as zustand_middleware from 'zustand/middleware';
|
|
12
|
-
import * as immer_dist_internal from 'immer/dist/internal';
|
|
13
|
-
import * as zustand from 'zustand';
|
|
14
3
|
import { InstanceWithExtensions, SDKBase } from '@magic-sdk/provider';
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
gh: Uint8Array;
|
|
26
|
-
grp: Uint8Array;
|
|
27
|
-
lv: number;
|
|
28
|
-
snd: Uint8Array;
|
|
29
|
-
type: string;
|
|
30
|
-
};
|
|
31
|
-
type ConfirmedTxn = {
|
|
32
|
-
'confirmed-round': number;
|
|
33
|
-
'global-state-delta': Record<string, unknown>[];
|
|
34
|
-
'pool-error': string;
|
|
35
|
-
txn: {
|
|
36
|
-
sig: Uint8Array;
|
|
37
|
-
txn: Txn;
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
|
-
type TxnType = 'pay' | 'keyreg' | 'acfg' | 'axfer' | 'afrz' | 'appl' | 'stpf';
|
|
41
|
-
type DecodedTransaction = {
|
|
42
|
-
amt: number;
|
|
43
|
-
fee: number;
|
|
44
|
-
fv: number;
|
|
45
|
-
gen: string;
|
|
46
|
-
gh: Uint8Array;
|
|
47
|
-
grp: Uint8Array;
|
|
48
|
-
lv: number;
|
|
49
|
-
note: Uint8Array;
|
|
50
|
-
rcv: Uint8Array;
|
|
51
|
-
snd: Uint8Array;
|
|
52
|
-
type: TxnType;
|
|
53
|
-
};
|
|
54
|
-
type DecodedSignedTransaction = {
|
|
55
|
-
sig: Uint8Array;
|
|
56
|
-
txn: DecodedTransaction;
|
|
57
|
-
};
|
|
58
|
-
type AlgodClientOptions = ConstructorParameters<typeof algosdk.Algodv2>;
|
|
59
|
-
|
|
60
|
-
type TransactionsArray = ['u' | 's', string][];
|
|
61
|
-
type TxnInfo = {
|
|
62
|
-
groupIndex: number;
|
|
63
|
-
amount: number;
|
|
64
|
-
from: string;
|
|
65
|
-
to: string;
|
|
66
|
-
type: TxnType;
|
|
67
|
-
txn: string;
|
|
68
|
-
signedTxn?: Uint8Array;
|
|
69
|
-
};
|
|
70
|
-
type RawTxnResponse = {
|
|
71
|
-
txId: string;
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
declare enum PROVIDER_ID {
|
|
75
|
-
KMD = "kmd",
|
|
76
|
-
CUSTOM = "custom",
|
|
77
|
-
PERA = "pera",
|
|
78
|
-
DAFFI = "daffi",
|
|
79
|
-
LUTE = "lute",
|
|
80
|
-
MYALGO = "myalgo",
|
|
81
|
-
ALGOSIGNER = "algosigner",
|
|
82
|
-
DEFLY = "defly",
|
|
83
|
-
EXODUS = "exodus",
|
|
84
|
-
KIBISIS = "kibisis",
|
|
85
|
-
WALLETCONNECT = "walletconnect",
|
|
86
|
-
MNEMONIC = "mnemonic",
|
|
87
|
-
MAGIC = "magic"
|
|
4
|
+
import { AlgorandExtension } from '@magic-ext/algorand';
|
|
5
|
+
import { MagicUserMetadata } from 'magic-sdk';
|
|
6
|
+
import { WalletConnectModalConfig } from '@walletconnect/modal';
|
|
7
|
+
import { SignClientTypes } from '@walletconnect/types';
|
|
8
|
+
|
|
9
|
+
declare enum NetworkId {
|
|
10
|
+
MAINNET = "mainnet",
|
|
11
|
+
TESTNET = "testnet",
|
|
12
|
+
BETANET = "betanet",
|
|
13
|
+
LOCALNET = "localnet"
|
|
88
14
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
interface Account {
|
|
95
|
-
providerId: PROVIDER_ID;
|
|
96
|
-
name: string;
|
|
97
|
-
address: string;
|
|
98
|
-
authAddr?: string;
|
|
99
|
-
email?: string;
|
|
15
|
+
interface AlgodConfig {
|
|
16
|
+
token: string | algosdk.AlgodTokenHeader | algosdk.CustomTokenHeader | algosdk.BaseHTTPClient;
|
|
17
|
+
baseServer: string;
|
|
18
|
+
port?: string | number;
|
|
19
|
+
headers?: Record<string, string>;
|
|
100
20
|
}
|
|
101
|
-
type
|
|
102
|
-
|
|
103
|
-
isActive: boolean;
|
|
104
|
-
isConnected: boolean;
|
|
105
|
-
connect: (arg?: any, throws?: boolean) => Promise<void>;
|
|
106
|
-
disconnect: () => Promise<void>;
|
|
107
|
-
reconnect: () => Promise<void>;
|
|
108
|
-
setActiveProvider: () => void;
|
|
109
|
-
setActiveAccount: (account: string) => void;
|
|
110
|
-
metadata: Metadata;
|
|
111
|
-
};
|
|
112
|
-
type Asset = {
|
|
113
|
-
amount: number;
|
|
114
|
-
'asset-id': number;
|
|
115
|
-
creator: string;
|
|
116
|
-
'is-frozen': boolean;
|
|
117
|
-
'unit-name': string;
|
|
118
|
-
name: string;
|
|
119
|
-
};
|
|
120
|
-
type AccountInfo = {
|
|
121
|
-
address: string;
|
|
122
|
-
amount: number;
|
|
123
|
-
'min-balance': number;
|
|
124
|
-
'auth-addr'?: string;
|
|
125
|
-
assets?: Asset[];
|
|
126
|
-
};
|
|
127
|
-
type WalletProvider$1 = {
|
|
128
|
-
id: PROVIDER_ID;
|
|
129
|
-
name: string;
|
|
130
|
-
icon: string;
|
|
131
|
-
isWalletConnect: boolean;
|
|
132
|
-
};
|
|
133
|
-
type ExtendValues<Type> = {
|
|
134
|
-
[Property in keyof Type]: Type[Property] | null;
|
|
135
|
-
};
|
|
136
|
-
type Wallet = ExtendValues<WalletProvider$1> & {
|
|
137
|
-
accounts: Account[];
|
|
138
|
-
};
|
|
139
|
-
type Metadata = {
|
|
140
|
-
id: PROVIDER_ID;
|
|
141
|
-
name: string;
|
|
142
|
-
icon: string;
|
|
143
|
-
isWalletConnect: boolean;
|
|
144
|
-
};
|
|
145
|
-
type ClientOptions = Record<string, any>;
|
|
21
|
+
type NetworkConfigMap = Record<NetworkId, AlgodConfig>;
|
|
22
|
+
type NetworkConfig = Partial<AlgodConfig> | Partial<Record<NetworkId, Partial<AlgodConfig>>>;
|
|
146
23
|
|
|
147
|
-
|
|
24
|
+
interface DeflyWalletConnectOptions {
|
|
148
25
|
bridge?: string;
|
|
149
26
|
shouldShowSignTxnToast?: boolean;
|
|
150
27
|
chainId?: 416001 | 416002 | 416003 | 4160;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
network: Network;
|
|
159
|
-
};
|
|
160
|
-
|
|
161
|
-
type DeflyWalletConnectOptions = {
|
|
162
|
-
bridge?: string;
|
|
163
|
-
deep_link?: string;
|
|
164
|
-
app_meta?: {
|
|
165
|
-
logo: string;
|
|
28
|
+
}
|
|
29
|
+
declare class DeflyWallet extends BaseWallet {
|
|
30
|
+
private client;
|
|
31
|
+
private options;
|
|
32
|
+
protected store: Store<State>;
|
|
33
|
+
constructor({ id, store, subscribe, getAlgodClient, options, metadata }: WalletConstructor<WalletId.DEFLY>);
|
|
34
|
+
static defaultMetadata: {
|
|
166
35
|
name: string;
|
|
167
|
-
|
|
36
|
+
icon: string;
|
|
168
37
|
};
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
algodClient: algosdk.Algodv2;
|
|
177
|
-
network: Network;
|
|
178
|
-
};
|
|
38
|
+
private initializeClient;
|
|
39
|
+
connect: () => Promise<WalletAccount[]>;
|
|
40
|
+
disconnect: () => Promise<void>;
|
|
41
|
+
resumeSession: () => Promise<void>;
|
|
42
|
+
signTransactions: (txnGroup: algosdk.Transaction[] | algosdk.Transaction[][] | Uint8Array[] | Uint8Array[][], indexesToSign?: number[], returnGroup?: boolean) => Promise<Uint8Array[]>;
|
|
43
|
+
transactionSigner: (txnGroup: algosdk.Transaction[], indexesToSign: number[]) => Promise<Uint8Array[]>;
|
|
44
|
+
}
|
|
179
45
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
46
|
+
/** @see https://docs.exodus.com/api-reference/algorand-provider-arc-api/ */
|
|
47
|
+
interface EnableNetworkOpts {
|
|
48
|
+
genesisID?: string;
|
|
49
|
+
genesisHash?: string;
|
|
50
|
+
}
|
|
51
|
+
interface EnableAccountsOpts {
|
|
52
|
+
accounts?: string[];
|
|
53
|
+
}
|
|
54
|
+
type ExodusOptions = EnableNetworkOpts & EnableAccountsOpts;
|
|
55
|
+
interface EnableNetworkResult {
|
|
56
|
+
genesisID: string;
|
|
57
|
+
genesisHash: string;
|
|
58
|
+
}
|
|
59
|
+
interface EnableAccountsResult {
|
|
60
|
+
accounts: string[];
|
|
61
|
+
}
|
|
62
|
+
type EnableResult = EnableNetworkResult & EnableAccountsResult;
|
|
63
|
+
type SignTxnsResult = (string | null)[];
|
|
64
|
+
interface Exodus {
|
|
185
65
|
isConnected: boolean;
|
|
186
66
|
address: string | null;
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
}) => Promise<{
|
|
190
|
-
address: string;
|
|
191
|
-
}>;
|
|
192
|
-
disconnect: () => void;
|
|
193
|
-
signAndSendTransaction(transactions: Bytes[]): Promise<{
|
|
194
|
-
txId: string;
|
|
195
|
-
}>;
|
|
196
|
-
signTransaction(transactions: Bytes[]): Promise<Bytes[]>;
|
|
197
|
-
};
|
|
198
|
-
type ExodusClientConstructor = {
|
|
199
|
-
metadata: Metadata;
|
|
200
|
-
client: Exodus;
|
|
201
|
-
clientOptions: ExodusOptions;
|
|
202
|
-
algosdk: typeof algosdk;
|
|
203
|
-
algodClient: algosdk.Algodv2;
|
|
204
|
-
network: Network;
|
|
205
|
-
};
|
|
206
|
-
|
|
207
|
-
type KmdOptions = {
|
|
208
|
-
wallet: string;
|
|
209
|
-
password: string;
|
|
210
|
-
host: string;
|
|
211
|
-
token: string;
|
|
212
|
-
port: string;
|
|
213
|
-
};
|
|
214
|
-
type KMDWalletClientConstructor = {
|
|
215
|
-
metadata: Metadata;
|
|
216
|
-
client: algosdk.Kmd;
|
|
217
|
-
algosdk: typeof algosdk;
|
|
218
|
-
algodClient: algosdk.Algodv2;
|
|
219
|
-
wallet: string;
|
|
220
|
-
password: string;
|
|
221
|
-
network: Network;
|
|
222
|
-
};
|
|
223
|
-
|
|
224
|
-
type LuteConnectOptions = {
|
|
225
|
-
siteName: string;
|
|
226
|
-
};
|
|
227
|
-
type LuteClientConstructor = {
|
|
228
|
-
metadata: Metadata;
|
|
229
|
-
client: LuteConnect;
|
|
230
|
-
clientOptions?: LuteConnectOptions;
|
|
231
|
-
algosdk: typeof algosdk;
|
|
232
|
-
algodClient: algosdk.Algodv2;
|
|
233
|
-
network: Network;
|
|
234
|
-
};
|
|
235
|
-
|
|
236
|
-
/**
|
|
237
|
-
* Helpful resources:
|
|
238
|
-
* https://github.com/randlabs/myalgo-connect
|
|
239
|
-
*/
|
|
240
|
-
|
|
241
|
-
type MyAlgoConnectOptions = {
|
|
242
|
-
disableLedgerNano: boolean;
|
|
243
|
-
};
|
|
244
|
-
type MyAlgoWalletClientConstructor = {
|
|
245
|
-
metadata: Metadata;
|
|
246
|
-
client: MyAlgoConnect;
|
|
247
|
-
clientOptions?: MyAlgoConnectOptions;
|
|
248
|
-
algosdk: typeof algosdk;
|
|
249
|
-
algodClient: algosdk.Algodv2;
|
|
250
|
-
network: Network;
|
|
251
|
-
};
|
|
252
|
-
|
|
253
|
-
type DaffiWalletConnectOptions = {
|
|
254
|
-
bridge?: string;
|
|
255
|
-
shouldShowSignTxnToast?: boolean;
|
|
256
|
-
chainId?: 416001 | 416002 | 416003 | 4160;
|
|
257
|
-
};
|
|
258
|
-
|
|
259
|
-
type NonEmptyArray<T> = [T, ...T[]];
|
|
260
|
-
|
|
261
|
-
declare abstract class BaseClient {
|
|
262
|
-
algosdk: typeof algosdk;
|
|
263
|
-
algodClient: algosdk.Algodv2;
|
|
264
|
-
clientOptions?: ClientOptions;
|
|
265
|
-
keepWCAlive: HTMLAudioElement;
|
|
266
|
-
metadata: Metadata;
|
|
267
|
-
static metadata: Metadata;
|
|
268
|
-
abstract connect(onDisconnect: () => void, arg?: any): Promise<Wallet>;
|
|
269
|
-
abstract disconnect(): Promise<void>;
|
|
270
|
-
abstract reconnect(onDisconnect: () => void): Promise<Wallet | null>;
|
|
271
|
-
abstract signTransactions(connectedAccounts: string[], txnGroups: Uint8Array[] | Uint8Array[][], indexesToSign?: number[], returnGroup?: boolean): Promise<Uint8Array[]>;
|
|
272
|
-
protected constructor(metadata: Metadata, algosdk: typeof algosdk, algodClient: algosdk.Algodv2, clientOptions?: ClientOptions);
|
|
273
|
-
healthCheck(): Promise<{}>;
|
|
274
|
-
getAccountInfo(address: string): Promise<AccountInfo>;
|
|
275
|
-
getAssets(address: string): Promise<Asset[]>;
|
|
276
|
-
waitForConfirmation(txId: string, timeout?: number): Promise<{
|
|
277
|
-
'confirmed-round': number;
|
|
278
|
-
'global-state-delta': Record<string, unknown>[];
|
|
279
|
-
'pool-error': string;
|
|
280
|
-
txn: {
|
|
281
|
-
sig: Uint8Array;
|
|
282
|
-
txn: Txn;
|
|
283
|
-
};
|
|
284
|
-
txId: string;
|
|
285
|
-
}>;
|
|
286
|
-
decodeTransaction: (txn: string, isSigned: boolean) => algosdk.Transaction;
|
|
287
|
-
logEncodedTransaction(txn: string, isSigned: boolean): void;
|
|
288
|
-
groupTransactionsBySender(transactions: TransactionsArray): Record<string, TxnInfo[]>;
|
|
289
|
-
sendRawTransactions(transactions: Uint8Array[], waitRoundsToConfirm?: number): Promise<{
|
|
290
|
-
'confirmed-round': number;
|
|
291
|
-
'global-state-delta': Record<string, unknown>[];
|
|
292
|
-
'pool-error': string;
|
|
293
|
-
txn: {
|
|
294
|
-
sig: Uint8Array;
|
|
295
|
-
txn: Txn;
|
|
296
|
-
};
|
|
297
|
-
txId: string;
|
|
298
|
-
id: string;
|
|
299
|
-
}>;
|
|
300
|
-
keepWCAliveStart(): Promise<void>;
|
|
301
|
-
keepWCAliveStop(): void;
|
|
67
|
+
enable: (options?: ExodusOptions) => Promise<EnableResult>;
|
|
68
|
+
signTxns: (transactions: WalletTransaction[]) => Promise<SignTxnsResult>;
|
|
302
69
|
}
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
};
|
|
313
|
-
type CustomProvider = {
|
|
314
|
-
connect(metadata: Metadata): Promise<Wallet>;
|
|
315
|
-
disconnect(): Promise<void>;
|
|
316
|
-
reconnect(metadata: Metadata): Promise<Wallet | null>;
|
|
317
|
-
signTransactions(connectedAccounts: string[], txnGroups: Uint8Array[] | Uint8Array[][], indexesToSign?: number[], returnGroup?: boolean): Promise<Uint8Array[]>;
|
|
318
|
-
};
|
|
319
|
-
type CustomWalletClientConstructor = {
|
|
320
|
-
providerProxy: CustomProvider;
|
|
321
|
-
metadata: Metadata;
|
|
322
|
-
algosdk: typeof algosdk;
|
|
323
|
-
algodClient: algosdk.Algodv2;
|
|
324
|
-
network: Network;
|
|
325
|
-
};
|
|
326
|
-
|
|
327
|
-
type ProviderConfigMapping = {
|
|
328
|
-
[PROVIDER_ID.PERA]: {
|
|
329
|
-
clientOptions?: PeraWalletConnectOptions;
|
|
330
|
-
clientStatic?: typeof PeraWalletConnect;
|
|
331
|
-
getDynamicClient?: () => Promise<typeof PeraWalletConnect>;
|
|
332
|
-
};
|
|
333
|
-
[PROVIDER_ID.DAFFI]: {
|
|
334
|
-
clientOptions?: DaffiWalletConnectOptions;
|
|
335
|
-
clientStatic?: typeof DaffiWalletConnect;
|
|
336
|
-
getDynamicClient?: () => Promise<typeof DaffiWalletConnect>;
|
|
337
|
-
};
|
|
338
|
-
[PROVIDER_ID.DEFLY]: {
|
|
339
|
-
clientOptions?: DeflyWalletConnectOptions;
|
|
340
|
-
clientStatic?: typeof DeflyWalletConnect;
|
|
341
|
-
getDynamicClient?: () => Promise<typeof DeflyWalletConnect>;
|
|
342
|
-
};
|
|
343
|
-
[PROVIDER_ID.WALLETCONNECT]: {
|
|
344
|
-
clientOptions?: WalletConnectModalSignOptions;
|
|
345
|
-
clientStatic?: typeof WalletConnectModalSign;
|
|
346
|
-
getDynamicClient?: () => Promise<typeof WalletConnectModalSign>;
|
|
347
|
-
};
|
|
348
|
-
[PROVIDER_ID.LUTE]: {
|
|
349
|
-
clientOptions?: LuteConnectOptions;
|
|
350
|
-
clientStatic?: typeof LuteConnect;
|
|
351
|
-
getDynamicClient?: () => Promise<typeof LuteConnect>;
|
|
352
|
-
};
|
|
353
|
-
[PROVIDER_ID.MYALGO]: {
|
|
354
|
-
clientOptions?: MyAlgoConnectOptions;
|
|
355
|
-
clientStatic?: typeof MyAlgoConnect;
|
|
356
|
-
getDynamicClient?: () => Promise<typeof MyAlgoConnect>;
|
|
357
|
-
};
|
|
358
|
-
[PROVIDER_ID.EXODUS]: {
|
|
359
|
-
clientOptions?: ExodusOptions;
|
|
360
|
-
clientStatic?: undefined;
|
|
361
|
-
getDynamicClient?: undefined;
|
|
362
|
-
};
|
|
363
|
-
[PROVIDER_ID.KMD]: {
|
|
364
|
-
clientOptions?: KmdOptions;
|
|
365
|
-
clientStatic?: undefined;
|
|
366
|
-
getDynamicClient?: undefined;
|
|
367
|
-
};
|
|
368
|
-
[PROVIDER_ID.CUSTOM]: {
|
|
369
|
-
clientOptions?: CustomOptions;
|
|
370
|
-
clientStatic?: undefined;
|
|
371
|
-
getDynamicClient?: undefined;
|
|
372
|
-
};
|
|
373
|
-
[PROVIDER_ID.ALGOSIGNER]: {
|
|
374
|
-
clientOptions?: undefined;
|
|
375
|
-
clientStatic?: undefined;
|
|
376
|
-
getDynamicClient?: undefined;
|
|
377
|
-
};
|
|
378
|
-
[PROVIDER_ID.MNEMONIC]: {
|
|
379
|
-
clientOptions?: undefined;
|
|
380
|
-
clientStatic?: undefined;
|
|
381
|
-
getDynamicClient?: undefined;
|
|
382
|
-
};
|
|
383
|
-
[PROVIDER_ID.KIBISIS]: {
|
|
384
|
-
clientOptions?: undefined;
|
|
385
|
-
clientStatic?: undefined;
|
|
386
|
-
getDynamicClient?: undefined;
|
|
387
|
-
};
|
|
388
|
-
[PROVIDER_ID.MAGIC]: {
|
|
389
|
-
clientOptions?: {
|
|
390
|
-
apiKey: string;
|
|
391
|
-
};
|
|
392
|
-
clientStatic?: undefined;
|
|
393
|
-
getDynamicClient?: () => Promise<typeof Magic>;
|
|
394
|
-
extensionStatic?: typeof AlgorandExtension;
|
|
395
|
-
getDynamicExtension?: () => Promise<typeof AlgorandExtension>;
|
|
396
|
-
};
|
|
397
|
-
};
|
|
398
|
-
/**
|
|
399
|
-
* Enforces correct configuration given for each provider. For example,
|
|
400
|
-
* if `id` is `PROVIDER_ID.PERA`, then `clientOptions` must be of type
|
|
401
|
-
* `PeraWalletConnectOptions`.
|
|
402
|
-
*
|
|
403
|
-
* @todo install `tsd` to test TypeScript type definitions in CI
|
|
404
|
-
*/
|
|
405
|
-
type ProviderConfig<T extends keyof ProviderConfigMapping> = {
|
|
406
|
-
[K in T]: {
|
|
407
|
-
id: K;
|
|
408
|
-
} & ProviderConfigMapping[K];
|
|
409
|
-
}[T];
|
|
410
|
-
type CommonInitParams = {
|
|
411
|
-
network?: Network;
|
|
412
|
-
algodOptions?: AlgodClientOptions;
|
|
413
|
-
algosdkStatic?: typeof algosdk;
|
|
414
|
-
};
|
|
415
|
-
type InitParams<T extends keyof ProviderConfigMapping> = CommonInitParams & ProviderConfigMapping[T];
|
|
416
|
-
type NodeConfig = {
|
|
417
|
-
network: Network;
|
|
418
|
-
nodeServer: string;
|
|
419
|
-
nodeToken?: string | algosdk.AlgodTokenHeader | algosdk.CustomTokenHeader | algosdk.BaseHTTPClient;
|
|
420
|
-
nodePort?: string | number;
|
|
421
|
-
nodeHeaders?: Record<string, string>;
|
|
422
|
-
};
|
|
423
|
-
type StaticClient<T> = {
|
|
424
|
-
clientStatic: T;
|
|
425
|
-
getDynamicClient?: undefined;
|
|
426
|
-
};
|
|
427
|
-
type DynamicClient<T> = {
|
|
428
|
-
clientStatic?: undefined;
|
|
429
|
-
getDynamicClient: () => Promise<T>;
|
|
430
|
-
};
|
|
431
|
-
type OneOfStaticOrDynamicClient<T> = StaticClient<T> | DynamicClient<T>;
|
|
432
|
-
type StaticAlgoExtension<T> = {
|
|
433
|
-
extensionStatic: T;
|
|
434
|
-
getDynamicExtension?: undefined;
|
|
435
|
-
};
|
|
436
|
-
type DynamicAlgoExtension<T> = {
|
|
437
|
-
extensionStatic?: undefined;
|
|
438
|
-
getDynamicExtension: () => Promise<T>;
|
|
439
|
-
};
|
|
440
|
-
type OneOfStaticOrDynamicAlgoExtension<T> = StaticAlgoExtension<T> | DynamicAlgoExtension<T>;
|
|
441
|
-
type ProviderDef = (ProviderConfig<PROVIDER_ID.PERA> & OneOfStaticOrDynamicClient<typeof PeraWalletConnect>) | (ProviderConfig<PROVIDER_ID.MAGIC> & OneOfStaticOrDynamicClient<typeof Magic> & OneOfStaticOrDynamicAlgoExtension<typeof AlgorandExtension> & {
|
|
442
|
-
clientOptions: {
|
|
443
|
-
apiKey: string;
|
|
444
|
-
};
|
|
445
|
-
}) | (ProviderConfig<PROVIDER_ID.DEFLY> & OneOfStaticOrDynamicClient<typeof DeflyWalletConnect>) | (ProviderConfig<PROVIDER_ID.DAFFI> & OneOfStaticOrDynamicClient<typeof DaffiWalletConnect>) | (ProviderConfig<PROVIDER_ID.LUTE> & OneOfStaticOrDynamicClient<typeof LuteConnect> & {
|
|
446
|
-
clientOptions: LuteConnectOptions;
|
|
447
|
-
}) | (ProviderConfig<PROVIDER_ID.WALLETCONNECT> & OneOfStaticOrDynamicClient<typeof WalletConnectModalSign> & {
|
|
448
|
-
clientOptions: WalletConnectModalSignOptions;
|
|
449
|
-
}) | (ProviderConfig<PROVIDER_ID.MYALGO> & OneOfStaticOrDynamicClient<typeof MyAlgoConnect>) | ProviderConfig<PROVIDER_ID.EXODUS> | ProviderConfig<PROVIDER_ID.KMD> | ProviderConfig<PROVIDER_ID.CUSTOM> | ProviderConfig<PROVIDER_ID.KIBISIS> | PROVIDER_ID.EXODUS | PROVIDER_ID.KMD | PROVIDER_ID.ALGOSIGNER | PROVIDER_ID.MNEMONIC | PROVIDER_ID.CUSTOM | PROVIDER_ID.KIBISIS;
|
|
450
|
-
type ProvidersArray = NonEmptyArray<ProviderDef>;
|
|
451
|
-
type WalletClient = BaseClient;
|
|
452
|
-
type SupportedProviders = Partial<Record<PROVIDER_ID, WalletClient | null>>;
|
|
453
|
-
|
|
454
|
-
declare const reconnectProviders: (providers: SupportedProviders) => Promise<void>;
|
|
455
|
-
|
|
456
|
-
type NFDTransactionsArray = ['u' | 's', string][];
|
|
457
|
-
declare function encodeNFDTransactionsArray(transactionsArray: NFDTransactionsArray): Uint8Array[];
|
|
458
|
-
|
|
459
|
-
interface WalletProviderProps {
|
|
460
|
-
children: React.ReactNode;
|
|
461
|
-
value: SupportedProviders | null;
|
|
462
|
-
}
|
|
463
|
-
declare const WalletProvider: ({ children, value }: WalletProviderProps) => React.JSX.Element;
|
|
464
|
-
|
|
465
|
-
declare class PeraWalletClient extends BaseClient {
|
|
466
|
-
#private;
|
|
467
|
-
clientOptions?: PeraWalletConnectOptions;
|
|
468
|
-
network: Network;
|
|
469
|
-
constructor({ metadata, client, clientOptions, algosdk, algodClient, network }: PeraWalletClientConstructor);
|
|
470
|
-
static metadata: {
|
|
471
|
-
id: PROVIDER_ID;
|
|
70
|
+
type WindowExtended = {
|
|
71
|
+
algorand: Exodus;
|
|
72
|
+
} & Window & typeof globalThis;
|
|
73
|
+
declare class ExodusWallet extends BaseWallet {
|
|
74
|
+
private client;
|
|
75
|
+
private options;
|
|
76
|
+
protected store: Store<State>;
|
|
77
|
+
constructor({ id, store, subscribe, getAlgodClient, options, metadata }: WalletConstructor<WalletId.EXODUS>);
|
|
78
|
+
static defaultMetadata: {
|
|
472
79
|
name: string;
|
|
473
80
|
icon: string;
|
|
474
|
-
isWalletConnect: boolean;
|
|
475
81
|
};
|
|
476
|
-
|
|
477
|
-
connect
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
providerId: PROVIDER_ID;
|
|
483
|
-
}[];
|
|
484
|
-
id: PROVIDER_ID;
|
|
485
|
-
name: string;
|
|
486
|
-
icon: string;
|
|
487
|
-
isWalletConnect: boolean;
|
|
488
|
-
} | null>;
|
|
489
|
-
disconnect(): Promise<void>;
|
|
490
|
-
signTransactions(connectedAccounts: string[], txnGroups: Uint8Array[] | Uint8Array[][], indexesToSign?: number[], returnGroup?: boolean): Promise<Uint8Array[]>;
|
|
82
|
+
private initializeClient;
|
|
83
|
+
connect: () => Promise<WalletAccount[]>;
|
|
84
|
+
disconnect: () => Promise<void>;
|
|
85
|
+
resumeSession: () => Promise<void>;
|
|
86
|
+
signTransactions: (txnGroup: algosdk.Transaction[] | algosdk.Transaction[][] | Uint8Array[] | Uint8Array[][], indexesToSign?: number[], returnGroup?: boolean) => Promise<Uint8Array[]>;
|
|
87
|
+
transactionSigner: (txnGroup: algosdk.Transaction[], indexesToSign: number[]) => Promise<Uint8Array[]>;
|
|
491
88
|
}
|
|
492
89
|
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
id: PROVIDER_ID;
|
|
500
|
-
name: string;
|
|
501
|
-
icon: string;
|
|
502
|
-
isWalletConnect: boolean;
|
|
503
|
-
};
|
|
504
|
-
static init({ clientOptions, algodOptions, clientStatic, getDynamicClient, algosdkStatic, network }: InitParams<PROVIDER_ID.MYALGO>): Promise<BaseClient | null>;
|
|
505
|
-
connect(): Promise<{
|
|
506
|
-
accounts: {
|
|
507
|
-
providerId: PROVIDER_ID;
|
|
508
|
-
address: string;
|
|
509
|
-
name: string;
|
|
510
|
-
}[];
|
|
511
|
-
id: PROVIDER_ID;
|
|
512
|
-
name: string;
|
|
513
|
-
icon: string;
|
|
514
|
-
isWalletConnect: boolean;
|
|
515
|
-
}>;
|
|
516
|
-
reconnect(): Promise<null>;
|
|
517
|
-
disconnect(): Promise<void>;
|
|
518
|
-
signTransactions(connectedAccounts: string[], transactions: Uint8Array[], indexesToSign?: number[], returnGroup?: boolean): Promise<Uint8Array[]>;
|
|
90
|
+
type ProviderMethod = 'enable' | 'getProviders' | 'postTxns' | 'signAndPostTxns' | 'signBytes' | 'signTxns';
|
|
91
|
+
interface SendRequestWithTimeoutOptions<Params> {
|
|
92
|
+
method: ProviderMethod;
|
|
93
|
+
params: Params;
|
|
94
|
+
reference: string;
|
|
95
|
+
timeout?: number;
|
|
519
96
|
}
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
constructor({ metadata, client, clientOptions, algosdk, algodClient, network }: DeflyWalletClientConstructor);
|
|
526
|
-
static metadata: {
|
|
527
|
-
id: PROVIDER_ID;
|
|
97
|
+
declare class KibisisWallet extends BaseWallet {
|
|
98
|
+
methods: ProviderMethod[];
|
|
99
|
+
protected store: Store<State>;
|
|
100
|
+
constructor({ id, store, subscribe, getAlgodClient, metadata }: WalletConstructor<WalletId.KIBISIS>);
|
|
101
|
+
static defaultMetadata: {
|
|
528
102
|
name: string;
|
|
529
103
|
icon: string;
|
|
530
|
-
isWalletConnect: boolean;
|
|
531
104
|
};
|
|
532
|
-
static
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
105
|
+
static sendRequestWithTimeout<Params, Result>({ method, params, timeout, reference }: SendRequestWithTimeoutOptions<Params>): Promise<Result | undefined>;
|
|
106
|
+
/**
|
|
107
|
+
* Calls the enable method on the provider that returns the authorized accounts.
|
|
108
|
+
* @returns {Arc0027Account[]} the authorized accounts.
|
|
109
|
+
* @throws {METHOD_CANCELED_ERROR} if the method was cancelled by the user.
|
|
110
|
+
* @throws {METHOD_NOT_SUPPORTED_ERROR} if the method is not supported for the configured network.
|
|
111
|
+
* @throws {METHOD_TIMED_OUT_ERROR} if the method timed out by lack of response.
|
|
112
|
+
* @throws {NETWORK_NOT_SUPPORTED_ERROR} if the network is not supported for the configured network.
|
|
113
|
+
* @throws {UNKNOWN_ERROR} if the response result was empty.
|
|
114
|
+
*/
|
|
115
|
+
private enable;
|
|
116
|
+
/**
|
|
117
|
+
* Gets the genesis hash of the algod client's configured network.
|
|
118
|
+
* @returns {string} the genesis hash
|
|
119
|
+
*/
|
|
120
|
+
private getGenesisHash;
|
|
121
|
+
/**
|
|
122
|
+
* Gets the provider information and updates the supported methods. This should be called
|
|
123
|
+
* before interacting with the provider to ensure methods are supported.
|
|
124
|
+
* @throws {METHOD_TIMED_OUT_ERROR} if the method timed out by lack of response.
|
|
125
|
+
* @throws {NETWORK_NOT_SUPPORTED_ERROR} if the network is not supported for the configured network.
|
|
126
|
+
* @throws {UNKNOWN_ERROR} if the response result was empty.
|
|
127
|
+
*/
|
|
128
|
+
private getSupportedMethods;
|
|
129
|
+
/**
|
|
130
|
+
* Calls the signTxns methods to sign the supplied transactions.
|
|
131
|
+
* @param {Arc0001SignTxns[]} txns - the unsigned or signed transactions as defined in ARC-0001.
|
|
132
|
+
* @returns {(string | null)[]} the authorized accounts.
|
|
133
|
+
* @throws {INVALID_INPUT_ERROR} if computed group ID for the txns does not match the assigned group ID.
|
|
134
|
+
* @throws {INVALID_GROUP_ID_ERROR} if the unsigned txns is malformed or not conforming to ARC-0001.
|
|
135
|
+
* @throws {METHOD_CANCELED_ERROR} if the method was cancelled by the user.
|
|
136
|
+
* @throws {METHOD_NOT_SUPPORTED_ERROR} if the method is not supported for the configured network.
|
|
137
|
+
* @throws {METHOD_TIMED_OUT_ERROR} if the method timed out by lack of response.
|
|
138
|
+
* @throws {NETWORK_NOT_SUPPORTED_ERROR} if the network is not supported for the configured network.
|
|
139
|
+
* @throws {UNAUTHORIZED_SIGNER_ERROR} if a signer in the request is not authorized by the provider.
|
|
140
|
+
* @throws {UNKNOWN_ERROR} if the response result was empty.
|
|
141
|
+
*/
|
|
142
|
+
private signTxns;
|
|
143
|
+
/**
|
|
144
|
+
* Validates whether a method is supported with the provider.
|
|
145
|
+
* @param {ProviderMethod} method - the method to validate.
|
|
146
|
+
* @throws {METHOD_NOT_SUPPORTED_ERROR} if the method is not supported for the configured network.
|
|
147
|
+
*/
|
|
148
|
+
private validateMethod;
|
|
149
|
+
connect: () => Promise<WalletAccount[]>;
|
|
150
|
+
disconnect: () => Promise<void>;
|
|
151
|
+
resumeSession: () => Promise<void>;
|
|
152
|
+
signTransactions: (txnGroup: algosdk.Transaction[] | algosdk.Transaction[][] | Uint8Array[] | Uint8Array[][], indexesToSign?: number[], returnGroup?: boolean) => Promise<Uint8Array[]>;
|
|
153
|
+
transactionSigner: (txnGroup: algosdk.Transaction[], indexesToSign: number[]) => Promise<Uint8Array[]>;
|
|
547
154
|
}
|
|
548
155
|
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
static metadata: {
|
|
555
|
-
id: PROVIDER_ID;
|
|
556
|
-
name: string;
|
|
557
|
-
icon: string;
|
|
558
|
-
isWalletConnect: boolean;
|
|
559
|
-
};
|
|
560
|
-
static init({ clientOptions, algodOptions, algosdkStatic, network }: InitParams<PROVIDER_ID.EXODUS>): Promise<BaseClient | null>;
|
|
561
|
-
connect(): Promise<{
|
|
562
|
-
accounts: {
|
|
563
|
-
name: string;
|
|
564
|
-
address: string;
|
|
565
|
-
providerId: PROVIDER_ID;
|
|
566
|
-
}[];
|
|
567
|
-
id: PROVIDER_ID;
|
|
568
|
-
name: string;
|
|
569
|
-
icon: string;
|
|
570
|
-
isWalletConnect: boolean;
|
|
571
|
-
}>;
|
|
572
|
-
reconnect(onDisconnect: () => void): Promise<null>;
|
|
573
|
-
disconnect(): Promise<void>;
|
|
574
|
-
signTransactions(connectedAccounts: string[], txnGroups: Uint8Array[] | Uint8Array[][], indexesToSign?: number[], returnGroup?: boolean): Promise<Uint8Array[]>;
|
|
156
|
+
interface KmdConstructor {
|
|
157
|
+
token: string | algosdk.KMDTokenHeader | algosdk.CustomTokenHeader;
|
|
158
|
+
baseServer?: string;
|
|
159
|
+
port?: string | number;
|
|
160
|
+
headers?: Record<string, string>;
|
|
575
161
|
}
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
persist: {
|
|
589
|
-
setOptions: (options: Partial<zustand_middleware.PersistOptions<WalletStore, WalletStore>>) => void;
|
|
590
|
-
clearStorage: () => void;
|
|
591
|
-
rehydrate: () => void | Promise<void>;
|
|
592
|
-
hasHydrated: () => boolean;
|
|
593
|
-
onHydrate: (fn: (state: WalletStore) => void) => () => void;
|
|
594
|
-
onFinishHydration: (fn: (state: WalletStore) => void) => () => void;
|
|
595
|
-
getOptions: () => Partial<zustand_middleware.PersistOptions<WalletStore, WalletStore>>;
|
|
596
|
-
};
|
|
597
|
-
}, "setState"> & {
|
|
598
|
-
setState<A extends string | {
|
|
599
|
-
type: string;
|
|
600
|
-
}>(nextStateOrUpdater: WalletStore | Partial<WalletStore> | ((state: immer_dist_internal.WritableDraft<WalletStore>) => void), shouldReplace?: boolean | undefined, action?: A | undefined): void;
|
|
601
|
-
}>;
|
|
602
|
-
|
|
603
|
-
type GenesisId = 'betanet-v1.0' | 'testnet-v1.0' | 'mainnet-v1.0' | string;
|
|
604
|
-
type EnableParams = {
|
|
605
|
-
genesisID?: GenesisId;
|
|
606
|
-
genesisHash?: string;
|
|
607
|
-
accounts?: string[];
|
|
608
|
-
};
|
|
609
|
-
type EnableResponse = {
|
|
610
|
-
genesisID: GenesisId;
|
|
611
|
-
genesisHash: string;
|
|
612
|
-
accounts: string[];
|
|
613
|
-
};
|
|
614
|
-
type AlgoSignerTransaction = {
|
|
615
|
-
txn: string;
|
|
616
|
-
signers?: string[];
|
|
617
|
-
stxn?: string;
|
|
618
|
-
multisig?: string;
|
|
619
|
-
authAddr?: string;
|
|
620
|
-
};
|
|
621
|
-
type AlgoSigner = {
|
|
622
|
-
enable: (params?: EnableParams) => Promise<EnableResponse>;
|
|
623
|
-
signTxns: (transactions: AlgoSignerTransaction[]) => Promise<string[]>;
|
|
624
|
-
encoding: {
|
|
625
|
-
msgpackToBase64(transaction: Uint8Array): string;
|
|
626
|
-
byteArrayToString(transaction: Uint8Array): string;
|
|
627
|
-
};
|
|
628
|
-
};
|
|
629
|
-
type AlgoSignerClientConstructor = {
|
|
630
|
-
metadata: Metadata;
|
|
631
|
-
client: AlgoSigner;
|
|
632
|
-
algosdk: typeof algosdk;
|
|
633
|
-
algodClient: algosdk.Algodv2;
|
|
634
|
-
network: Network;
|
|
635
|
-
};
|
|
636
|
-
|
|
637
|
-
declare class AlgoSignerClient extends BaseClient {
|
|
638
|
-
#private;
|
|
639
|
-
network: Network;
|
|
640
|
-
walletStore: typeof useWalletStore;
|
|
641
|
-
constructor({ metadata, client, algosdk, algodClient, network }: AlgoSignerClientConstructor);
|
|
642
|
-
static metadata: {
|
|
643
|
-
id: PROVIDER_ID;
|
|
162
|
+
type KmdOptions = Partial<Pick<KmdConstructor, 'token'>> & Omit<KmdConstructor, 'token'> & {
|
|
163
|
+
wallet?: string;
|
|
164
|
+
};
|
|
165
|
+
declare class KmdWallet extends BaseWallet {
|
|
166
|
+
private client;
|
|
167
|
+
private options;
|
|
168
|
+
private walletName;
|
|
169
|
+
private walletId;
|
|
170
|
+
private password;
|
|
171
|
+
protected store: Store<State>;
|
|
172
|
+
constructor({ id, store, subscribe, getAlgodClient, options, metadata }: WalletConstructor<WalletId.KMD>);
|
|
173
|
+
static defaultMetadata: {
|
|
644
174
|
name: string;
|
|
645
175
|
icon: string;
|
|
646
|
-
isWalletConnect: boolean;
|
|
647
176
|
};
|
|
648
|
-
|
|
649
|
-
connect()
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
isWalletConnect: boolean;
|
|
660
|
-
}>;
|
|
661
|
-
reconnect(onDisconnect: () => void): Promise<null>;
|
|
662
|
-
disconnect(): Promise<void>;
|
|
663
|
-
signTransactions(connectedAccounts: string[], transactions: Uint8Array[], indexesToSign?: number[], returnGroup?: boolean): Promise<Uint8Array[]>;
|
|
664
|
-
getGenesisID(): string;
|
|
665
|
-
getAuthAddress(address: string): string | undefined;
|
|
177
|
+
private initializeClient;
|
|
178
|
+
connect: () => Promise<WalletAccount[]>;
|
|
179
|
+
disconnect: () => Promise<void>;
|
|
180
|
+
resumeSession: () => Promise<void>;
|
|
181
|
+
signTransactions: (txnGroup: algosdk.Transaction[] | algosdk.Transaction[][] | Uint8Array[] | Uint8Array[][], indexesToSign?: number[], returnGroup?: boolean) => Promise<Uint8Array[]>;
|
|
182
|
+
transactionSigner: (txnGroup: algosdk.Transaction[], indexesToSign: number[]) => Promise<Uint8Array[]>;
|
|
183
|
+
private fetchWalletId;
|
|
184
|
+
private fetchToken;
|
|
185
|
+
private fetchAccounts;
|
|
186
|
+
private releaseToken;
|
|
187
|
+
private getPassword;
|
|
666
188
|
}
|
|
667
189
|
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
190
|
+
interface LuteConnectOptions {
|
|
191
|
+
siteName?: string;
|
|
192
|
+
}
|
|
193
|
+
declare class LuteWallet extends BaseWallet {
|
|
194
|
+
private client;
|
|
195
|
+
private options;
|
|
196
|
+
protected store: Store<State>;
|
|
197
|
+
constructor({ id, store, subscribe, getAlgodClient, options, metadata }: WalletConstructor<WalletId.LUTE>);
|
|
198
|
+
static defaultMetadata: {
|
|
675
199
|
name: string;
|
|
676
200
|
icon: string;
|
|
677
|
-
isWalletConnect: boolean;
|
|
678
201
|
};
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
id: PROVIDER_ID;
|
|
687
|
-
name: string;
|
|
688
|
-
icon: string;
|
|
689
|
-
isWalletConnect: boolean;
|
|
690
|
-
}>;
|
|
691
|
-
reconnect(): Promise<null>;
|
|
692
|
-
disconnect(): Promise<void>;
|
|
693
|
-
shouldSignTxnObject(txn: DecodedTransaction | DecodedSignedTransaction, addresses: string[], indexesToSign: number[] | undefined, idx: number): boolean;
|
|
694
|
-
signTransactions(connectedAccounts: string[], transactions: Uint8Array[], indexesToSign?: number[], returnGroup?: boolean): Promise<Uint8Array[]>;
|
|
202
|
+
private initializeClient;
|
|
203
|
+
private getGenesisId;
|
|
204
|
+
connect: () => Promise<WalletAccount[]>;
|
|
205
|
+
disconnect: () => Promise<void>;
|
|
206
|
+
resumeSession: () => Promise<void>;
|
|
207
|
+
signTransactions: (txnGroup: algosdk.Transaction[] | algosdk.Transaction[][] | Uint8Array[] | Uint8Array[][], indexesToSign?: number[], returnGroup?: boolean) => Promise<Uint8Array[]>;
|
|
208
|
+
transactionSigner: (txnGroup: algosdk.Transaction[], indexesToSign: number[]) => Promise<Uint8Array[]>;
|
|
695
209
|
}
|
|
696
210
|
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
chain: string;
|
|
712
|
-
constructor({ metadata, client, clientOptions, algosdk, algodClient, network, chain }: WalletConnectClientConstructor);
|
|
713
|
-
static metadata: {
|
|
714
|
-
id: PROVIDER_ID;
|
|
211
|
+
/** @see https://magic.link/docs/blockchains/other-chains/other/algorand */
|
|
212
|
+
interface MagicAuthOptions {
|
|
213
|
+
apiKey?: string;
|
|
214
|
+
}
|
|
215
|
+
type MagicAuthClient = InstanceWithExtensions<SDKBase, {
|
|
216
|
+
algorand: AlgorandExtension;
|
|
217
|
+
}>;
|
|
218
|
+
declare class MagicAuth extends BaseWallet {
|
|
219
|
+
private client;
|
|
220
|
+
private options;
|
|
221
|
+
protected store: Store<State>;
|
|
222
|
+
userInfo: MagicUserMetadata | null;
|
|
223
|
+
constructor({ id, store, subscribe, getAlgodClient, options, metadata }: WalletConstructor<WalletId.MAGIC>);
|
|
224
|
+
static defaultMetadata: {
|
|
715
225
|
name: string;
|
|
716
226
|
icon: string;
|
|
717
|
-
isWalletConnect: boolean;
|
|
718
227
|
};
|
|
719
|
-
|
|
720
|
-
connect()
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
providerId: PROVIDER_ID;
|
|
726
|
-
}[];
|
|
727
|
-
id: PROVIDER_ID;
|
|
728
|
-
name: string;
|
|
729
|
-
icon: string;
|
|
730
|
-
isWalletConnect: boolean;
|
|
731
|
-
} | null>;
|
|
732
|
-
disconnect(): Promise<void>;
|
|
733
|
-
signTransactions(connectedAccounts: string[], txnGroups: Uint8Array[] | Uint8Array[][], indexesToSign?: number[], returnGroup?: boolean): Promise<Uint8Array[]>;
|
|
228
|
+
private initializeClient;
|
|
229
|
+
connect: (args?: Record<string, any>) => Promise<WalletAccount[]>;
|
|
230
|
+
disconnect: () => Promise<void>;
|
|
231
|
+
resumeSession: () => Promise<void>;
|
|
232
|
+
signTransactions: (txnGroup: algosdk.Transaction[] | algosdk.Transaction[][] | Uint8Array[] | Uint8Array[][], indexesToSign?: number[], returnGroup?: boolean) => Promise<Uint8Array[]>;
|
|
233
|
+
transactionSigner: (txnGroup: algosdk.Transaction[], indexesToSign: number[]) => Promise<Uint8Array[]>;
|
|
734
234
|
}
|
|
735
235
|
|
|
736
|
-
type
|
|
737
|
-
|
|
738
|
-
};
|
|
739
|
-
type MagicAuthConstructor = {
|
|
740
|
-
metadata: Metadata;
|
|
741
|
-
client: InstanceWithExtensions<SDKBase, {
|
|
742
|
-
algorand: AlgorandExtension;
|
|
743
|
-
}>;
|
|
744
|
-
clientOptions: MagicAuthConnectOptions;
|
|
745
|
-
algosdk: typeof algosdk;
|
|
746
|
-
algodClient: algosdk.Algodv2;
|
|
747
|
-
network: Network;
|
|
236
|
+
type MnemonicOptions = {
|
|
237
|
+
persistToStorage?: boolean;
|
|
748
238
|
};
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
static metadata: {
|
|
756
|
-
id: PROVIDER_ID;
|
|
239
|
+
declare class MnemonicWallet extends BaseWallet {
|
|
240
|
+
private account;
|
|
241
|
+
private options;
|
|
242
|
+
protected store: Store<State>;
|
|
243
|
+
constructor({ id, store, subscribe, getAlgodClient, options, metadata }: WalletConstructor<WalletId.MNEMONIC>);
|
|
244
|
+
static defaultMetadata: {
|
|
757
245
|
name: string;
|
|
758
246
|
icon: string;
|
|
759
|
-
isWalletConnect: boolean;
|
|
760
247
|
};
|
|
761
|
-
|
|
762
|
-
connect
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
providerId: PROVIDER_ID;
|
|
768
|
-
email: string;
|
|
769
|
-
}[];
|
|
770
|
-
id: PROVIDER_ID;
|
|
771
|
-
name: string;
|
|
772
|
-
icon: string;
|
|
773
|
-
isWalletConnect: boolean;
|
|
774
|
-
} | null>;
|
|
775
|
-
disconnect(): Promise<void>;
|
|
776
|
-
signTransactions(connectedAccounts: string[], txnGroups: Uint8Array[] | Uint8Array[][], indexesToSign?: number[], returnGroup?: boolean): Promise<Uint8Array[]>;
|
|
248
|
+
private initializeAccount;
|
|
249
|
+
connect: () => Promise<WalletAccount[]>;
|
|
250
|
+
disconnect: () => Promise<void>;
|
|
251
|
+
resumeSession: () => Promise<void>;
|
|
252
|
+
signTransactions: (txnGroup: algosdk.Transaction[] | algosdk.Transaction[][] | Uint8Array[] | Uint8Array[][], indexesToSign?: number[], returnGroup?: boolean) => Promise<Uint8Array[]>;
|
|
253
|
+
transactionSigner: (txnGroup: algosdk.Transaction[], indexesToSign: number[]) => Promise<Uint8Array[]>;
|
|
777
254
|
}
|
|
778
255
|
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
256
|
+
interface PeraWalletConnectOptions {
|
|
257
|
+
projectId: string;
|
|
258
|
+
bridge?: string;
|
|
259
|
+
shouldShowSignTxnToast?: boolean;
|
|
260
|
+
chainId?: 416001 | 416002 | 416003 | 4160;
|
|
261
|
+
compactMode?: boolean;
|
|
262
|
+
}
|
|
263
|
+
declare class PeraWallet extends BaseWallet {
|
|
264
|
+
private client;
|
|
265
|
+
private options;
|
|
266
|
+
protected store: Store<State>;
|
|
267
|
+
constructor({ id, store, subscribe, getAlgodClient, options, metadata }: WalletConstructor<WalletId.PERA>);
|
|
268
|
+
static defaultMetadata: {
|
|
786
269
|
name: string;
|
|
787
270
|
icon: string;
|
|
788
|
-
isWalletConnect: boolean;
|
|
789
271
|
};
|
|
790
|
-
|
|
791
|
-
connect()
|
|
792
|
-
disconnect()
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
releaseToken(token: string): Promise<void>;
|
|
797
|
-
listWallets(): Promise<Record<string, string>>;
|
|
798
|
-
listAccounts(wallet: string, password: string): Promise<Array<Account>>;
|
|
799
|
-
getWalletId(): Promise<string>;
|
|
800
|
-
signTransactions(connectedAccounts: string[], txnGroups: Uint8Array[] | Uint8Array[][], indexesToSign?: number[], returnGroup?: boolean): Promise<Uint8Array[]>;
|
|
272
|
+
private initializeClient;
|
|
273
|
+
connect: () => Promise<WalletAccount[]>;
|
|
274
|
+
disconnect: () => Promise<void>;
|
|
275
|
+
resumeSession: () => Promise<void>;
|
|
276
|
+
signTransactions: (txnGroup: algosdk.Transaction[] | algosdk.Transaction[][] | Uint8Array[] | Uint8Array[][], indexesToSign?: number[], returnGroup?: boolean) => Promise<Uint8Array[]>;
|
|
277
|
+
transactionSigner: (txnGroup: algosdk.Transaction[], indexesToSign: number[]) => Promise<Uint8Array[]>;
|
|
801
278
|
}
|
|
802
279
|
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
declare class
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
280
|
+
interface SignClientOptions {
|
|
281
|
+
projectId: string;
|
|
282
|
+
relayUrl?: string;
|
|
283
|
+
metadata?: SignClientTypes.Metadata;
|
|
284
|
+
}
|
|
285
|
+
type WalletConnectModalOptions = Pick<WalletConnectModalConfig, 'enableExplorer' | 'explorerRecommendedWalletIds' | 'privacyPolicyUrl' | 'termsOfServiceUrl' | 'themeMode' | 'themeVariables'>;
|
|
286
|
+
type WalletConnectOptions = SignClientOptions & WalletConnectModalOptions;
|
|
287
|
+
declare class WalletConnect extends BaseWallet {
|
|
288
|
+
private client;
|
|
289
|
+
private options;
|
|
290
|
+
private modal;
|
|
291
|
+
private modalOptions;
|
|
292
|
+
private session;
|
|
293
|
+
private chains;
|
|
294
|
+
protected store: Store<State>;
|
|
295
|
+
constructor({ id, store, subscribe, getAlgodClient, options, metadata }: WalletConstructor<WalletId.WALLETCONNECT>);
|
|
296
|
+
static defaultMetadata: {
|
|
816
297
|
name: string;
|
|
817
298
|
icon: string;
|
|
818
|
-
isWalletConnect: boolean;
|
|
819
299
|
};
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
name: string;
|
|
829
|
-
icon: string;
|
|
830
|
-
isWalletConnect: boolean;
|
|
831
|
-
}>;
|
|
832
|
-
disconnect(): Promise<void>;
|
|
833
|
-
reconnect(): Promise<null>;
|
|
834
|
-
requestPassword(): string;
|
|
835
|
-
signTransactions(connectedAccounts: string[], txnGroups: Uint8Array[] | Uint8Array[][], indexesToSign?: number[], returnGroup?: boolean): Promise<Uint8Array[]>;
|
|
836
|
-
signEncodedTransactions(_transactions: TransactionsArray): Promise<Uint8Array[]>;
|
|
837
|
-
}
|
|
838
|
-
|
|
839
|
-
declare class CustomWalletClient extends BaseClient {
|
|
840
|
-
network: Network;
|
|
841
|
-
providerProxy: CustomProvider;
|
|
842
|
-
static metadata: Metadata;
|
|
843
|
-
constructor({ providerProxy, metadata, algosdk, algodClient, network }: CustomWalletClientConstructor);
|
|
844
|
-
static init({ clientOptions, algodOptions, algosdkStatic, network }: InitParams<PROVIDER_ID.CUSTOM>): Promise<BaseClient | null>;
|
|
845
|
-
connect(): Promise<Wallet>;
|
|
846
|
-
disconnect(): Promise<void>;
|
|
847
|
-
reconnect(): Promise<Wallet | null>;
|
|
848
|
-
signTransactions(connectedAccounts: string[], txnGroups: Uint8Array[] | Uint8Array[][], indexesToSign?: number[], returnGroup?: boolean): Promise<Uint8Array[]>;
|
|
300
|
+
private initializeClient;
|
|
301
|
+
private initializeModal;
|
|
302
|
+
private onSessionConnected;
|
|
303
|
+
connect: () => Promise<WalletAccount[]>;
|
|
304
|
+
disconnect: () => Promise<void>;
|
|
305
|
+
resumeSession: () => Promise<void>;
|
|
306
|
+
signTransactions: (txnGroup: algosdk.Transaction[] | algosdk.Transaction[][] | Uint8Array[] | Uint8Array[][], indexesToSign?: number[], returnGroup?: boolean) => Promise<Uint8Array[]>;
|
|
307
|
+
transactionSigner: (txnGroup: algosdk.Transaction[], indexesToSign: number[]) => Promise<Uint8Array[]>;
|
|
849
308
|
}
|
|
850
309
|
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
310
|
+
declare enum WalletId {
|
|
311
|
+
DEFLY = "defly",
|
|
312
|
+
EXODUS = "exodus",
|
|
313
|
+
KIBISIS = "kibisis",
|
|
314
|
+
KMD = "kmd",
|
|
315
|
+
LUTE = "lute",
|
|
316
|
+
MAGIC = "magic",
|
|
317
|
+
MNEMONIC = "mnemonic",
|
|
318
|
+
PERA = "pera",
|
|
319
|
+
WALLETCONNECT = "walletconnect"
|
|
854
320
|
}
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
321
|
+
type WalletMap = {
|
|
322
|
+
[WalletId.DEFLY]: typeof DeflyWallet;
|
|
323
|
+
[WalletId.EXODUS]: typeof ExodusWallet;
|
|
324
|
+
[WalletId.KIBISIS]: typeof KibisisWallet;
|
|
325
|
+
[WalletId.KMD]: typeof KmdWallet;
|
|
326
|
+
[WalletId.LUTE]: typeof LuteWallet;
|
|
327
|
+
[WalletId.MAGIC]: typeof MagicAuth;
|
|
328
|
+
[WalletId.MNEMONIC]: typeof MnemonicWallet;
|
|
329
|
+
[WalletId.PERA]: typeof PeraWallet;
|
|
330
|
+
[WalletId.WALLETCONNECT]: typeof WalletConnect;
|
|
331
|
+
};
|
|
332
|
+
type WalletOptionsMap = {
|
|
333
|
+
[WalletId.DEFLY]: DeflyWalletConnectOptions;
|
|
334
|
+
[WalletId.EXODUS]: ExodusOptions;
|
|
335
|
+
[WalletId.KIBISIS]: Record<string, never>;
|
|
336
|
+
[WalletId.KMD]: KmdOptions;
|
|
337
|
+
[WalletId.LUTE]: LuteConnectOptions;
|
|
338
|
+
[WalletId.MAGIC]: MagicAuthOptions;
|
|
339
|
+
[WalletId.MNEMONIC]: MnemonicOptions;
|
|
340
|
+
[WalletId.PERA]: PeraWalletConnectOptions;
|
|
341
|
+
[WalletId.WALLETCONNECT]: WalletConnectOptions;
|
|
342
|
+
};
|
|
343
|
+
type SupportedWallet = WalletIdConfig<WalletId> | WalletId;
|
|
344
|
+
type WalletConfigMap = {
|
|
345
|
+
[K in keyof WalletOptionsMap]: {
|
|
346
|
+
options?: WalletOptionsMap[K];
|
|
347
|
+
metadata?: Partial<WalletMetadata>;
|
|
348
|
+
};
|
|
349
|
+
};
|
|
350
|
+
type WalletOptions<T extends keyof WalletOptionsMap> = WalletOptionsMap[T];
|
|
351
|
+
type WalletConfig<T extends keyof WalletConfigMap> = WalletConfigMap[T];
|
|
352
|
+
type WalletIdConfig<T extends keyof WalletConfigMap> = {
|
|
353
|
+
[K in T]: {
|
|
354
|
+
id: K;
|
|
355
|
+
} & WalletConfigMap[K];
|
|
356
|
+
}[T];
|
|
357
|
+
type NonEmptyArray<T> = [T, ...T[]];
|
|
358
|
+
type SupportedWallets = NonEmptyArray<SupportedWallet>;
|
|
359
|
+
type WalletMetadata = {
|
|
360
|
+
name: string;
|
|
361
|
+
icon: string;
|
|
362
|
+
};
|
|
363
|
+
interface BaseWalletConstructor {
|
|
364
|
+
id: WalletId;
|
|
365
|
+
metadata: Partial<WalletMetadata> | undefined;
|
|
366
|
+
getAlgodClient: () => algosdk.Algodv2;
|
|
367
|
+
store: Store<State>;
|
|
368
|
+
subscribe: (callback: (state: State) => void) => () => void;
|
|
862
369
|
}
|
|
863
|
-
type
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
370
|
+
type WalletConstructor<T extends keyof WalletOptionsMap> = BaseWalletConstructor & {
|
|
371
|
+
options?: WalletOptions<T>;
|
|
372
|
+
defaultMetadata?: WalletMetadata;
|
|
373
|
+
};
|
|
374
|
+
type WalletAccount = {
|
|
375
|
+
name: string;
|
|
376
|
+
address: string;
|
|
377
|
+
};
|
|
378
|
+
/** @see https://github.com/algorandfoundation/ARCs/blob/main/ARCs/arc-0001.md#interface-multisigmetadata */
|
|
379
|
+
interface MultisigMetadata {
|
|
380
|
+
/**
|
|
381
|
+
* Multisig version.
|
|
382
|
+
*/
|
|
383
|
+
version: number;
|
|
384
|
+
/**
|
|
385
|
+
* Multisig threshold value. Authorization requires a subset of signatures,
|
|
386
|
+
* equal to or greater than the threshold value.
|
|
387
|
+
*/
|
|
388
|
+
threshold: number;
|
|
389
|
+
/**
|
|
390
|
+
* List of Algorand addresses of possible signers for this
|
|
391
|
+
* multisig. Order is important.
|
|
392
|
+
*/
|
|
393
|
+
addrs: string[];
|
|
869
394
|
}
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
genesisHash: string;
|
|
873
|
-
methods: ProviderMethods[];
|
|
874
|
-
network: Network;
|
|
875
|
-
constructor({ metadata, algosdk, algodClient, genesisHash, methods, network }: KibisisClientConstructor);
|
|
876
|
-
static metadata: {
|
|
877
|
-
id: PROVIDER_ID;
|
|
878
|
-
icon: string;
|
|
879
|
-
isWalletConnect: boolean;
|
|
880
|
-
name: string;
|
|
881
|
-
};
|
|
395
|
+
/** @see https://github.com/algorandfoundation/ARCs/blob/main/ARCs/arc-0001.md#interface-wallettransaction */
|
|
396
|
+
interface WalletTransaction {
|
|
882
397
|
/**
|
|
883
|
-
*
|
|
398
|
+
* Base64 encoding of the canonical msgpack encoding of a Transaction.
|
|
884
399
|
*/
|
|
885
|
-
|
|
886
|
-
static mapAccountsToWallet(accounts: Arc0027Account[]): Wallet;
|
|
887
|
-
static sendRequestWithTimeout<Params, Result>({ method, params, timeout, reference }: SendRequestWithTimeoutOptions<Params>): Promise<Result | undefined>;
|
|
400
|
+
txn: string;
|
|
888
401
|
/**
|
|
889
|
-
*
|
|
402
|
+
* Optional authorized address used to sign the transaction when the account
|
|
403
|
+
* is rekeyed. Also called the signor/sgnr.
|
|
890
404
|
*/
|
|
891
|
-
|
|
892
|
-
private convertBase64ToBytes;
|
|
405
|
+
authAddr?: string;
|
|
893
406
|
/**
|
|
894
|
-
*
|
|
895
|
-
* @returns {Arc0027Account[]} the authorized accounts.
|
|
896
|
-
* @throws {METHOD_CANCELED_ERROR} if the method was cancelled by the user.
|
|
897
|
-
* @throws {METHOD_NOT_SUPPORTED_ERROR} if the method is not supported for the configured network.
|
|
898
|
-
* @throws {METHOD_TIMED_OUT_ERROR} if the method timed out by lack of response.
|
|
899
|
-
* @throws {NETWORK_NOT_SUPPORTED_ERROR} if the network is not supported for the configured network.
|
|
900
|
-
* @throws {UNKNOWN_ERROR} if the response result was empty.
|
|
407
|
+
* Multisig metadata used to sign the transaction
|
|
901
408
|
*/
|
|
902
|
-
|
|
409
|
+
msig?: MultisigMetadata;
|
|
903
410
|
/**
|
|
904
|
-
*
|
|
905
|
-
* before interacting with the provider to ensure methods are supported.
|
|
906
|
-
* @throws {METHOD_TIMED_OUT_ERROR} if the method timed out by lack of response.
|
|
907
|
-
* @throws {NETWORK_NOT_SUPPORTED_ERROR} if the network is not supported for the configured network.
|
|
908
|
-
* @throws {UNKNOWN_ERROR} if the response result was empty.
|
|
411
|
+
* Optional list of addresses that must sign the transactions
|
|
909
412
|
*/
|
|
910
|
-
|
|
413
|
+
signers?: string[];
|
|
911
414
|
/**
|
|
912
|
-
*
|
|
913
|
-
*
|
|
914
|
-
* @returns {(string | null)[]} the authorized accounts.
|
|
915
|
-
* @throws {INVALID_INPUT_ERROR} if computed group ID for the txns does not match the assigned group ID.
|
|
916
|
-
* @throws {INVALID_GROUP_ID_ERROR} if the unsigned txns is malformed or not conforming to ARC-0001.
|
|
917
|
-
* @throws {METHOD_CANCELED_ERROR} if the method was cancelled by the user.
|
|
918
|
-
* @throws {METHOD_NOT_SUPPORTED_ERROR} if the method is not supported for the configured network.
|
|
919
|
-
* @throws {METHOD_TIMED_OUT_ERROR} if the method timed out by lack of response.
|
|
920
|
-
* @throws {NETWORK_NOT_SUPPORTED_ERROR} if the network is not supported for the configured network.
|
|
921
|
-
* @throws {UNAUTHORIZED_SIGNER_ERROR} if a signer in the request is not authorized by the provider.
|
|
922
|
-
* @throws {UNKNOWN_ERROR} if the response result was empty.
|
|
415
|
+
* Optional base64 encoding of the canonical msgpack encoding of a
|
|
416
|
+
* SignedTxn corresponding to txn, when signers=[]
|
|
923
417
|
*/
|
|
924
|
-
|
|
418
|
+
stxn?: string;
|
|
925
419
|
/**
|
|
926
|
-
*
|
|
927
|
-
* @param {ProviderMethods} method - the method to validate.
|
|
928
|
-
* @throws {METHOD_NOT_SUPPORTED_ERROR} if the method is not supported for the configured network.
|
|
420
|
+
* Optional message explaining the reason of the transaction
|
|
929
421
|
*/
|
|
930
|
-
|
|
422
|
+
message?: string;
|
|
931
423
|
/**
|
|
932
|
-
*
|
|
424
|
+
* Optional message explaining the reason of this group of transaction
|
|
425
|
+
* Field only allowed in the first transaction of a group
|
|
933
426
|
*/
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
427
|
+
groupMessage?: string;
|
|
428
|
+
}
|
|
429
|
+
/** @see https://github.com/perawallet/connect/blob/1.3.3/src/util/model/peraWalletModels.ts */
|
|
430
|
+
interface SignerTransaction {
|
|
431
|
+
txn: algosdk.Transaction;
|
|
432
|
+
/**
|
|
433
|
+
* Optional authorized address used to sign the transaction when
|
|
434
|
+
* the account is rekeyed. Also called the signor/sgnr.
|
|
435
|
+
*/
|
|
436
|
+
authAddr?: string;
|
|
437
|
+
/**
|
|
438
|
+
* Optional list of addresses that must sign the transactions.
|
|
439
|
+
* Wallet skips to sign this txn if signers is empty array.
|
|
440
|
+
* If undefined, wallet tries to sign it.
|
|
441
|
+
*/
|
|
442
|
+
signers?: string[];
|
|
443
|
+
/**
|
|
444
|
+
* Optional message explaining the reason of the transaction
|
|
445
|
+
*/
|
|
446
|
+
message?: string;
|
|
447
|
+
}
|
|
448
|
+
interface JsonRpcRequest<T = any> {
|
|
449
|
+
id: number;
|
|
450
|
+
jsonrpc: string;
|
|
451
|
+
method: string;
|
|
452
|
+
params: T;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
declare abstract class BaseWallet {
|
|
456
|
+
readonly id: WalletId;
|
|
457
|
+
readonly metadata: WalletMetadata;
|
|
458
|
+
protected store: Store<State>;
|
|
459
|
+
protected getAlgodClient: () => algosdk.Algodv2;
|
|
460
|
+
subscribe: (callback: (state: State) => void) => () => void;
|
|
461
|
+
protected constructor({ id, metadata, store, subscribe, getAlgodClient }: WalletConstructor<WalletId>);
|
|
462
|
+
static defaultMetadata: WalletMetadata;
|
|
463
|
+
abstract connect(args?: Record<string, any>): Promise<WalletAccount[]>;
|
|
464
|
+
abstract disconnect(): Promise<void>;
|
|
465
|
+
abstract resumeSession(): Promise<void>;
|
|
466
|
+
setActive: () => void;
|
|
467
|
+
setActiveAccount: (account: string) => void;
|
|
468
|
+
abstract signTransactions(txnGroup: algosdk.Transaction[] | algosdk.Transaction[][] | Uint8Array[] | Uint8Array[][], indexesToSign?: number[], returnGroup?: boolean): Promise<Uint8Array[]>;
|
|
469
|
+
abstract transactionSigner(txnGroup: algosdk.Transaction[], indexesToSign: number[]): Promise<Uint8Array[]>;
|
|
470
|
+
get name(): string;
|
|
471
|
+
get accounts(): WalletAccount[];
|
|
472
|
+
get addresses(): string[];
|
|
473
|
+
get activeAccount(): WalletAccount | null;
|
|
474
|
+
get activeAddress(): string | null;
|
|
475
|
+
get activeNetwork(): NetworkId;
|
|
476
|
+
get isConnected(): boolean;
|
|
477
|
+
get isActive(): boolean;
|
|
478
|
+
protected onDisconnect(): void;
|
|
938
479
|
}
|
|
939
480
|
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
connectedAccounts: Account[];
|
|
944
|
-
connectedActiveAccounts: Account[];
|
|
945
|
-
activeAccount: Account | null | undefined;
|
|
946
|
-
activeAddress: string | undefined;
|
|
947
|
-
status: string;
|
|
948
|
-
isActive: boolean;
|
|
949
|
-
isReady: boolean;
|
|
950
|
-
signer: algosdk.TransactionSigner;
|
|
951
|
-
signTransactions: (transactions: Uint8Array[] | Uint8Array[][], indexesToSign?: number[], returnGroup?: boolean) => Promise<Uint8Array[]>;
|
|
952
|
-
sendTransactions: (transactions: Uint8Array[], waitRoundsToConfirm?: number) => Promise<{
|
|
953
|
-
'confirmed-round': number;
|
|
954
|
-
'global-state-delta': Record<string, unknown>[];
|
|
955
|
-
'pool-error': string;
|
|
956
|
-
txn: {
|
|
957
|
-
sig: Uint8Array;
|
|
958
|
-
txn: Txn;
|
|
959
|
-
};
|
|
960
|
-
txId: string;
|
|
961
|
-
id: string;
|
|
962
|
-
}>;
|
|
963
|
-
getAddress: () => string | undefined;
|
|
964
|
-
groupTransactionsBySender: (transactions: TransactionsArray) => Record<string, TxnInfo[]>;
|
|
965
|
-
getAccountInfo: () => Promise<AccountInfo>;
|
|
966
|
-
getAssets: () => Promise<Asset[]>;
|
|
481
|
+
type WalletState = {
|
|
482
|
+
accounts: WalletAccount[];
|
|
483
|
+
activeAccount: WalletAccount | null;
|
|
967
484
|
};
|
|
485
|
+
type WalletStateMap = Partial<Record<WalletId, WalletState>>;
|
|
486
|
+
interface State {
|
|
487
|
+
wallets: WalletStateMap;
|
|
488
|
+
activeWallet: WalletId | null;
|
|
489
|
+
activeNetwork: NetworkId;
|
|
490
|
+
}
|
|
491
|
+
declare const defaultState: State;
|
|
492
|
+
|
|
493
|
+
interface WalletManagerConfig {
|
|
494
|
+
wallets?: SupportedWallet[];
|
|
495
|
+
network?: NetworkId;
|
|
496
|
+
algod?: NetworkConfig;
|
|
497
|
+
}
|
|
498
|
+
declare class WalletManager {
|
|
499
|
+
_clients: Map<WalletId, BaseWallet>;
|
|
500
|
+
networkConfig: NetworkConfigMap;
|
|
501
|
+
algodClient: algosdk.Algodv2;
|
|
502
|
+
store: Store<State>;
|
|
503
|
+
subscribe: (callback: (state: State) => void) => () => void;
|
|
504
|
+
constructor({ wallets, network, algod }?: WalletManagerConfig);
|
|
505
|
+
private loadPersistedState;
|
|
506
|
+
private savePersistedState;
|
|
507
|
+
private initializeWallets;
|
|
508
|
+
get wallets(): BaseWallet[];
|
|
509
|
+
getWallet(walletId: WalletId): BaseWallet | undefined;
|
|
510
|
+
resumeSessions(): Promise<void>;
|
|
511
|
+
private initNetworkConfig;
|
|
512
|
+
private createAlgodClient;
|
|
513
|
+
getAlgodClient: () => algosdk.Algodv2;
|
|
514
|
+
setActiveNetwork: (networkId: NetworkId) => void;
|
|
515
|
+
get activeNetwork(): NetworkId;
|
|
516
|
+
get activeWallet(): BaseWallet | null;
|
|
517
|
+
get activeWalletAccounts(): WalletAccount[] | null;
|
|
518
|
+
get activeWalletAddresses(): string[] | null;
|
|
519
|
+
get activeAccount(): WalletAccount | null;
|
|
520
|
+
get activeAddress(): string | null;
|
|
521
|
+
get signTransactions(): (txnGroup: algosdk.Transaction[] | algosdk.Transaction[][] | Uint8Array[] | Uint8Array[][], indexesToSign?: number[] | undefined, returnGroup?: boolean | undefined) => Promise<Uint8Array[]>;
|
|
522
|
+
/**
|
|
523
|
+
* A function which can sign transactions from an atomic transaction group. The logic will be
|
|
524
|
+
* specific to each wallet, but the function will always return a promise that resolves to an
|
|
525
|
+
* array of encoded signed transactions matching the length of the indexesToSign array.
|
|
526
|
+
*
|
|
527
|
+
* @see https://github.com/algorand/js-algorand-sdk/blob/v2.6.0/src/signer.ts#L7-L18
|
|
528
|
+
*
|
|
529
|
+
* @param txnGroup - The atomic group containing transactions to be signed
|
|
530
|
+
* @param indexesToSign - An array of indexes in the atomic transaction group that should be signed
|
|
531
|
+
* @returns A promise which resolves an array of encoded signed transactions. The length of the
|
|
532
|
+
* array will be the same as the length of indexesToSign, and each index i in the array
|
|
533
|
+
* corresponds to the signed transaction from txnGroup[indexesToSign[i]]
|
|
534
|
+
*/
|
|
535
|
+
get transactionSigner(): algosdk.TransactionSigner;
|
|
536
|
+
}
|
|
968
537
|
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
algosdkStatic?: typeof algosdk;
|
|
973
|
-
debug?: boolean;
|
|
538
|
+
declare class StorageAdapter {
|
|
539
|
+
static getItem(key: string): string | null;
|
|
540
|
+
static setItem(key: string, value: string): void;
|
|
974
541
|
}
|
|
975
|
-
declare function useInitializeProviders({ providers, nodeConfig, algosdkStatic, debug }: InitializeProvidersOptions): Partial<Record<PROVIDER_ID, BaseClient | null>> | null;
|
|
976
542
|
|
|
977
|
-
export {
|
|
543
|
+
export { BaseWallet, type BaseWalletConstructor, DeflyWallet, type DeflyWalletConnectOptions, type EnableResult, type Exodus, type ExodusOptions, ExodusWallet, type JsonRpcRequest, type KmdOptions, KmdWallet, MagicAuth, type MagicAuthClient, type MagicAuthOptions, type MnemonicOptions, MnemonicWallet, type MultisigMetadata, NetworkId, PeraWallet, type PeraWalletConnectOptions, type SignTxnsResult, type SignerTransaction, type State, StorageAdapter, type SupportedWallet, type SupportedWallets, type WalletAccount, type WalletConfig, type WalletConfigMap, WalletConnect, type WalletConnectOptions, type WalletConstructor, WalletId, type WalletIdConfig, WalletManager, type WalletManagerConfig, type WalletMap, type WalletMetadata, type WalletOptions, type WalletOptionsMap, type WalletState, type WalletTransaction, type WindowExtended, defaultState };
|