@txnlab/use-wallet 0.0.1
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 +143 -0
- package/dist/cjs/clients/algosigner.d.ts +62 -0
- package/dist/cjs/clients/base.d.ts +72 -0
- package/dist/cjs/clients/defly.d.ts +51 -0
- package/dist/cjs/clients/exodus.d.ts +52 -0
- package/dist/cjs/clients/index.d.ts +300 -0
- package/dist/cjs/clients/myalgowallet.d.ts +40 -0
- package/dist/cjs/clients/perawallet.d.ts +51 -0
- package/dist/cjs/constants/constants.d.ts +10 -0
- package/dist/cjs/constants/index.d.ts +1 -0
- package/dist/cjs/hooks/index.d.ts +2 -0
- package/dist/cjs/hooks/useConnectWallet.d.ts +22 -0
- package/dist/cjs/hooks/useWallet.d.ts +10 -0
- package/dist/cjs/index.d.ts +3 -0
- package/dist/cjs/index.js +3536 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/media/audio.d.ts +1 -0
- package/dist/cjs/providers/algosigner.d.ts +2 -0
- package/dist/cjs/providers/defly.d.ts +2 -0
- package/dist/cjs/providers/exodus.d.ts +2 -0
- package/dist/cjs/providers/index.d.ts +7 -0
- package/dist/cjs/providers/myalgowallet.d.ts +2 -0
- package/dist/cjs/providers/perawallet.d.ts +2 -0
- package/dist/cjs/store/index.d.ts +1 -0
- package/dist/cjs/store/middelware/immer.d.ts +10 -0
- package/dist/cjs/store/state/walletStore.d.ts +19 -0
- package/dist/cjs/types/api.d.ts +11 -0
- package/dist/cjs/types/index.d.ts +3 -0
- package/dist/cjs/types/node.d.ts +41 -0
- package/dist/cjs/types/wallet.d.ts +47 -0
- package/dist/cjs/utils/index.d.ts +4 -0
- package/dist/esm/clients/algosigner.d.ts +62 -0
- package/dist/esm/clients/base.d.ts +72 -0
- package/dist/esm/clients/defly.d.ts +51 -0
- package/dist/esm/clients/exodus.d.ts +52 -0
- package/dist/esm/clients/index.d.ts +300 -0
- package/dist/esm/clients/myalgowallet.d.ts +40 -0
- package/dist/esm/clients/perawallet.d.ts +51 -0
- package/dist/esm/constants/constants.d.ts +10 -0
- package/dist/esm/constants/index.d.ts +1 -0
- package/dist/esm/hooks/index.d.ts +2 -0
- package/dist/esm/hooks/useConnectWallet.d.ts +22 -0
- package/dist/esm/hooks/useWallet.d.ts +10 -0
- package/dist/esm/index.d.ts +3 -0
- package/dist/esm/index.js +3506 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/media/audio.d.ts +1 -0
- package/dist/esm/providers/algosigner.d.ts +2 -0
- package/dist/esm/providers/defly.d.ts +2 -0
- package/dist/esm/providers/exodus.d.ts +2 -0
- package/dist/esm/providers/index.d.ts +7 -0
- package/dist/esm/providers/myalgowallet.d.ts +2 -0
- package/dist/esm/providers/perawallet.d.ts +2 -0
- package/dist/esm/store/index.d.ts +1 -0
- package/dist/esm/store/middelware/immer.d.ts +10 -0
- package/dist/esm/store/state/walletStore.d.ts +19 -0
- package/dist/esm/types/api.d.ts +11 -0
- package/dist/esm/types/index.d.ts +3 -0
- package/dist/esm/types/node.d.ts +41 -0
- package/dist/esm/types/wallet.d.ts +47 -0
- package/dist/esm/utils/index.d.ts +4 -0
- package/dist/index.d.ts +160 -0
- package/package.json +94 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helpful resources:
|
|
3
|
+
* https://docs.exodus.com/api-reference/algorand-provider-api/
|
|
4
|
+
*/
|
|
5
|
+
import BaseWallet from "./base";
|
|
6
|
+
import type { InitAlgodClient } from "./base";
|
|
7
|
+
import { PROVIDER_ID } from "../constants";
|
|
8
|
+
import { providers } from "../providers";
|
|
9
|
+
import type { WalletProvider } from "../types";
|
|
10
|
+
import { TransactionsArray } from "../types";
|
|
11
|
+
declare type Bytes = Readonly<Uint8Array>;
|
|
12
|
+
declare type Exodus = {
|
|
13
|
+
isConnected: boolean;
|
|
14
|
+
address: string | null;
|
|
15
|
+
connect: () => Promise<{
|
|
16
|
+
address: string;
|
|
17
|
+
}>;
|
|
18
|
+
disconnect: () => void;
|
|
19
|
+
signAndSendTransaction(transactions: Bytes[]): Promise<{
|
|
20
|
+
txId: string;
|
|
21
|
+
}>;
|
|
22
|
+
signTransaction(transactions: Bytes[]): Promise<Bytes[]>;
|
|
23
|
+
};
|
|
24
|
+
declare type InitWallet = {
|
|
25
|
+
client: Exodus;
|
|
26
|
+
id: PROVIDER_ID;
|
|
27
|
+
providers: typeof providers;
|
|
28
|
+
};
|
|
29
|
+
declare class ExodusClient extends BaseWallet {
|
|
30
|
+
#private;
|
|
31
|
+
id: PROVIDER_ID;
|
|
32
|
+
provider: WalletProvider;
|
|
33
|
+
constructor(initAlgodClient: InitAlgodClient, initWallet: InitWallet);
|
|
34
|
+
static init(): Promise<ExodusClient>;
|
|
35
|
+
connect(): Promise<{
|
|
36
|
+
accounts: {
|
|
37
|
+
name: string;
|
|
38
|
+
address: string;
|
|
39
|
+
providerId: PROVIDER_ID;
|
|
40
|
+
}[];
|
|
41
|
+
id: PROVIDER_ID;
|
|
42
|
+
name: string;
|
|
43
|
+
icon: string;
|
|
44
|
+
isWalletConnect: boolean;
|
|
45
|
+
}>;
|
|
46
|
+
reconnect(onDisconnect: () => void): Promise<null>;
|
|
47
|
+
disconnect(): Promise<void>;
|
|
48
|
+
signTransactions(activeAdress: string, transactions: Array<Uint8Array>): Promise<Uint8Array[]>;
|
|
49
|
+
signEncodedTransactions(transactions: TransactionsArray): Promise<Uint8Array[]>;
|
|
50
|
+
}
|
|
51
|
+
declare const _default: Promise<void | ExodusClient>;
|
|
52
|
+
export default _default;
|
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
import { PROVIDER_ID } from "../constants";
|
|
2
|
+
export declare const clients: {
|
|
3
|
+
"Pera Wallet": Promise<void | {
|
|
4
|
+
"__#1@#client": import("@perawallet/connect/dist/PeraWalletConnect").default;
|
|
5
|
+
id: PROVIDER_ID;
|
|
6
|
+
provider: import("..").WalletProvider;
|
|
7
|
+
connect(onDisconnect: () => void): Promise<import("..").Wallet>;
|
|
8
|
+
reconnect(onDisconnect: () => void): Promise<{
|
|
9
|
+
accounts: {
|
|
10
|
+
name: string;
|
|
11
|
+
address: string;
|
|
12
|
+
providerId: PROVIDER_ID;
|
|
13
|
+
}[];
|
|
14
|
+
id: PROVIDER_ID;
|
|
15
|
+
name: string;
|
|
16
|
+
icon: string;
|
|
17
|
+
isWalletConnect: boolean;
|
|
18
|
+
} | null>;
|
|
19
|
+
disconnect(): Promise<void>;
|
|
20
|
+
formatTransactionsArray(transactions: import("..").TransactionsArray): import("./perawallet").PeraTransaction[];
|
|
21
|
+
signTransactions(activeAdress: string, transactions: Uint8Array[]): Promise<Uint8Array[]>;
|
|
22
|
+
signEncodedTransactions(transactions: import("..").TransactionsArray): Promise<Uint8Array[]>;
|
|
23
|
+
algodClient: import("algosdk").Algodv2;
|
|
24
|
+
algosdk: typeof import("algosdk/dist/types/src/main");
|
|
25
|
+
keepWCAlive: HTMLAudioElement;
|
|
26
|
+
healthCheck(): Promise<{}>;
|
|
27
|
+
getAccountInfo(address: string): Promise<import("..").AccountInfo>;
|
|
28
|
+
getAssets(address: string): Promise<import("..").Asset[]>;
|
|
29
|
+
waitForConfirmation(txId: string, timeout?: number): Promise<{
|
|
30
|
+
"confirmed-round": number;
|
|
31
|
+
"global-state-delta": Record<string, unknown>[];
|
|
32
|
+
"pool-error": string;
|
|
33
|
+
txn: {
|
|
34
|
+
sig: Uint8Array;
|
|
35
|
+
txn: import("..").Txn;
|
|
36
|
+
};
|
|
37
|
+
txId: string;
|
|
38
|
+
}>;
|
|
39
|
+
decodeTransaction: (txn: string, isSigned: boolean) => import("algosdk").Transaction;
|
|
40
|
+
logEncodedTransaction(txn: string, isSigned: boolean): void;
|
|
41
|
+
groupTransactionsBySender(transactions: import("..").TransactionsArray): Record<string, any>;
|
|
42
|
+
sendRawTransactions(transactions: Uint8Array[]): Promise<{
|
|
43
|
+
"confirmed-round": number;
|
|
44
|
+
"global-state-delta": Record<string, unknown>[];
|
|
45
|
+
"pool-error": string;
|
|
46
|
+
txn: {
|
|
47
|
+
sig: Uint8Array;
|
|
48
|
+
txn: import("..").Txn;
|
|
49
|
+
};
|
|
50
|
+
txId: string;
|
|
51
|
+
id: any;
|
|
52
|
+
}>;
|
|
53
|
+
keepWCAliveStart(): void;
|
|
54
|
+
keepWCAliveStop(): void;
|
|
55
|
+
}>;
|
|
56
|
+
"MyAlgo Wallet": Promise<void | {
|
|
57
|
+
"__#2@#client": import("@randlabs/myalgo-connect").default;
|
|
58
|
+
id: PROVIDER_ID;
|
|
59
|
+
provider: import("..").WalletProvider;
|
|
60
|
+
connect(): Promise<{
|
|
61
|
+
accounts: {
|
|
62
|
+
providerId: PROVIDER_ID;
|
|
63
|
+
address: string;
|
|
64
|
+
name: string;
|
|
65
|
+
}[];
|
|
66
|
+
id: PROVIDER_ID;
|
|
67
|
+
name: string;
|
|
68
|
+
icon: string;
|
|
69
|
+
isWalletConnect: boolean;
|
|
70
|
+
}>;
|
|
71
|
+
reconnect(): Promise<null>;
|
|
72
|
+
disconnect(): Promise<void>;
|
|
73
|
+
signTransactions(activeAdress: string, transactions: Uint8Array[]): Promise<Uint8Array[]>;
|
|
74
|
+
signEncodedTransactions(transactions: import("..").TransactionsArray): Promise<Uint8Array[]>;
|
|
75
|
+
algodClient: import("algosdk").Algodv2;
|
|
76
|
+
algosdk: typeof import("algosdk/dist/types/src/main");
|
|
77
|
+
keepWCAlive: HTMLAudioElement;
|
|
78
|
+
healthCheck(): Promise<{}>;
|
|
79
|
+
getAccountInfo(address: string): Promise<import("..").AccountInfo>;
|
|
80
|
+
getAssets(address: string): Promise<import("..").Asset[]>;
|
|
81
|
+
waitForConfirmation(txId: string, timeout?: number): Promise<{
|
|
82
|
+
"confirmed-round": number;
|
|
83
|
+
"global-state-delta": Record<string, unknown>[];
|
|
84
|
+
"pool-error": string;
|
|
85
|
+
txn: {
|
|
86
|
+
sig: Uint8Array;
|
|
87
|
+
txn: import("..").Txn;
|
|
88
|
+
};
|
|
89
|
+
txId: string;
|
|
90
|
+
}>;
|
|
91
|
+
decodeTransaction: (txn: string, isSigned: boolean) => import("algosdk").Transaction;
|
|
92
|
+
logEncodedTransaction(txn: string, isSigned: boolean): void;
|
|
93
|
+
groupTransactionsBySender(transactions: import("..").TransactionsArray): Record<string, any>;
|
|
94
|
+
sendRawTransactions(transactions: Uint8Array[]): Promise<{
|
|
95
|
+
"confirmed-round": number;
|
|
96
|
+
"global-state-delta": Record<string, unknown>[];
|
|
97
|
+
"pool-error": string;
|
|
98
|
+
txn: {
|
|
99
|
+
sig: Uint8Array;
|
|
100
|
+
txn: import("..").Txn;
|
|
101
|
+
};
|
|
102
|
+
txId: string;
|
|
103
|
+
id: any;
|
|
104
|
+
}>;
|
|
105
|
+
keepWCAliveStart(): void;
|
|
106
|
+
keepWCAliveStop(): void;
|
|
107
|
+
}>;
|
|
108
|
+
"Algo Signer": Promise<void | {
|
|
109
|
+
"__#3@#client": {
|
|
110
|
+
connect: () => Promise<Record<string, never>>;
|
|
111
|
+
accounts: (ledger: {
|
|
112
|
+
ledger: "MainNet" | "TestNet" | "BetaNet" | "devmodenet";
|
|
113
|
+
}) => Promise<{
|
|
114
|
+
address: string;
|
|
115
|
+
}[]>;
|
|
116
|
+
signTxn: (transactions: {
|
|
117
|
+
txn: string;
|
|
118
|
+
signers?: [] | undefined;
|
|
119
|
+
multisig?: string | undefined;
|
|
120
|
+
}[]) => Promise<{
|
|
121
|
+
txID: string;
|
|
122
|
+
blob: string;
|
|
123
|
+
}[]>;
|
|
124
|
+
encoding: {
|
|
125
|
+
msgpackToBase64(transaction: Uint8Array): string;
|
|
126
|
+
byteArrayToString(transaction: Uint8Array): string;
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
id: PROVIDER_ID;
|
|
130
|
+
provider: import("..").WalletProvider;
|
|
131
|
+
connect(): Promise<{
|
|
132
|
+
accounts: {
|
|
133
|
+
name: string;
|
|
134
|
+
address: string;
|
|
135
|
+
providerId: PROVIDER_ID;
|
|
136
|
+
}[];
|
|
137
|
+
id: PROVIDER_ID;
|
|
138
|
+
name: string;
|
|
139
|
+
icon: string;
|
|
140
|
+
isWalletConnect: boolean;
|
|
141
|
+
}>;
|
|
142
|
+
reconnect(onDisconnect: () => void): Promise<null>;
|
|
143
|
+
disconnect(): Promise<void>;
|
|
144
|
+
formatTransactionsArray(transactions: import("..").TransactionsArray): {
|
|
145
|
+
txn: string;
|
|
146
|
+
signers?: [] | undefined;
|
|
147
|
+
multisig?: string | undefined;
|
|
148
|
+
}[];
|
|
149
|
+
signTransactions(activeAdress: string, transactions: Uint8Array[]): Promise<Uint8Array[]>;
|
|
150
|
+
signEncodedTransactions(transactions: import("..").TransactionsArray): Promise<Uint8Array[]>;
|
|
151
|
+
algodClient: import("algosdk").Algodv2;
|
|
152
|
+
algosdk: typeof import("algosdk/dist/types/src/main");
|
|
153
|
+
keepWCAlive: HTMLAudioElement;
|
|
154
|
+
healthCheck(): Promise<{}>;
|
|
155
|
+
getAccountInfo(address: string): Promise<import("..").AccountInfo>;
|
|
156
|
+
getAssets(address: string): Promise<import("..").Asset[]>;
|
|
157
|
+
waitForConfirmation(txId: string, timeout?: number): Promise<{
|
|
158
|
+
"confirmed-round": number;
|
|
159
|
+
"global-state-delta": Record<string, unknown>[];
|
|
160
|
+
"pool-error": string;
|
|
161
|
+
txn: {
|
|
162
|
+
sig: Uint8Array;
|
|
163
|
+
txn: import("..").Txn;
|
|
164
|
+
};
|
|
165
|
+
txId: string;
|
|
166
|
+
}>;
|
|
167
|
+
decodeTransaction: (txn: string, isSigned: boolean) => import("algosdk").Transaction;
|
|
168
|
+
logEncodedTransaction(txn: string, isSigned: boolean): void;
|
|
169
|
+
groupTransactionsBySender(transactions: import("..").TransactionsArray): Record<string, any>;
|
|
170
|
+
sendRawTransactions(transactions: Uint8Array[]): Promise<{
|
|
171
|
+
"confirmed-round": number;
|
|
172
|
+
"global-state-delta": Record<string, unknown>[];
|
|
173
|
+
"pool-error": string;
|
|
174
|
+
txn: {
|
|
175
|
+
sig: Uint8Array;
|
|
176
|
+
txn: import("..").Txn;
|
|
177
|
+
};
|
|
178
|
+
txId: string;
|
|
179
|
+
id: any;
|
|
180
|
+
}>;
|
|
181
|
+
keepWCAliveStart(): void;
|
|
182
|
+
keepWCAliveStop(): void;
|
|
183
|
+
}>;
|
|
184
|
+
Defly: Promise<void | {
|
|
185
|
+
"__#4@#client": import("@blockshake/defly-connect/dist/DeflyWalletConnect").default;
|
|
186
|
+
id: PROVIDER_ID;
|
|
187
|
+
provider: import("..").WalletProvider;
|
|
188
|
+
connect(onDisconnect: () => void): Promise<import("..").Wallet>;
|
|
189
|
+
reconnect(onDisconnect: () => void): Promise<{
|
|
190
|
+
accounts: {
|
|
191
|
+
name: string;
|
|
192
|
+
address: string;
|
|
193
|
+
providerId: PROVIDER_ID;
|
|
194
|
+
}[];
|
|
195
|
+
id: PROVIDER_ID;
|
|
196
|
+
name: string;
|
|
197
|
+
icon: string;
|
|
198
|
+
isWalletConnect: boolean;
|
|
199
|
+
} | null>;
|
|
200
|
+
disconnect(): Promise<void>;
|
|
201
|
+
formatTransactionsArray(transactions: import("..").TransactionsArray): import("./defly").DeflyTransaction[];
|
|
202
|
+
signTransactions(activeAdress: string, transactions: Uint8Array[]): Promise<Uint8Array[]>;
|
|
203
|
+
signEncodedTransactions(transactions: import("..").TransactionsArray): Promise<Uint8Array[]>;
|
|
204
|
+
algodClient: import("algosdk").Algodv2;
|
|
205
|
+
algosdk: typeof import("algosdk/dist/types/src/main");
|
|
206
|
+
keepWCAlive: HTMLAudioElement;
|
|
207
|
+
healthCheck(): Promise<{}>;
|
|
208
|
+
getAccountInfo(address: string): Promise<import("..").AccountInfo>;
|
|
209
|
+
getAssets(address: string): Promise<import("..").Asset[]>;
|
|
210
|
+
waitForConfirmation(txId: string, timeout?: number): Promise<{
|
|
211
|
+
"confirmed-round": number;
|
|
212
|
+
"global-state-delta": Record<string, unknown>[];
|
|
213
|
+
"pool-error": string;
|
|
214
|
+
txn: {
|
|
215
|
+
sig: Uint8Array;
|
|
216
|
+
txn: import("..").Txn;
|
|
217
|
+
};
|
|
218
|
+
txId: string;
|
|
219
|
+
}>;
|
|
220
|
+
decodeTransaction: (txn: string, isSigned: boolean) => import("algosdk").Transaction;
|
|
221
|
+
logEncodedTransaction(txn: string, isSigned: boolean): void;
|
|
222
|
+
groupTransactionsBySender(transactions: import("..").TransactionsArray): Record<string, any>;
|
|
223
|
+
sendRawTransactions(transactions: Uint8Array[]): Promise<{
|
|
224
|
+
"confirmed-round": number;
|
|
225
|
+
"global-state-delta": Record<string, unknown>[];
|
|
226
|
+
"pool-error": string;
|
|
227
|
+
txn: {
|
|
228
|
+
sig: Uint8Array;
|
|
229
|
+
txn: import("..").Txn;
|
|
230
|
+
};
|
|
231
|
+
txId: string;
|
|
232
|
+
id: any;
|
|
233
|
+
}>;
|
|
234
|
+
keepWCAliveStart(): void;
|
|
235
|
+
keepWCAliveStop(): void;
|
|
236
|
+
}>;
|
|
237
|
+
Exodus: Promise<void | {
|
|
238
|
+
"__#5@#client": {
|
|
239
|
+
isConnected: boolean;
|
|
240
|
+
address: string | null;
|
|
241
|
+
connect: () => Promise<{
|
|
242
|
+
address: string;
|
|
243
|
+
}>;
|
|
244
|
+
disconnect: () => void;
|
|
245
|
+
signAndSendTransaction(transactions: Readonly<Uint8Array>[]): Promise<{
|
|
246
|
+
txId: string;
|
|
247
|
+
}>;
|
|
248
|
+
signTransaction(transactions: Readonly<Uint8Array>[]): Promise<Readonly<Uint8Array>[]>;
|
|
249
|
+
};
|
|
250
|
+
id: PROVIDER_ID;
|
|
251
|
+
provider: import("..").WalletProvider;
|
|
252
|
+
connect(): Promise<{
|
|
253
|
+
accounts: {
|
|
254
|
+
name: string;
|
|
255
|
+
address: string;
|
|
256
|
+
providerId: PROVIDER_ID;
|
|
257
|
+
}[];
|
|
258
|
+
id: PROVIDER_ID;
|
|
259
|
+
name: string;
|
|
260
|
+
icon: string;
|
|
261
|
+
isWalletConnect: boolean;
|
|
262
|
+
}>;
|
|
263
|
+
reconnect(onDisconnect: () => void): Promise<null>;
|
|
264
|
+
disconnect(): Promise<void>;
|
|
265
|
+
signTransactions(activeAdress: string, transactions: Uint8Array[]): Promise<Uint8Array[]>;
|
|
266
|
+
signEncodedTransactions(transactions: import("..").TransactionsArray): Promise<Uint8Array[]>;
|
|
267
|
+
algodClient: import("algosdk").Algodv2;
|
|
268
|
+
algosdk: typeof import("algosdk/dist/types/src/main");
|
|
269
|
+
keepWCAlive: HTMLAudioElement;
|
|
270
|
+
healthCheck(): Promise<{}>;
|
|
271
|
+
getAccountInfo(address: string): Promise<import("..").AccountInfo>;
|
|
272
|
+
getAssets(address: string): Promise<import("..").Asset[]>;
|
|
273
|
+
waitForConfirmation(txId: string, timeout?: number): Promise<{
|
|
274
|
+
"confirmed-round": number;
|
|
275
|
+
"global-state-delta": Record<string, unknown>[];
|
|
276
|
+
"pool-error": string;
|
|
277
|
+
txn: {
|
|
278
|
+
sig: Uint8Array;
|
|
279
|
+
txn: import("..").Txn;
|
|
280
|
+
};
|
|
281
|
+
txId: string;
|
|
282
|
+
}>;
|
|
283
|
+
decodeTransaction: (txn: string, isSigned: boolean) => import("algosdk").Transaction;
|
|
284
|
+
logEncodedTransaction(txn: string, isSigned: boolean): void;
|
|
285
|
+
groupTransactionsBySender(transactions: import("..").TransactionsArray): Record<string, any>;
|
|
286
|
+
sendRawTransactions(transactions: Uint8Array[]): Promise<{
|
|
287
|
+
"confirmed-round": number;
|
|
288
|
+
"global-state-delta": Record<string, unknown>[];
|
|
289
|
+
"pool-error": string;
|
|
290
|
+
txn: {
|
|
291
|
+
sig: Uint8Array;
|
|
292
|
+
txn: import("..").Txn;
|
|
293
|
+
};
|
|
294
|
+
txId: string;
|
|
295
|
+
id: any;
|
|
296
|
+
}>;
|
|
297
|
+
keepWCAliveStart(): void;
|
|
298
|
+
keepWCAliveStop(): void;
|
|
299
|
+
}>;
|
|
300
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helpful resources:
|
|
3
|
+
* https://github.com/randlabs/myalgo-connect
|
|
4
|
+
*/
|
|
5
|
+
import BaseWallet from "./base";
|
|
6
|
+
import type MyAlgoConnect from "@randlabs/myalgo-connect";
|
|
7
|
+
import type { InitAlgodClient } from "./base";
|
|
8
|
+
import { PROVIDER_ID } from "../constants";
|
|
9
|
+
import { providers } from "../providers";
|
|
10
|
+
import type { WalletProvider } from "../types";
|
|
11
|
+
import { TransactionsArray } from "../types";
|
|
12
|
+
declare type InitWallet = {
|
|
13
|
+
id: PROVIDER_ID;
|
|
14
|
+
client: MyAlgoConnect;
|
|
15
|
+
providers: typeof providers;
|
|
16
|
+
};
|
|
17
|
+
declare class MyAlgoWalletClient extends BaseWallet {
|
|
18
|
+
#private;
|
|
19
|
+
id: PROVIDER_ID;
|
|
20
|
+
provider: WalletProvider;
|
|
21
|
+
constructor(initAlgodClient: InitAlgodClient, initWallet: InitWallet);
|
|
22
|
+
static init(): Promise<MyAlgoWalletClient>;
|
|
23
|
+
connect(): Promise<{
|
|
24
|
+
accounts: {
|
|
25
|
+
providerId: PROVIDER_ID;
|
|
26
|
+
address: string;
|
|
27
|
+
name: string;
|
|
28
|
+
}[];
|
|
29
|
+
id: PROVIDER_ID;
|
|
30
|
+
name: string;
|
|
31
|
+
icon: string;
|
|
32
|
+
isWalletConnect: boolean;
|
|
33
|
+
}>;
|
|
34
|
+
reconnect(): Promise<null>;
|
|
35
|
+
disconnect(): Promise<void>;
|
|
36
|
+
signTransactions(activeAdress: string, transactions: Uint8Array[]): Promise<Uint8Array[]>;
|
|
37
|
+
signEncodedTransactions(transactions: TransactionsArray): Promise<Uint8Array[]>;
|
|
38
|
+
}
|
|
39
|
+
declare const _default: Promise<void | MyAlgoWalletClient>;
|
|
40
|
+
export default _default;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helpful resources:
|
|
3
|
+
* https://github.com/perawallet/connect
|
|
4
|
+
*/
|
|
5
|
+
import { providers } from "../providers";
|
|
6
|
+
import type { PeraWalletConnect } from "@perawallet/connect";
|
|
7
|
+
import type { WalletProvider, Wallet } from "../types";
|
|
8
|
+
import { PROVIDER_ID } from "../constants";
|
|
9
|
+
import type { Transaction } from "algosdk";
|
|
10
|
+
import BaseWallet from "./base";
|
|
11
|
+
import type { InitAlgodClient } from "./base";
|
|
12
|
+
import { TransactionsArray } from "../types";
|
|
13
|
+
export interface PeraTransaction {
|
|
14
|
+
txn: Transaction;
|
|
15
|
+
/**
|
|
16
|
+
* Optional list of addresses that must sign the transactions.
|
|
17
|
+
* Wallet skips to sign this txn if signers is empty array.
|
|
18
|
+
* If undefined, wallet tries to sign it.
|
|
19
|
+
*/
|
|
20
|
+
signers?: string[];
|
|
21
|
+
}
|
|
22
|
+
declare type InitWallet = {
|
|
23
|
+
id: PROVIDER_ID;
|
|
24
|
+
client: PeraWalletConnect;
|
|
25
|
+
providers: typeof providers;
|
|
26
|
+
};
|
|
27
|
+
declare class PeraWalletClient extends BaseWallet {
|
|
28
|
+
#private;
|
|
29
|
+
id: PROVIDER_ID;
|
|
30
|
+
provider: WalletProvider;
|
|
31
|
+
constructor(initAlgodClient: InitAlgodClient, initWallet: InitWallet);
|
|
32
|
+
static init(): Promise<PeraWalletClient>;
|
|
33
|
+
connect(onDisconnect: () => void): Promise<Wallet>;
|
|
34
|
+
reconnect(onDisconnect: () => void): Promise<{
|
|
35
|
+
accounts: {
|
|
36
|
+
name: string;
|
|
37
|
+
address: string;
|
|
38
|
+
providerId: PROVIDER_ID;
|
|
39
|
+
}[];
|
|
40
|
+
id: PROVIDER_ID;
|
|
41
|
+
name: string;
|
|
42
|
+
icon: string;
|
|
43
|
+
isWalletConnect: boolean;
|
|
44
|
+
} | null>;
|
|
45
|
+
disconnect(): Promise<void>;
|
|
46
|
+
formatTransactionsArray(transactions: TransactionsArray): PeraTransaction[];
|
|
47
|
+
signTransactions(activeAdress: string, transactions: Uint8Array[]): Promise<Uint8Array[]>;
|
|
48
|
+
signEncodedTransactions(transactions: TransactionsArray): Promise<Uint8Array[]>;
|
|
49
|
+
}
|
|
50
|
+
declare const _default: Promise<void | PeraWalletClient>;
|
|
51
|
+
export default _default;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare enum PROVIDER_ID {
|
|
2
|
+
PERA_WALLET = "Pera Wallet",
|
|
3
|
+
MYALGO_WALLET = "MyAlgo Wallet",
|
|
4
|
+
ALGO_SIGNER = "Algo Signer",
|
|
5
|
+
DEFLY = "Defly",
|
|
6
|
+
EXODUS = "Exodus"
|
|
7
|
+
}
|
|
8
|
+
export declare const NODE_SERVER = "https://node.algoexplorerapi.io";
|
|
9
|
+
export declare const NODE_TOKEN = "";
|
|
10
|
+
export declare const NODE_PORT = "";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./constants";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { PROVIDER_ID } from "../types";
|
|
2
|
+
export default function useConnectWallet(): {
|
|
3
|
+
providers: {
|
|
4
|
+
id: PROVIDER_ID;
|
|
5
|
+
name: string;
|
|
6
|
+
icon: string;
|
|
7
|
+
isActive: boolean;
|
|
8
|
+
isConnected: boolean;
|
|
9
|
+
isWalletConnect: boolean;
|
|
10
|
+
connect: () => Promise<void>;
|
|
11
|
+
disconnect: () => Promise<void>;
|
|
12
|
+
reconnect: () => Promise<void>;
|
|
13
|
+
setActive: () => Promise<void>;
|
|
14
|
+
}[];
|
|
15
|
+
activeAccount: import("../types").Account | null;
|
|
16
|
+
accounts: import("../types").Account[];
|
|
17
|
+
connect: (id: PROVIDER_ID) => Promise<void>;
|
|
18
|
+
reconnect: (id: PROVIDER_ID) => Promise<void>;
|
|
19
|
+
disconnect: (id: PROVIDER_ID) => Promise<void>;
|
|
20
|
+
setActive: (id: PROVIDER_ID) => Promise<void>;
|
|
21
|
+
reconnectProviders: () => Promise<void>;
|
|
22
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PROVIDER_ID } from "../types";
|
|
2
|
+
export { PROVIDER_ID };
|
|
3
|
+
export default function useWallet(): {
|
|
4
|
+
accounts: import("../types").Account[];
|
|
5
|
+
activeAccount: import("../types").Account | null;
|
|
6
|
+
signTransactions: (transactions: Array<Uint8Array>) => Promise<Uint8Array[]>;
|
|
7
|
+
sendTransactions: (transactions: Uint8Array[]) => Promise<import("../types").ConfirmedTxn & {
|
|
8
|
+
id: string;
|
|
9
|
+
}>;
|
|
10
|
+
};
|