@txnlab/use-wallet 0.1.22 → 1.0.0
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 +252 -94
- package/dist/cjs/algod/index.d.ts +3 -2
- package/dist/cjs/clients/algosigner/client.d.ts +35 -0
- package/dist/cjs/clients/algosigner/constants.d.ts +2 -0
- package/dist/cjs/clients/algosigner/index.d.ts +2 -0
- package/dist/cjs/clients/algosigner/types.d.ts +40 -0
- package/dist/cjs/clients/base/base.d.ts +50 -0
- package/dist/cjs/clients/base/index.d.ts +2 -0
- package/dist/cjs/clients/defly/client.d.ts +37 -0
- package/dist/cjs/clients/defly/constants.d.ts +1 -0
- package/dist/cjs/clients/defly/index.d.ts +2 -0
- package/dist/cjs/clients/defly/types.d.ts +36 -0
- package/dist/cjs/clients/exodus/client.d.ts +33 -0
- package/dist/cjs/clients/exodus/constants.d.ts +1 -0
- package/dist/cjs/clients/exodus/index.d.ts +2 -0
- package/dist/cjs/clients/exodus/types.d.ts +40 -0
- package/dist/cjs/clients/index.d.ts +11 -15
- package/dist/cjs/clients/kmd/client.d.ts +29 -0
- package/dist/cjs/clients/kmd/constants.d.ts +1 -0
- package/dist/cjs/clients/kmd/index.d.ts +2 -0
- package/dist/cjs/clients/kmd/types.d.ts +38 -0
- package/dist/cjs/clients/myalgo/client.d.ts +37 -0
- package/dist/cjs/clients/myalgo/constants.d.ts +1 -0
- package/dist/cjs/clients/myalgo/index.d.ts +2 -0
- package/dist/cjs/clients/myalgo/types.d.ts +23 -0
- package/dist/cjs/clients/pera/client.d.ts +35 -0
- package/dist/cjs/clients/pera/constants.d.ts +1 -0
- package/dist/cjs/clients/pera/index.d.ts +2 -0
- package/dist/cjs/clients/pera/types.d.ts +36 -0
- package/dist/cjs/clients/walletconnect/client.d.ts +37 -0
- package/dist/cjs/clients/walletconnect/constants.d.ts +2 -0
- package/dist/cjs/clients/walletconnect/index.d.ts +2 -0
- package/dist/cjs/clients/walletconnect/types.d.ts +54 -0
- package/dist/cjs/constants/constants.d.ts +12 -16
- package/dist/cjs/hooks/index.d.ts +0 -1
- package/dist/cjs/hooks/useWallet.d.ts +140 -8
- package/dist/cjs/index.d.ts +4 -2
- package/dist/cjs/index.js +1428 -1031
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/store/index.d.ts +1 -0
- package/dist/cjs/store/state/clientStore.d.ts +22 -0
- package/dist/cjs/store/state/walletStore.d.ts +17 -1
- package/dist/cjs/types/node.d.ts +3 -0
- package/dist/cjs/types/wallet.d.ts +2 -2
- package/dist/cjs/utils/index.d.ts +2 -2
- package/dist/cjs/utils/initializeProviders.d.ts +13 -0
- package/dist/cjs/utils/reconnectProviders.d.ts +6 -0
- package/dist/esm/algod/index.d.ts +3 -2
- package/dist/esm/clients/algosigner/client.d.ts +35 -0
- package/dist/esm/clients/algosigner/constants.d.ts +2 -0
- package/dist/esm/clients/algosigner/index.d.ts +2 -0
- package/dist/esm/clients/algosigner/types.d.ts +40 -0
- package/dist/esm/clients/base/base.d.ts +50 -0
- package/dist/esm/clients/base/index.d.ts +2 -0
- package/dist/esm/clients/defly/client.d.ts +37 -0
- package/dist/esm/clients/defly/constants.d.ts +1 -0
- package/dist/esm/clients/defly/index.d.ts +2 -0
- package/dist/esm/clients/defly/types.d.ts +36 -0
- package/dist/esm/clients/exodus/client.d.ts +33 -0
- package/dist/esm/clients/exodus/constants.d.ts +1 -0
- package/dist/esm/clients/exodus/index.d.ts +2 -0
- package/dist/esm/clients/exodus/types.d.ts +40 -0
- package/dist/esm/clients/index.d.ts +11 -15
- package/dist/esm/clients/kmd/client.d.ts +29 -0
- package/dist/esm/clients/kmd/constants.d.ts +1 -0
- package/dist/esm/clients/kmd/index.d.ts +2 -0
- package/dist/esm/clients/kmd/types.d.ts +38 -0
- package/dist/esm/clients/myalgo/client.d.ts +37 -0
- package/dist/esm/clients/myalgo/constants.d.ts +1 -0
- package/dist/esm/clients/myalgo/index.d.ts +2 -0
- package/dist/esm/clients/myalgo/types.d.ts +23 -0
- package/dist/esm/clients/pera/client.d.ts +35 -0
- package/dist/esm/clients/pera/constants.d.ts +1 -0
- package/dist/esm/clients/pera/index.d.ts +2 -0
- package/dist/esm/clients/pera/types.d.ts +36 -0
- package/dist/esm/clients/walletconnect/client.d.ts +37 -0
- package/dist/esm/clients/walletconnect/constants.d.ts +2 -0
- package/dist/esm/clients/walletconnect/index.d.ts +2 -0
- package/dist/esm/clients/walletconnect/types.d.ts +54 -0
- package/dist/esm/constants/constants.d.ts +12 -16
- package/dist/esm/hooks/index.d.ts +0 -1
- package/dist/esm/hooks/useWallet.d.ts +140 -8
- package/dist/esm/index.d.ts +4 -2
- package/dist/esm/index.js +1415 -1021
- package/dist/esm/store/index.d.ts +1 -0
- package/dist/esm/store/state/clientStore.d.ts +22 -0
- package/dist/esm/store/state/walletStore.d.ts +17 -1
- package/dist/esm/types/node.d.ts +3 -0
- package/dist/esm/types/wallet.d.ts +2 -2
- package/dist/esm/utils/index.d.ts +2 -2
- package/dist/esm/utils/initializeProviders.d.ts +13 -0
- package/dist/esm/utils/reconnectProviders.d.ts +6 -0
- package/dist/index.d.ts +669 -66
- package/package.json +5 -5
- package/dist/cjs/clients/algosigner.d.ts +0 -62
- package/dist/cjs/clients/base.d.ts +0 -63
- package/dist/cjs/clients/defly.d.ts +0 -51
- package/dist/cjs/clients/exodus.d.ts +0 -52
- package/dist/cjs/clients/kmd.d.ts +0 -31
- package/dist/cjs/clients/myalgowallet.d.ts +0 -40
- package/dist/cjs/clients/perawallet.d.ts +0 -47
- package/dist/cjs/clients/walletconnect.d.ts +0 -47
- package/dist/cjs/hooks/useConnectWallet.d.ts +0 -30
- package/dist/cjs/providers/algosigner.d.ts +0 -2
- package/dist/cjs/providers/defly.d.ts +0 -2
- package/dist/cjs/providers/exodus.d.ts +0 -2
- package/dist/cjs/providers/index.d.ts +0 -9
- package/dist/cjs/providers/kmd.d.ts +0 -2
- package/dist/cjs/providers/myalgowallet.d.ts +0 -2
- package/dist/cjs/providers/perawallet.d.ts +0 -2
- package/dist/cjs/providers/walletconnect.d.ts +0 -2
- package/dist/cjs/store/middelware/immer.d.ts +0 -10
- package/dist/esm/clients/algosigner.d.ts +0 -62
- package/dist/esm/clients/base.d.ts +0 -63
- package/dist/esm/clients/defly.d.ts +0 -51
- package/dist/esm/clients/exodus.d.ts +0 -52
- package/dist/esm/clients/kmd.d.ts +0 -31
- package/dist/esm/clients/myalgowallet.d.ts +0 -40
- package/dist/esm/clients/perawallet.d.ts +0 -47
- package/dist/esm/clients/walletconnect.d.ts +0 -47
- package/dist/esm/hooks/useConnectWallet.d.ts +0 -30
- package/dist/esm/providers/algosigner.d.ts +0 -2
- package/dist/esm/providers/defly.d.ts +0 -2
- package/dist/esm/providers/exodus.d.ts +0 -2
- package/dist/esm/providers/index.d.ts +0 -9
- package/dist/esm/providers/kmd.d.ts +0 -2
- package/dist/esm/providers/myalgowallet.d.ts +0 -2
- package/dist/esm/providers/perawallet.d.ts +0 -2
- package/dist/esm/providers/walletconnect.d.ts +0 -2
- package/dist/esm/store/middelware/immer.d.ts +0 -10
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Transaction } from "algosdk";
|
|
2
|
+
import type { AlgodClientOptions, Network } from "../../types";
|
|
3
|
+
import type { DeflyWalletConnect } from "@blockshake/defly-connect";
|
|
4
|
+
import type _algosdk from "algosdk";
|
|
5
|
+
export declare type ClientOptions = {
|
|
6
|
+
bridge?: string;
|
|
7
|
+
deep_link?: string;
|
|
8
|
+
app_meta?: {
|
|
9
|
+
logo: string;
|
|
10
|
+
name: string;
|
|
11
|
+
main_color: string;
|
|
12
|
+
};
|
|
13
|
+
shouldShowSignTxnToast?: boolean;
|
|
14
|
+
};
|
|
15
|
+
export declare type DeflyTransaction = {
|
|
16
|
+
txn: Transaction;
|
|
17
|
+
/**
|
|
18
|
+
* Optional list of addresses that must sign the transactions.
|
|
19
|
+
* Wallet skips to sign this txn if signers is empty array.
|
|
20
|
+
* If undefined, wallet tries to sign it.
|
|
21
|
+
*/
|
|
22
|
+
signers?: string[];
|
|
23
|
+
};
|
|
24
|
+
export declare type DeflyWalletClientConstructor = {
|
|
25
|
+
client: DeflyWalletConnect;
|
|
26
|
+
algosdk: typeof _algosdk;
|
|
27
|
+
algodClient: _algosdk.Algodv2;
|
|
28
|
+
network: Network;
|
|
29
|
+
};
|
|
30
|
+
export declare type InitParams = {
|
|
31
|
+
clientOptions?: ClientOptions;
|
|
32
|
+
algodOptions?: AlgodClientOptions;
|
|
33
|
+
clientStatic?: typeof DeflyWalletConnect;
|
|
34
|
+
algosdkStatic?: typeof _algosdk;
|
|
35
|
+
network?: Network;
|
|
36
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import BaseWallet from "../base";
|
|
2
|
+
import { PROVIDER_ID } from "../../constants";
|
|
3
|
+
import type { TransactionsArray, Network } from "../../types";
|
|
4
|
+
import { InitParams, ExodusClientConstructor } from "./types";
|
|
5
|
+
declare class ExodusClient extends BaseWallet {
|
|
6
|
+
#private;
|
|
7
|
+
network: Network;
|
|
8
|
+
constructor({ client, algosdk, algodClient, onlyIfTrusted, network, }: ExodusClientConstructor);
|
|
9
|
+
static metadata: {
|
|
10
|
+
id: PROVIDER_ID;
|
|
11
|
+
name: string;
|
|
12
|
+
icon: string;
|
|
13
|
+
isWalletConnect: boolean;
|
|
14
|
+
};
|
|
15
|
+
static init({ clientOptions, algodOptions, algosdkStatic, network, }: InitParams): Promise<ExodusClient | null>;
|
|
16
|
+
connect(): Promise<{
|
|
17
|
+
accounts: {
|
|
18
|
+
name: string;
|
|
19
|
+
address: string;
|
|
20
|
+
providerId: PROVIDER_ID;
|
|
21
|
+
}[];
|
|
22
|
+
id: PROVIDER_ID;
|
|
23
|
+
name: string;
|
|
24
|
+
icon: string;
|
|
25
|
+
isWalletConnect: boolean;
|
|
26
|
+
}>;
|
|
27
|
+
reconnect(onDisconnect: () => void): Promise<null>;
|
|
28
|
+
disconnect(): Promise<void>;
|
|
29
|
+
signTransactions(connectedAccounts: string[], transactions: Array<Uint8Array>): Promise<Uint8Array[]>;
|
|
30
|
+
/** @deprecated */
|
|
31
|
+
signEncodedTransactions(transactions: TransactionsArray): Promise<Uint8Array[]>;
|
|
32
|
+
}
|
|
33
|
+
export default ExodusClient;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ICON: string;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { PROVIDER_ID } from "../../constants";
|
|
2
|
+
import type _algosdk from "algosdk";
|
|
3
|
+
import type { AlgodClientOptions, Network } from "../../types";
|
|
4
|
+
export declare type ClientOptions = {
|
|
5
|
+
onlyIfTrusted: boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare type WindowExtended = {
|
|
8
|
+
exodus: {
|
|
9
|
+
algorand: Exodus;
|
|
10
|
+
};
|
|
11
|
+
} & Window & typeof globalThis;
|
|
12
|
+
export declare type Bytes = Readonly<Uint8Array>;
|
|
13
|
+
export declare type Exodus = {
|
|
14
|
+
isConnected: boolean;
|
|
15
|
+
address: string | null;
|
|
16
|
+
connect: ({ onlyIfTrusted }: {
|
|
17
|
+
onlyIfTrusted: boolean;
|
|
18
|
+
}) => Promise<{
|
|
19
|
+
address: string;
|
|
20
|
+
}>;
|
|
21
|
+
disconnect: () => void;
|
|
22
|
+
signAndSendTransaction(transactions: Bytes[]): Promise<{
|
|
23
|
+
txId: string;
|
|
24
|
+
}>;
|
|
25
|
+
signTransaction(transactions: Bytes[]): Promise<Bytes[]>;
|
|
26
|
+
};
|
|
27
|
+
export declare type ExodusClientConstructor = {
|
|
28
|
+
client: Exodus;
|
|
29
|
+
id: PROVIDER_ID;
|
|
30
|
+
algosdk: typeof _algosdk;
|
|
31
|
+
algodClient: _algosdk.Algodv2;
|
|
32
|
+
onlyIfTrusted: boolean;
|
|
33
|
+
network: Network;
|
|
34
|
+
};
|
|
35
|
+
export declare type InitParams = {
|
|
36
|
+
clientOptions?: ClientOptions;
|
|
37
|
+
algodOptions?: AlgodClientOptions;
|
|
38
|
+
algosdkStatic?: typeof _algosdk;
|
|
39
|
+
network?: Network;
|
|
40
|
+
};
|
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"MyAlgo Wallet": Promise<void | myAlgoWalletClient>;
|
|
12
|
-
"Algo Signer": Promise<void | algoSignerClient>;
|
|
13
|
-
Defly: Promise<void | deflyClient>;
|
|
14
|
-
Exodus: Promise<void | exodusClient>;
|
|
15
|
-
"Wallet Connect": Promise<void | walletconnectClient>;
|
|
1
|
+
import pera from "./pera";
|
|
2
|
+
import myalgo from "./myalgo";
|
|
3
|
+
import defly from "./defly";
|
|
4
|
+
import exodus from "./exodus";
|
|
5
|
+
import algosigner from "./algosigner";
|
|
6
|
+
import walletconnect from "./walletconnect";
|
|
7
|
+
import kmd from "./kmd";
|
|
8
|
+
export { pera, myalgo, defly, exodus, algosigner, walletconnect, kmd };
|
|
9
|
+
declare const _default: {
|
|
10
|
+
[x: string]: typeof pera | typeof myalgo | typeof defly | typeof exodus | typeof algosigner | typeof walletconnect | typeof kmd;
|
|
16
11
|
};
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import BaseWallet from "../base";
|
|
2
|
+
import { PROVIDER_ID } from "../../constants";
|
|
3
|
+
import type { Account, Wallet, TransactionsArray, Network } from "../../types";
|
|
4
|
+
import { InitParams, KMDWalletClientConstructor } from "./types";
|
|
5
|
+
declare class KMDWalletClient extends BaseWallet {
|
|
6
|
+
#private;
|
|
7
|
+
walletId: string;
|
|
8
|
+
id: PROVIDER_ID;
|
|
9
|
+
network: Network;
|
|
10
|
+
constructor({ client, id, wallet, password, algosdk, algodClient, network, }: KMDWalletClientConstructor);
|
|
11
|
+
static metadata: {
|
|
12
|
+
id: PROVIDER_ID;
|
|
13
|
+
name: string;
|
|
14
|
+
icon: string;
|
|
15
|
+
isWalletConnect: boolean;
|
|
16
|
+
};
|
|
17
|
+
static init({ clientOptions, algodOptions, algosdkStatic, network, }: InitParams): Promise<KMDWalletClient | null>;
|
|
18
|
+
connect(): Promise<Wallet>;
|
|
19
|
+
disconnect(): Promise<void>;
|
|
20
|
+
reconnect(): Promise<Wallet | null>;
|
|
21
|
+
requestPassword(): Promise<string>;
|
|
22
|
+
getWalletToken(walletId: string, password: string): Promise<string>;
|
|
23
|
+
releaseToken(token: string): Promise<void>;
|
|
24
|
+
listWallets(): Promise<Record<string, string>>;
|
|
25
|
+
listAccounts(wallet: string, password: string): Promise<Array<Account>>;
|
|
26
|
+
signTransactions(connectedAccounts: string[], transactions: Uint8Array[]): Promise<Uint8Array[]>;
|
|
27
|
+
signEncodedTransactions(transactions: TransactionsArray): Promise<Uint8Array[]>;
|
|
28
|
+
}
|
|
29
|
+
export default KMDWalletClient;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ICON: string;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type _algosdk from "algosdk";
|
|
2
|
+
import type { AlgodClientOptions, Network } from "../../types";
|
|
3
|
+
import { PROVIDER_ID } from "../../constants";
|
|
4
|
+
export declare type ClientOptions = {
|
|
5
|
+
wallet: string;
|
|
6
|
+
password: string;
|
|
7
|
+
host: string;
|
|
8
|
+
token: string;
|
|
9
|
+
port: string;
|
|
10
|
+
};
|
|
11
|
+
export interface ListWalletResponse {
|
|
12
|
+
id: string;
|
|
13
|
+
name: string;
|
|
14
|
+
driver_name?: string;
|
|
15
|
+
driver_version?: number;
|
|
16
|
+
mnemonic_ux?: boolean;
|
|
17
|
+
supported_txs?: Array<any>;
|
|
18
|
+
}
|
|
19
|
+
export interface InitWalletHandle {
|
|
20
|
+
wallet_handle_token: string;
|
|
21
|
+
message?: string;
|
|
22
|
+
error?: boolean;
|
|
23
|
+
}
|
|
24
|
+
export declare type KMDWalletClientConstructor = {
|
|
25
|
+
client: _algosdk.Kmd;
|
|
26
|
+
id: PROVIDER_ID;
|
|
27
|
+
algosdk: typeof _algosdk;
|
|
28
|
+
algodClient: _algosdk.Algodv2;
|
|
29
|
+
wallet: string;
|
|
30
|
+
password: string;
|
|
31
|
+
network: Network;
|
|
32
|
+
};
|
|
33
|
+
export declare type InitParams = {
|
|
34
|
+
clientOptions?: ClientOptions;
|
|
35
|
+
algodOptions?: AlgodClientOptions;
|
|
36
|
+
algosdkStatic?: typeof _algosdk;
|
|
37
|
+
network?: Network;
|
|
38
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helpful resources:
|
|
3
|
+
* https://github.com/randlabs/myalgo-connect
|
|
4
|
+
*/
|
|
5
|
+
import BaseWallet from "../base";
|
|
6
|
+
import { PROVIDER_ID } from "../../constants";
|
|
7
|
+
import { TransactionsArray, Network } from "../../types";
|
|
8
|
+
import { MyAlgoWalletClientConstructor, InitParams } from "./types";
|
|
9
|
+
declare class MyAlgoWalletClient extends BaseWallet {
|
|
10
|
+
#private;
|
|
11
|
+
network: Network;
|
|
12
|
+
constructor({ client, algosdk, algodClient, network, }: MyAlgoWalletClientConstructor);
|
|
13
|
+
static metadata: {
|
|
14
|
+
id: PROVIDER_ID;
|
|
15
|
+
name: string;
|
|
16
|
+
icon: string;
|
|
17
|
+
isWalletConnect: boolean;
|
|
18
|
+
};
|
|
19
|
+
static init({ clientOptions, algodOptions, clientStatic, algosdkStatic, network, }: InitParams): Promise<MyAlgoWalletClient | null>;
|
|
20
|
+
connect(): Promise<{
|
|
21
|
+
accounts: {
|
|
22
|
+
providerId: PROVIDER_ID;
|
|
23
|
+
address: string;
|
|
24
|
+
name: string;
|
|
25
|
+
}[];
|
|
26
|
+
id: PROVIDER_ID;
|
|
27
|
+
name: string;
|
|
28
|
+
icon: string;
|
|
29
|
+
isWalletConnect: boolean;
|
|
30
|
+
}>;
|
|
31
|
+
reconnect(): Promise<null>;
|
|
32
|
+
disconnect(): Promise<void>;
|
|
33
|
+
signTransactions(connectedAccounts: string[], transactions: Uint8Array[]): Promise<Uint8Array[]>;
|
|
34
|
+
/** @deprecated */
|
|
35
|
+
signEncodedTransactions(transactions: TransactionsArray): Promise<Uint8Array[]>;
|
|
36
|
+
}
|
|
37
|
+
export default MyAlgoWalletClient;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ICON: string;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helpful resources:
|
|
3
|
+
* https://github.com/randlabs/myalgo-connect
|
|
4
|
+
*/
|
|
5
|
+
import type _MyAlgoConnect from "@randlabs/myalgo-connect";
|
|
6
|
+
import type _algosdk from "algosdk";
|
|
7
|
+
import { AlgodClientOptions, Network } from "../../types";
|
|
8
|
+
export declare type MyAlgoWalletClientConstructor = {
|
|
9
|
+
client: _MyAlgoConnect;
|
|
10
|
+
algosdk: typeof _algosdk;
|
|
11
|
+
algodClient: _algosdk.Algodv2;
|
|
12
|
+
network: Network;
|
|
13
|
+
};
|
|
14
|
+
export declare type ClientOptions = {
|
|
15
|
+
disableLedgerNano: boolean;
|
|
16
|
+
};
|
|
17
|
+
export declare type InitParams = {
|
|
18
|
+
clientOptions?: ClientOptions;
|
|
19
|
+
algodOptions?: AlgodClientOptions;
|
|
20
|
+
clientStatic?: typeof _MyAlgoConnect;
|
|
21
|
+
algosdkStatic?: typeof _algosdk;
|
|
22
|
+
network?: Network;
|
|
23
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Wallet, TransactionsArray, Network } from "../../types";
|
|
2
|
+
import { PROVIDER_ID } from "../../constants";
|
|
3
|
+
import BaseWallet from "../base";
|
|
4
|
+
import { PeraTransaction, PeraWalletClientConstructor, InitParams } from "./types";
|
|
5
|
+
declare class PeraWalletClient extends BaseWallet {
|
|
6
|
+
#private;
|
|
7
|
+
network: Network;
|
|
8
|
+
constructor({ client, algosdk, algodClient, network, }: PeraWalletClientConstructor);
|
|
9
|
+
static metadata: {
|
|
10
|
+
id: PROVIDER_ID;
|
|
11
|
+
name: string;
|
|
12
|
+
icon: string;
|
|
13
|
+
isWalletConnect: boolean;
|
|
14
|
+
};
|
|
15
|
+
static init({ clientOptions, algodOptions, clientStatic, algosdkStatic, network, }: InitParams): Promise<PeraWalletClient | null>;
|
|
16
|
+
connect(onDisconnect: () => void): Promise<Wallet>;
|
|
17
|
+
reconnect(onDisconnect: () => void): Promise<{
|
|
18
|
+
accounts: {
|
|
19
|
+
name: string;
|
|
20
|
+
address: string;
|
|
21
|
+
providerId: PROVIDER_ID;
|
|
22
|
+
}[];
|
|
23
|
+
id: PROVIDER_ID;
|
|
24
|
+
name: string;
|
|
25
|
+
icon: string;
|
|
26
|
+
isWalletConnect: boolean;
|
|
27
|
+
} | null>;
|
|
28
|
+
disconnect(): Promise<void>;
|
|
29
|
+
signTransactions(connectedAccounts: string[], transactions: Uint8Array[]): Promise<Uint8Array[]>;
|
|
30
|
+
/** @deprecated */
|
|
31
|
+
formatTransactionsArray(transactions: TransactionsArray): PeraTransaction[];
|
|
32
|
+
/** @deprecated */
|
|
33
|
+
signEncodedTransactions(transactions: TransactionsArray): Promise<Uint8Array[]>;
|
|
34
|
+
}
|
|
35
|
+
export default PeraWalletClient;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ICON: string;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type _algosdk from "algosdk";
|
|
2
|
+
import type { PeraWalletConnect } from "@perawallet/connect";
|
|
3
|
+
import type { Transaction } from "algosdk";
|
|
4
|
+
import type { AlgodClientOptions, Network } from "../../types";
|
|
5
|
+
export declare type ClientOptions = {
|
|
6
|
+
bridge?: string;
|
|
7
|
+
deep_link?: string;
|
|
8
|
+
app_meta?: {
|
|
9
|
+
logo: string;
|
|
10
|
+
name: string;
|
|
11
|
+
main_color: string;
|
|
12
|
+
};
|
|
13
|
+
shouldShowSignTxnToast?: boolean;
|
|
14
|
+
};
|
|
15
|
+
export interface PeraTransaction {
|
|
16
|
+
txn: Transaction;
|
|
17
|
+
/**
|
|
18
|
+
* Optional list of addresses that must sign the transactions.
|
|
19
|
+
* Wallet skips to sign this txn if signers is empty array.
|
|
20
|
+
* If undefined, wallet tries to sign it.
|
|
21
|
+
*/
|
|
22
|
+
signers?: string[];
|
|
23
|
+
}
|
|
24
|
+
export declare type PeraWalletClientConstructor = {
|
|
25
|
+
client: PeraWalletConnect;
|
|
26
|
+
algosdk: typeof _algosdk;
|
|
27
|
+
algodClient: _algosdk.Algodv2;
|
|
28
|
+
network: Network;
|
|
29
|
+
};
|
|
30
|
+
export declare type InitParams = {
|
|
31
|
+
clientOptions?: ClientOptions;
|
|
32
|
+
algodOptions?: AlgodClientOptions;
|
|
33
|
+
clientStatic?: typeof PeraWalletConnect;
|
|
34
|
+
algosdkStatic?: typeof _algosdk;
|
|
35
|
+
network?: Network;
|
|
36
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { Wallet } from "../../types";
|
|
2
|
+
import { PROVIDER_ID } from "../../constants";
|
|
3
|
+
import BaseWallet from "../base";
|
|
4
|
+
import { TransactionsArray, Network } from "../../types";
|
|
5
|
+
import { WalletConnectClientConstructor, InitParams, WalletConnectTransaction } from "./types";
|
|
6
|
+
declare class WalletConnectClient extends BaseWallet {
|
|
7
|
+
#private;
|
|
8
|
+
network: Network;
|
|
9
|
+
constructor({ client, algosdk, algodClient, network, }: WalletConnectClientConstructor);
|
|
10
|
+
static metadata: {
|
|
11
|
+
id: PROVIDER_ID;
|
|
12
|
+
name: string;
|
|
13
|
+
icon: string;
|
|
14
|
+
isWalletConnect: boolean;
|
|
15
|
+
};
|
|
16
|
+
static init({ clientOptions, algodOptions, clientStatic, modalStatic, algosdkStatic, network, }: InitParams): Promise<WalletConnectClient | null>;
|
|
17
|
+
connect(): Promise<Wallet>;
|
|
18
|
+
reconnect(): Promise<{
|
|
19
|
+
accounts: {
|
|
20
|
+
name: string;
|
|
21
|
+
address: string;
|
|
22
|
+
providerId: PROVIDER_ID;
|
|
23
|
+
}[];
|
|
24
|
+
id: PROVIDER_ID;
|
|
25
|
+
name: string;
|
|
26
|
+
icon: string;
|
|
27
|
+
isWalletConnect: boolean;
|
|
28
|
+
} | null>;
|
|
29
|
+
check(): boolean;
|
|
30
|
+
disconnect(): Promise<void>;
|
|
31
|
+
signTransactions(connectedAccounts: string[], transactions: Uint8Array[]): Promise<Uint8Array[]>;
|
|
32
|
+
/** @deprecarted */
|
|
33
|
+
formatTransactionsArray(transactions: TransactionsArray): WalletConnectTransaction[];
|
|
34
|
+
/** @deprecated */
|
|
35
|
+
signEncodedTransactions(transactions: TransactionsArray): Promise<Uint8Array[]>;
|
|
36
|
+
}
|
|
37
|
+
export default WalletConnectClient;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type _algosdk from "algosdk";
|
|
2
|
+
import type WalletConnect from "@walletconnect/client";
|
|
3
|
+
import QRCodeModal from "algorand-walletconnect-qrcode-modal";
|
|
4
|
+
import type { AlgodClientOptions, Network } from "../../types";
|
|
5
|
+
export interface IClientMeta {
|
|
6
|
+
description: string;
|
|
7
|
+
url: string;
|
|
8
|
+
icons: string[];
|
|
9
|
+
name: string;
|
|
10
|
+
}
|
|
11
|
+
export interface IWalletConnectSession {
|
|
12
|
+
connected: boolean;
|
|
13
|
+
accounts: string[];
|
|
14
|
+
chainId: number;
|
|
15
|
+
bridge: string;
|
|
16
|
+
key: string;
|
|
17
|
+
clientId: string;
|
|
18
|
+
clientMeta: IClientMeta | null;
|
|
19
|
+
peerId: string;
|
|
20
|
+
peerMeta: IClientMeta | null;
|
|
21
|
+
handshakeId: number;
|
|
22
|
+
handshakeTopic: string;
|
|
23
|
+
qrcodeModal: {
|
|
24
|
+
open: (uri: string, cb: any, qrcodeModalOptions?: any) => void;
|
|
25
|
+
close: () => void;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export declare type ClientOptions = {
|
|
29
|
+
bridge?: string;
|
|
30
|
+
uri?: string;
|
|
31
|
+
storageId?: string;
|
|
32
|
+
signingMethods?: string[];
|
|
33
|
+
session?: IWalletConnectSession;
|
|
34
|
+
clientMeta?: IClientMeta;
|
|
35
|
+
};
|
|
36
|
+
export declare type WalletConnectTransaction = {
|
|
37
|
+
txn: string;
|
|
38
|
+
message?: string;
|
|
39
|
+
signers?: string[] | [];
|
|
40
|
+
};
|
|
41
|
+
export declare type InitParams = {
|
|
42
|
+
clientOptions?: ClientOptions;
|
|
43
|
+
algodOptions?: AlgodClientOptions;
|
|
44
|
+
clientStatic?: typeof WalletConnect;
|
|
45
|
+
modalStatic?: typeof QRCodeModal;
|
|
46
|
+
algosdkStatic?: typeof _algosdk;
|
|
47
|
+
network?: Network;
|
|
48
|
+
};
|
|
49
|
+
export declare type WalletConnectClientConstructor = {
|
|
50
|
+
client: WalletConnect;
|
|
51
|
+
algosdk: typeof _algosdk;
|
|
52
|
+
algodClient: _algosdk.Algodv2;
|
|
53
|
+
network: Network;
|
|
54
|
+
};
|
|
@@ -1,18 +1,14 @@
|
|
|
1
|
+
import { Network } from "../types";
|
|
1
2
|
export declare enum PROVIDER_ID {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
DEFLY = "
|
|
7
|
-
EXODUS = "
|
|
8
|
-
|
|
3
|
+
KMD = "kmd",
|
|
4
|
+
PERA = "pera",
|
|
5
|
+
MYALGO = "myalgo",
|
|
6
|
+
ALGOSIGNER = "algosigner",
|
|
7
|
+
DEFLY = "defly",
|
|
8
|
+
EXODUS = "exodus",
|
|
9
|
+
WALLETCONNECT = "walletconnect"
|
|
9
10
|
}
|
|
10
|
-
export declare const
|
|
11
|
-
export declare const
|
|
12
|
-
export declare const
|
|
13
|
-
export declare const
|
|
14
|
-
export declare const KMD_HOST: string;
|
|
15
|
-
export declare const KMD_TOKEN: string;
|
|
16
|
-
export declare const KMD_PORT: string;
|
|
17
|
-
export declare const KMD_WALLET: string;
|
|
18
|
-
export declare const KMD_PASSWORD: string;
|
|
11
|
+
export declare const DEFAULT_NETWORK: Network;
|
|
12
|
+
export declare const DEFAULT_NODE_BASEURL = "https://mainnet-api.algonode.cloud";
|
|
13
|
+
export declare const DEFAULT_NODE_TOKEN = "";
|
|
14
|
+
export declare const DEFAULT_NODE_PORT = "";
|