@txnlab/use-wallet 2.0.0-alpha.5 → 2.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 +35 -29
- package/dist/cjs/index.js +597 -269
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/jest.config.d.ts +1 -1
- package/dist/cjs/src/clients/algosigner/client.d.ts +4 -3
- package/dist/cjs/src/clients/algosigner/types.d.ts +12 -12
- package/dist/cjs/src/clients/base/base.d.ts +4 -3
- package/dist/cjs/src/clients/daffi/client.d.ts +6 -4
- package/dist/cjs/src/clients/daffi/types.d.ts +7 -10
- package/dist/cjs/src/clients/defly/client.d.ts +6 -5
- package/dist/cjs/src/clients/defly/types.d.ts +8 -11
- package/dist/cjs/src/clients/exodus/client.d.ts +4 -3
- package/dist/cjs/src/clients/exodus/types.d.ts +10 -12
- package/dist/cjs/src/clients/kmd/client.d.ts +5 -3
- package/dist/cjs/src/clients/kmd/types.d.ts +8 -10
- package/dist/cjs/src/clients/mnemonic/client.d.ts +5 -3
- package/dist/cjs/src/clients/mnemonic/types.d.ts +7 -7
- package/dist/cjs/src/clients/myalgo/client.d.ts +4 -7
- package/dist/cjs/src/clients/myalgo/types.d.ts +7 -10
- package/dist/cjs/src/clients/pera/client.d.ts +6 -4
- package/dist/cjs/src/clients/pera/types.d.ts +7 -10
- package/dist/cjs/src/clients/walletconnect2/client.d.ts +7 -5
- package/dist/cjs/src/clients/walletconnect2/constants.d.ts +0 -1
- package/dist/cjs/src/clients/walletconnect2/types.d.ts +8 -11
- package/dist/cjs/src/constants/constants.d.ts +1 -1
- package/dist/cjs/src/hooks/useInitializeProviders.d.ts +1 -1
- package/dist/cjs/src/index.d.ts +1 -1
- package/dist/cjs/src/store/state/debugStore.d.ts +1 -1
- package/dist/cjs/src/store/state/walletStore.d.ts +3 -3
- package/dist/cjs/src/testUtils/mockClients.d.ts +1 -1
- package/dist/cjs/src/types/api.d.ts +3 -3
- package/dist/cjs/src/types/node.d.ts +8 -8
- package/dist/cjs/src/types/providers.d.ts +27 -15
- package/dist/cjs/src/types/utilities.d.ts +1 -1
- package/dist/cjs/src/types/wallet.d.ts +9 -12
- package/dist/cjs/src/utils/encodeNFDTransactionsArray.d.ts +1 -1
- package/dist/cjs/src/utils/reconnectProviders.d.ts +1 -1
- package/dist/esm/index.js +597 -269
- package/dist/esm/jest.config.d.ts +1 -1
- package/dist/esm/src/clients/algosigner/client.d.ts +4 -3
- package/dist/esm/src/clients/algosigner/types.d.ts +12 -12
- package/dist/esm/src/clients/base/base.d.ts +4 -3
- package/dist/esm/src/clients/daffi/client.d.ts +6 -4
- package/dist/esm/src/clients/daffi/types.d.ts +7 -10
- package/dist/esm/src/clients/defly/client.d.ts +6 -5
- package/dist/esm/src/clients/defly/types.d.ts +8 -11
- package/dist/esm/src/clients/exodus/client.d.ts +4 -3
- package/dist/esm/src/clients/exodus/types.d.ts +10 -12
- package/dist/esm/src/clients/kmd/client.d.ts +5 -3
- package/dist/esm/src/clients/kmd/types.d.ts +8 -10
- package/dist/esm/src/clients/mnemonic/client.d.ts +5 -3
- package/dist/esm/src/clients/mnemonic/types.d.ts +7 -7
- package/dist/esm/src/clients/myalgo/client.d.ts +4 -7
- package/dist/esm/src/clients/myalgo/types.d.ts +7 -10
- package/dist/esm/src/clients/pera/client.d.ts +6 -4
- package/dist/esm/src/clients/pera/types.d.ts +7 -10
- package/dist/esm/src/clients/walletconnect2/client.d.ts +7 -5
- package/dist/esm/src/clients/walletconnect2/constants.d.ts +0 -1
- package/dist/esm/src/clients/walletconnect2/types.d.ts +8 -11
- package/dist/esm/src/constants/constants.d.ts +1 -1
- package/dist/esm/src/hooks/useInitializeProviders.d.ts +1 -1
- package/dist/esm/src/index.d.ts +1 -1
- package/dist/esm/src/store/state/debugStore.d.ts +1 -1
- package/dist/esm/src/store/state/walletStore.d.ts +3 -3
- package/dist/esm/src/testUtils/mockClients.d.ts +1 -1
- package/dist/esm/src/types/api.d.ts +3 -3
- package/dist/esm/src/types/node.d.ts +8 -8
- package/dist/esm/src/types/providers.d.ts +27 -15
- package/dist/esm/src/types/utilities.d.ts +1 -1
- package/dist/esm/src/types/wallet.d.ts +9 -12
- package/dist/esm/src/utils/encodeNFDTransactionsArray.d.ts +1 -1
- package/dist/esm/src/utils/reconnectProviders.d.ts +1 -1
- package/dist/index.d.ts +180 -200
- package/package.json +16 -20
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import BaseClient from '../base';
|
|
2
2
|
import { PROVIDER_ID } from '../../constants';
|
|
3
|
-
import type { Network } from '../../types';
|
|
4
|
-
import type { AlgoSignerClientConstructor, InitParams } from './types';
|
|
5
3
|
import { useWalletStore } from '../../store';
|
|
4
|
+
import type { Network } from '../../types/node';
|
|
5
|
+
import type { InitParams } from '../../types/providers';
|
|
6
|
+
import type { AlgoSignerClientConstructor } from './types';
|
|
6
7
|
declare class AlgoSignerClient extends BaseClient {
|
|
7
8
|
#private;
|
|
8
9
|
network: Network;
|
|
@@ -14,7 +15,7 @@ declare class AlgoSignerClient extends BaseClient {
|
|
|
14
15
|
icon: string;
|
|
15
16
|
isWalletConnect: boolean;
|
|
16
17
|
};
|
|
17
|
-
static init({ algodOptions, algosdkStatic, network }: InitParams): Promise<BaseClient | null>;
|
|
18
|
+
static init({ algodOptions, algosdkStatic, network }: InitParams<PROVIDER_ID.ALGOSIGNER>): Promise<BaseClient | null>;
|
|
18
19
|
connect(): Promise<{
|
|
19
20
|
accounts: {
|
|
20
21
|
authAddr?: string | undefined;
|
|
@@ -1,27 +1,28 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type { Network
|
|
3
|
-
|
|
1
|
+
import type algosdk from 'algosdk';
|
|
2
|
+
import type { Network } from '../../types/node';
|
|
3
|
+
import type { Metadata } from '../../types/wallet';
|
|
4
|
+
export type WindowExtended = {
|
|
4
5
|
algorand: AlgoSigner;
|
|
5
6
|
} & Window & typeof globalThis;
|
|
6
|
-
export
|
|
7
|
-
export
|
|
7
|
+
export type GenesisId = 'betanet-v1.0' | 'testnet-v1.0' | 'mainnet-v1.0' | string;
|
|
8
|
+
export type EnableParams = {
|
|
8
9
|
genesisID?: GenesisId;
|
|
9
10
|
genesisHash?: string;
|
|
10
11
|
accounts?: string[];
|
|
11
12
|
};
|
|
12
|
-
export
|
|
13
|
+
export type EnableResponse = {
|
|
13
14
|
genesisID: GenesisId;
|
|
14
15
|
genesisHash: string;
|
|
15
16
|
accounts: string[];
|
|
16
17
|
};
|
|
17
|
-
export
|
|
18
|
+
export type AlgoSignerTransaction = {
|
|
18
19
|
txn: string;
|
|
19
20
|
signers?: string[];
|
|
20
21
|
stxn?: string;
|
|
21
22
|
multisig?: string;
|
|
22
23
|
authAddr?: string;
|
|
23
24
|
};
|
|
24
|
-
export
|
|
25
|
+
export type AlgoSigner = {
|
|
25
26
|
enable: (params?: EnableParams) => Promise<EnableResponse>;
|
|
26
27
|
signTxns: (transactions: AlgoSignerTransaction[]) => Promise<string[]>;
|
|
27
28
|
encoding: {
|
|
@@ -29,11 +30,10 @@ export declare type AlgoSigner = {
|
|
|
29
30
|
byteArrayToString(transaction: Uint8Array): string;
|
|
30
31
|
};
|
|
31
32
|
};
|
|
32
|
-
export
|
|
33
|
+
export type AlgoSignerClientConstructor = {
|
|
33
34
|
metadata: Metadata;
|
|
34
35
|
client: AlgoSigner;
|
|
35
|
-
algosdk: typeof
|
|
36
|
-
algodClient:
|
|
36
|
+
algosdk: typeof algosdk;
|
|
37
|
+
algodClient: algosdk.Algodv2;
|
|
37
38
|
network: Network;
|
|
38
39
|
};
|
|
39
|
-
export declare type InitParams = CommonInitParams;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type _algosdk from 'algosdk';
|
|
2
|
-
import type {
|
|
2
|
+
import type { AccountInfo, Asset, ClientOptions, Metadata, Wallet } from '../../types/wallet';
|
|
3
|
+
import type { TransactionsArray, TxnInfo } from '../../types/api';
|
|
3
4
|
declare abstract class BaseClient {
|
|
4
5
|
algosdk: typeof _algosdk;
|
|
5
6
|
algodClient: _algosdk.Algodv2;
|
|
@@ -21,7 +22,7 @@ declare abstract class BaseClient {
|
|
|
21
22
|
'pool-error': string;
|
|
22
23
|
txn: {
|
|
23
24
|
sig: Uint8Array;
|
|
24
|
-
txn: import("../../types").Txn;
|
|
25
|
+
txn: import("../../types/node").Txn;
|
|
25
26
|
};
|
|
26
27
|
txId: string;
|
|
27
28
|
}>;
|
|
@@ -34,7 +35,7 @@ declare abstract class BaseClient {
|
|
|
34
35
|
'pool-error': string;
|
|
35
36
|
txn: {
|
|
36
37
|
sig: Uint8Array;
|
|
37
|
-
txn: import("../../types").Txn;
|
|
38
|
+
txn: import("../../types/node").Txn;
|
|
38
39
|
};
|
|
39
40
|
txId: string;
|
|
40
41
|
id: string;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import type { Wallet, Network } from '../../types';
|
|
2
|
-
import { PROVIDER_ID } from '../../constants';
|
|
3
1
|
import BaseClient from '../base';
|
|
4
|
-
import {
|
|
2
|
+
import { PROVIDER_ID } from '../../constants';
|
|
3
|
+
import type { Network } from '../../types/node';
|
|
4
|
+
import type { InitParams } from '../../types/providers';
|
|
5
|
+
import type { Wallet } from '../../types/wallet';
|
|
6
|
+
import type { DaffiWalletClientConstructor, DaffiWalletConnectOptions } from './types';
|
|
5
7
|
declare class DaffiWalletClient extends BaseClient {
|
|
6
8
|
#private;
|
|
7
9
|
clientOptions?: DaffiWalletConnectOptions;
|
|
@@ -13,7 +15,7 @@ declare class DaffiWalletClient extends BaseClient {
|
|
|
13
15
|
icon: string;
|
|
14
16
|
isWalletConnect: boolean;
|
|
15
17
|
};
|
|
16
|
-
static init({ clientOptions, algodOptions, clientStatic, algosdkStatic, network }: InitParams): Promise<DaffiWalletClient | null>;
|
|
18
|
+
static init({ clientOptions, algodOptions, clientStatic, algosdkStatic, network }: InitParams<PROVIDER_ID.DAFFI>): Promise<DaffiWalletClient | null>;
|
|
17
19
|
connect(onDisconnect: () => void): Promise<Wallet>;
|
|
18
20
|
reconnect(onDisconnect: () => void): Promise<{
|
|
19
21
|
accounts: {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type algosdk from 'algosdk';
|
|
2
2
|
import type { DaffiWalletConnect } from '@daffiwallet/connect';
|
|
3
3
|
import type { Transaction } from 'algosdk';
|
|
4
|
-
import type { Network
|
|
5
|
-
|
|
4
|
+
import type { Network } from '../../types/node';
|
|
5
|
+
import type { Metadata } from '../../types/wallet';
|
|
6
|
+
export type DaffiWalletConnectOptions = {
|
|
6
7
|
bridge?: string;
|
|
7
8
|
shouldShowSignTxnToast?: boolean;
|
|
8
9
|
chainId?: 416001 | 416002 | 416003 | 4160;
|
|
@@ -16,15 +17,11 @@ export interface DaffiTransaction {
|
|
|
16
17
|
*/
|
|
17
18
|
signers?: string[];
|
|
18
19
|
}
|
|
19
|
-
export
|
|
20
|
+
export type DaffiWalletClientConstructor = {
|
|
20
21
|
metadata: Metadata;
|
|
21
22
|
client: DaffiWalletConnect;
|
|
22
23
|
clientOptions?: DaffiWalletConnectOptions;
|
|
23
|
-
algosdk: typeof
|
|
24
|
-
algodClient:
|
|
24
|
+
algosdk: typeof algosdk;
|
|
25
|
+
algodClient: algosdk.Algodv2;
|
|
25
26
|
network: Network;
|
|
26
27
|
};
|
|
27
|
-
export declare type InitParams = CommonInitParams & {
|
|
28
|
-
clientOptions?: DaffiWalletConnectOptions;
|
|
29
|
-
clientStatic?: typeof DaffiWalletConnect;
|
|
30
|
-
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type { Wallet } from '../../types';
|
|
2
|
-
import { PROVIDER_ID } from '../../constants';
|
|
3
1
|
import BaseClient from '../base';
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
2
|
+
import { PROVIDER_ID } from '../../constants';
|
|
3
|
+
import type { Network } from '../../types/node';
|
|
4
|
+
import type { InitParams } from '../../types/providers';
|
|
5
|
+
import type { Wallet } from '../../types/wallet';
|
|
6
|
+
import type { DeflyWalletClientConstructor, DeflyWalletConnectOptions } from './types';
|
|
6
7
|
declare class DeflyWalletClient extends BaseClient {
|
|
7
8
|
#private;
|
|
8
9
|
clientOptions?: DeflyWalletConnectOptions;
|
|
@@ -14,7 +15,7 @@ declare class DeflyWalletClient extends BaseClient {
|
|
|
14
15
|
icon: string;
|
|
15
16
|
isWalletConnect: boolean;
|
|
16
17
|
};
|
|
17
|
-
static init({ clientOptions, algodOptions, clientStatic, algosdkStatic, network }: InitParams): Promise<BaseClient | null>;
|
|
18
|
+
static init({ clientOptions, algodOptions, clientStatic, algosdkStatic, network }: InitParams<PROVIDER_ID.DEFLY>): Promise<BaseClient | null>;
|
|
18
19
|
connect(onDisconnect: () => void): Promise<Wallet>;
|
|
19
20
|
reconnect(onDisconnect: () => void): Promise<{
|
|
20
21
|
accounts: {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { Transaction } from 'algosdk';
|
|
2
|
-
import type { Network, Metadata, CommonInitParams } from '../../types';
|
|
3
2
|
import type { DeflyWalletConnect } from '@blockshake/defly-connect';
|
|
4
|
-
import type
|
|
5
|
-
|
|
3
|
+
import type algosdk from 'algosdk';
|
|
4
|
+
import type { Network } from '../../types/node';
|
|
5
|
+
import type { Metadata } from '../../types/wallet';
|
|
6
|
+
export type DeflyWalletConnectOptions = {
|
|
6
7
|
bridge?: string;
|
|
7
8
|
deep_link?: string;
|
|
8
9
|
app_meta?: {
|
|
@@ -12,7 +13,7 @@ export declare type DeflyWalletConnectOptions = {
|
|
|
12
13
|
};
|
|
13
14
|
shouldShowSignTxnToast?: boolean;
|
|
14
15
|
};
|
|
15
|
-
export
|
|
16
|
+
export type DeflyTransaction = {
|
|
16
17
|
txn: Transaction;
|
|
17
18
|
/**
|
|
18
19
|
* Optional list of addresses that must sign the transactions.
|
|
@@ -21,15 +22,11 @@ export declare type DeflyTransaction = {
|
|
|
21
22
|
*/
|
|
22
23
|
signers?: string[];
|
|
23
24
|
};
|
|
24
|
-
export
|
|
25
|
+
export type DeflyWalletClientConstructor = {
|
|
25
26
|
metadata: Metadata;
|
|
26
27
|
client: DeflyWalletConnect;
|
|
27
28
|
clientOptions?: DeflyWalletConnectOptions;
|
|
28
|
-
algosdk: typeof
|
|
29
|
-
algodClient:
|
|
29
|
+
algosdk: typeof algosdk;
|
|
30
|
+
algodClient: algosdk.Algodv2;
|
|
30
31
|
network: Network;
|
|
31
32
|
};
|
|
32
|
-
export declare type InitParams = CommonInitParams & {
|
|
33
|
-
clientOptions?: DeflyWalletConnectOptions;
|
|
34
|
-
clientStatic?: typeof DeflyWalletConnect;
|
|
35
|
-
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import BaseClient from '../base';
|
|
2
2
|
import { PROVIDER_ID } from '../../constants';
|
|
3
|
-
import type { Network } from '../../types';
|
|
4
|
-
import { InitParams
|
|
3
|
+
import type { Network } from '../../types/node';
|
|
4
|
+
import type { InitParams } from '../../types/providers';
|
|
5
|
+
import type { ExodusClientConstructor, ExodusOptions } from './types';
|
|
5
6
|
declare class ExodusClient extends BaseClient {
|
|
6
7
|
#private;
|
|
7
8
|
clientOptions: ExodusOptions;
|
|
@@ -13,7 +14,7 @@ declare class ExodusClient extends BaseClient {
|
|
|
13
14
|
icon: string;
|
|
14
15
|
isWalletConnect: boolean;
|
|
15
16
|
};
|
|
16
|
-
static init({ clientOptions, algodOptions, algosdkStatic, network }: InitParams): Promise<BaseClient | null>;
|
|
17
|
+
static init({ clientOptions, algodOptions, algosdkStatic, network }: InitParams<PROVIDER_ID.EXODUS>): Promise<BaseClient | null>;
|
|
17
18
|
connect(): Promise<{
|
|
18
19
|
accounts: {
|
|
19
20
|
name: string;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type { Network
|
|
3
|
-
|
|
1
|
+
import type algosdk from 'algosdk';
|
|
2
|
+
import type { Network } from '../../types/node';
|
|
3
|
+
import type { Metadata } from '../../types/wallet';
|
|
4
|
+
export type ExodusOptions = {
|
|
4
5
|
onlyIfTrusted: boolean;
|
|
5
6
|
};
|
|
6
|
-
export
|
|
7
|
+
export type WindowExtended = {
|
|
7
8
|
exodus: {
|
|
8
9
|
algorand: Exodus;
|
|
9
10
|
};
|
|
10
11
|
} & Window & typeof globalThis;
|
|
11
|
-
export
|
|
12
|
-
export
|
|
12
|
+
export type Bytes = Readonly<Uint8Array>;
|
|
13
|
+
export type Exodus = {
|
|
13
14
|
isConnected: boolean;
|
|
14
15
|
address: string | null;
|
|
15
16
|
connect: ({ onlyIfTrusted }: {
|
|
@@ -23,14 +24,11 @@ export declare type Exodus = {
|
|
|
23
24
|
}>;
|
|
24
25
|
signTransaction(transactions: Bytes[]): Promise<Bytes[]>;
|
|
25
26
|
};
|
|
26
|
-
export
|
|
27
|
+
export type ExodusClientConstructor = {
|
|
27
28
|
metadata: Metadata;
|
|
28
29
|
client: Exodus;
|
|
29
30
|
clientOptions: ExodusOptions;
|
|
30
|
-
algosdk: typeof
|
|
31
|
-
algodClient:
|
|
31
|
+
algosdk: typeof algosdk;
|
|
32
|
+
algodClient: algosdk.Algodv2;
|
|
32
33
|
network: Network;
|
|
33
34
|
};
|
|
34
|
-
export declare type InitParams = CommonInitParams & {
|
|
35
|
-
clientOptions?: ExodusOptions;
|
|
36
|
-
};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import BaseClient from '../base';
|
|
2
2
|
import { PROVIDER_ID } from '../../constants';
|
|
3
|
-
import type {
|
|
4
|
-
import { InitParams
|
|
3
|
+
import type { Network } from '../../types/node';
|
|
4
|
+
import type { InitParams } from '../../types/providers';
|
|
5
|
+
import type { Account, Wallet } from '../../types/wallet';
|
|
6
|
+
import type { KMDWalletClientConstructor } from './types';
|
|
5
7
|
declare class KMDWalletClient extends BaseClient {
|
|
6
8
|
#private;
|
|
7
9
|
walletId: string;
|
|
@@ -13,7 +15,7 @@ declare class KMDWalletClient extends BaseClient {
|
|
|
13
15
|
icon: string;
|
|
14
16
|
isWalletConnect: boolean;
|
|
15
17
|
};
|
|
16
|
-
static init({ clientOptions, algodOptions, algosdkStatic, network }: InitParams): Promise<BaseClient | null>;
|
|
18
|
+
static init({ clientOptions, algodOptions, algosdkStatic, network }: InitParams<PROVIDER_ID.KMD>): Promise<BaseClient | null>;
|
|
17
19
|
connect(): Promise<Wallet>;
|
|
18
20
|
disconnect(): Promise<void>;
|
|
19
21
|
reconnect(): Promise<Wallet | null>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type { Network
|
|
3
|
-
|
|
1
|
+
import type algosdk from 'algosdk';
|
|
2
|
+
import type { Network } from '../../types/node';
|
|
3
|
+
import type { Metadata } from '../../types/wallet';
|
|
4
|
+
export type KmdOptions = {
|
|
4
5
|
wallet: string;
|
|
5
6
|
password: string;
|
|
6
7
|
host: string;
|
|
@@ -20,15 +21,12 @@ export interface InitWalletHandle {
|
|
|
20
21
|
message?: string;
|
|
21
22
|
error?: boolean;
|
|
22
23
|
}
|
|
23
|
-
export
|
|
24
|
+
export type KMDWalletClientConstructor = {
|
|
24
25
|
metadata: Metadata;
|
|
25
|
-
client:
|
|
26
|
-
algosdk: typeof
|
|
27
|
-
algodClient:
|
|
26
|
+
client: algosdk.Kmd;
|
|
27
|
+
algosdk: typeof algosdk;
|
|
28
|
+
algodClient: algosdk.Algodv2;
|
|
28
29
|
wallet: string;
|
|
29
30
|
password: string;
|
|
30
31
|
network: Network;
|
|
31
32
|
};
|
|
32
|
-
export declare type InitParams = CommonInitParams & {
|
|
33
|
-
clientOptions?: KmdOptions;
|
|
34
|
-
};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import BaseClient from '../base';
|
|
2
2
|
import { PROVIDER_ID } from '../../constants';
|
|
3
|
-
import type { TransactionsArray
|
|
4
|
-
import {
|
|
3
|
+
import type { TransactionsArray } from '../../types/api';
|
|
4
|
+
import type { Network } from '../../types/node';
|
|
5
|
+
import type { InitParams } from '../../types/providers';
|
|
6
|
+
import type { MnemonicWalletClientConstructor } from './types';
|
|
5
7
|
declare class MnemonicWalletClient extends BaseClient {
|
|
6
8
|
#private;
|
|
7
9
|
network: Network;
|
|
@@ -12,7 +14,7 @@ declare class MnemonicWalletClient extends BaseClient {
|
|
|
12
14
|
icon: string;
|
|
13
15
|
isWalletConnect: boolean;
|
|
14
16
|
};
|
|
15
|
-
static init({ algodOptions, algosdkStatic, network }: InitParams): Promise<BaseClient | null>;
|
|
17
|
+
static init({ algodOptions, algosdkStatic, network }: InitParams<PROVIDER_ID.MNEMONIC>): Promise<BaseClient | null>;
|
|
16
18
|
connect(): Promise<{
|
|
17
19
|
accounts: {
|
|
18
20
|
name: string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type { Network
|
|
3
|
-
|
|
1
|
+
import type algosdk from 'algosdk';
|
|
2
|
+
import type { Network } from '../../types/node';
|
|
3
|
+
import type { Metadata } from '../../types/wallet';
|
|
4
|
+
export type ClientOptions = {
|
|
4
5
|
wallet: string;
|
|
5
6
|
password: string;
|
|
6
7
|
host: string;
|
|
@@ -12,10 +13,9 @@ export interface InitWalletHandle {
|
|
|
12
13
|
message?: string;
|
|
13
14
|
error?: boolean;
|
|
14
15
|
}
|
|
15
|
-
export
|
|
16
|
+
export type MnemonicWalletClientConstructor = {
|
|
16
17
|
metadata: Metadata;
|
|
17
|
-
algosdk: typeof
|
|
18
|
-
algodClient:
|
|
18
|
+
algosdk: typeof algosdk;
|
|
19
|
+
algodClient: algosdk.Algodv2;
|
|
19
20
|
network: Network;
|
|
20
21
|
};
|
|
21
|
-
export declare type InitParams = CommonInitParams;
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Helpful resources:
|
|
3
|
-
* https://github.com/randlabs/myalgo-connect
|
|
4
|
-
*/
|
|
5
1
|
import BaseClient from '../base';
|
|
6
2
|
import { PROVIDER_ID } from '../../constants';
|
|
7
|
-
import { Network } from '../../types';
|
|
8
|
-
import {
|
|
3
|
+
import type { Network } from '../../types/node';
|
|
4
|
+
import type { InitParams } from '../../types/providers';
|
|
5
|
+
import type { MyAlgoConnectOptions, MyAlgoWalletClientConstructor } from './types';
|
|
9
6
|
declare class MyAlgoWalletClient extends BaseClient {
|
|
10
7
|
#private;
|
|
11
8
|
clientOptions?: MyAlgoConnectOptions;
|
|
@@ -17,7 +14,7 @@ declare class MyAlgoWalletClient extends BaseClient {
|
|
|
17
14
|
icon: string;
|
|
18
15
|
isWalletConnect: boolean;
|
|
19
16
|
};
|
|
20
|
-
static init({ clientOptions, algodOptions, clientStatic, algosdkStatic, network }: InitParams): Promise<BaseClient | null>;
|
|
17
|
+
static init({ clientOptions, algodOptions, clientStatic, algosdkStatic, network }: InitParams<PROVIDER_ID.MYALGO>): Promise<BaseClient | null>;
|
|
21
18
|
connect(): Promise<{
|
|
22
19
|
accounts: {
|
|
23
20
|
providerId: PROVIDER_ID;
|
|
@@ -3,20 +3,17 @@
|
|
|
3
3
|
* https://github.com/randlabs/myalgo-connect
|
|
4
4
|
*/
|
|
5
5
|
import type MyAlgoConnect from '@randlabs/myalgo-connect';
|
|
6
|
-
import type
|
|
7
|
-
import { Network
|
|
8
|
-
|
|
6
|
+
import type algosdk from 'algosdk';
|
|
7
|
+
import type { Network } from '../../types/node';
|
|
8
|
+
import type { Metadata } from '../../types/wallet';
|
|
9
|
+
export type MyAlgoConnectOptions = {
|
|
9
10
|
disableLedgerNano: boolean;
|
|
10
11
|
};
|
|
11
|
-
export
|
|
12
|
+
export type MyAlgoWalletClientConstructor = {
|
|
12
13
|
metadata: Metadata;
|
|
13
14
|
client: MyAlgoConnect;
|
|
14
15
|
clientOptions?: MyAlgoConnectOptions;
|
|
15
|
-
algosdk: typeof
|
|
16
|
-
algodClient:
|
|
16
|
+
algosdk: typeof algosdk;
|
|
17
|
+
algodClient: algosdk.Algodv2;
|
|
17
18
|
network: Network;
|
|
18
19
|
};
|
|
19
|
-
export declare type InitParams = CommonInitParams & {
|
|
20
|
-
clientOptions?: MyAlgoConnectOptions;
|
|
21
|
-
clientStatic?: typeof MyAlgoConnect;
|
|
22
|
-
};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import type { Wallet, Network } from '../../types';
|
|
2
|
-
import { PROVIDER_ID } from '../../constants';
|
|
3
1
|
import BaseClient from '../base';
|
|
4
|
-
import {
|
|
2
|
+
import { PROVIDER_ID } from '../../constants';
|
|
3
|
+
import type { Network } from '../../types/node';
|
|
4
|
+
import type { InitParams } from '../../types/providers';
|
|
5
|
+
import type { Wallet } from '../../types/wallet';
|
|
6
|
+
import type { PeraWalletClientConstructor, PeraWalletConnectOptions } from './types';
|
|
5
7
|
declare class PeraWalletClient extends BaseClient {
|
|
6
8
|
#private;
|
|
7
9
|
clientOptions?: PeraWalletConnectOptions;
|
|
@@ -13,7 +15,7 @@ declare class PeraWalletClient extends BaseClient {
|
|
|
13
15
|
icon: string;
|
|
14
16
|
isWalletConnect: boolean;
|
|
15
17
|
};
|
|
16
|
-
static init({ clientOptions, algodOptions, clientStatic, algosdkStatic, network }: InitParams): Promise<BaseClient | null>;
|
|
18
|
+
static init({ clientOptions, algodOptions, clientStatic, algosdkStatic, network }: InitParams<PROVIDER_ID.PERA>): Promise<BaseClient | null>;
|
|
17
19
|
connect(onDisconnect: () => void): Promise<Wallet>;
|
|
18
20
|
reconnect(onDisconnect: () => void): Promise<{
|
|
19
21
|
accounts: {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type algosdk from 'algosdk';
|
|
2
2
|
import type { PeraWalletConnect } from '@perawallet/connect';
|
|
3
3
|
import type { Transaction } from 'algosdk';
|
|
4
|
-
import type { Network
|
|
5
|
-
|
|
4
|
+
import type { Network } from '../../types/node';
|
|
5
|
+
import type { Metadata } from '../../types/wallet';
|
|
6
|
+
export type PeraWalletConnectOptions = {
|
|
6
7
|
bridge?: string;
|
|
7
8
|
shouldShowSignTxnToast?: boolean;
|
|
8
9
|
chainId?: 416001 | 416002 | 416003 | 4160;
|
|
@@ -16,15 +17,11 @@ export interface PeraTransaction {
|
|
|
16
17
|
*/
|
|
17
18
|
signers?: string[];
|
|
18
19
|
}
|
|
19
|
-
export
|
|
20
|
+
export type PeraWalletClientConstructor = {
|
|
20
21
|
metadata: Metadata;
|
|
21
22
|
client: PeraWalletConnect;
|
|
22
23
|
clientOptions?: PeraWalletConnectOptions;
|
|
23
|
-
algosdk: typeof
|
|
24
|
-
algodClient:
|
|
24
|
+
algosdk: typeof algosdk;
|
|
25
|
+
algodClient: algosdk.Algodv2;
|
|
25
26
|
network: Network;
|
|
26
27
|
};
|
|
27
|
-
export declare type InitParams = CommonInitParams & {
|
|
28
|
-
clientOptions?: PeraWalletConnectOptions;
|
|
29
|
-
clientStatic?: typeof PeraWalletConnect;
|
|
30
|
-
};
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import type { Web3ModalSignOptions } from '@web3modal/sign-html';
|
|
2
1
|
import BaseClient from '../base';
|
|
3
|
-
import { Network, Wallet } from '../../types';
|
|
4
2
|
import { PROVIDER_ID } from '../../constants';
|
|
5
|
-
import {
|
|
3
|
+
import type { WalletConnectModalSignOptions } from '@walletconnect/modal-sign-html';
|
|
4
|
+
import type { Network } from '../../types/node';
|
|
5
|
+
import type { InitParams } from '../../types/providers';
|
|
6
|
+
import type { Wallet } from '../../types/wallet';
|
|
7
|
+
import type { WalletConnectClientConstructor } from './types';
|
|
6
8
|
declare class WalletConnectClient extends BaseClient {
|
|
7
9
|
#private;
|
|
8
|
-
clientOptions?:
|
|
10
|
+
clientOptions?: WalletConnectModalSignOptions;
|
|
9
11
|
network: Network;
|
|
10
12
|
chain: string;
|
|
11
13
|
constructor({ metadata, client, clientOptions, algosdk, algodClient, network, chain }: WalletConnectClientConstructor);
|
|
@@ -15,7 +17,7 @@ declare class WalletConnectClient extends BaseClient {
|
|
|
15
17
|
icon: string;
|
|
16
18
|
isWalletConnect: boolean;
|
|
17
19
|
};
|
|
18
|
-
static init({ clientOptions, algodOptions, clientStatic, algosdkStatic, network }: InitParams): Promise<BaseClient | null>;
|
|
20
|
+
static init({ clientOptions, algodOptions, clientStatic, algosdkStatic, network }: InitParams<PROVIDER_ID.WALLETCONNECT>): Promise<BaseClient | null>;
|
|
19
21
|
connect(): Promise<Wallet>;
|
|
20
22
|
reconnect(): Promise<{
|
|
21
23
|
accounts: {
|
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { WalletConnectModalSign, WalletConnectModalSignOptions } from '@walletconnect/modal-sign-html';
|
|
2
2
|
import type algosdk from 'algosdk';
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import type { Network } from '../../types/node';
|
|
4
|
+
import type { Metadata } from '../../types/wallet';
|
|
5
|
+
export type WalletConnectClientConstructor = {
|
|
5
6
|
metadata: Metadata;
|
|
6
|
-
client:
|
|
7
|
-
clientOptions:
|
|
7
|
+
client: WalletConnectModalSign;
|
|
8
|
+
clientOptions: WalletConnectModalSignOptions;
|
|
8
9
|
algosdk: typeof algosdk;
|
|
9
10
|
algodClient: algosdk.Algodv2;
|
|
10
11
|
network: Network;
|
|
11
12
|
chain: string;
|
|
12
13
|
};
|
|
13
|
-
export
|
|
14
|
-
clientOptions?: Web3ModalSignOptions;
|
|
15
|
-
clientStatic?: typeof Web3ModalSign;
|
|
16
|
-
};
|
|
17
|
-
export declare type WalletConnectTransaction = {
|
|
14
|
+
export type WalletConnectTransaction = {
|
|
18
15
|
txn: string;
|
|
19
16
|
signers?: string[];
|
|
20
17
|
message?: string;
|
|
@@ -22,7 +19,7 @@ export declare type WalletConnectTransaction = {
|
|
|
22
19
|
export interface SignTxnOpts {
|
|
23
20
|
message?: string;
|
|
24
21
|
}
|
|
25
|
-
export
|
|
22
|
+
export type SignTxnParams = [WalletConnectTransaction[], SignTxnOpts?];
|
|
26
23
|
export interface JsonRpcRequest<T = any> {
|
|
27
24
|
id: number;
|
|
28
25
|
jsonrpc: string;
|
package/dist/esm/src/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { useWallet, useInitializeProviders } from './hooks';
|
|
2
1
|
export { reconnectProviders, encodeNFDTransactionsArray } from './utils';
|
|
3
2
|
export { WalletProvider } from './store';
|
|
4
3
|
export * from './constants';
|
|
5
4
|
export * from './types';
|
|
6
5
|
export * from './clients';
|
|
6
|
+
export * from './hooks';
|
|
@@ -8,7 +8,7 @@ export declare const walletStoreSelector: (state: WalletStore) => {
|
|
|
8
8
|
addAccounts: (accounts: Account[]) => void;
|
|
9
9
|
removeAccounts: (providerId: PROVIDER_ID) => void;
|
|
10
10
|
};
|
|
11
|
-
export
|
|
11
|
+
export type WalletStore = {
|
|
12
12
|
accounts: Account[];
|
|
13
13
|
activeAccount: Account | null | undefined;
|
|
14
14
|
setActiveAccount: (account: Account) => void;
|
|
@@ -22,7 +22,7 @@ export declare const useWalletStore: import("zustand").UseBoundStore<Omit<Omit<O
|
|
|
22
22
|
persist: {
|
|
23
23
|
setOptions: (options: Partial<import("zustand/middleware").PersistOptions<WalletStore, WalletStore>>) => void;
|
|
24
24
|
clearStorage: () => void;
|
|
25
|
-
rehydrate: () => Promise<void>;
|
|
25
|
+
rehydrate: () => void | Promise<void>;
|
|
26
26
|
hasHydrated: () => boolean;
|
|
27
27
|
onHydrate: (fn: (state: WalletStore) => void) => () => void;
|
|
28
28
|
onFinishHydration: (fn: (state: WalletStore) => void) => () => void;
|
|
@@ -39,7 +39,7 @@ export declare const useHydratedWalletStore: import("zustand").UseBoundStore<Omi
|
|
|
39
39
|
persist: {
|
|
40
40
|
setOptions: (options: Partial<import("zustand/middleware").PersistOptions<WalletStore, WalletStore>>) => void;
|
|
41
41
|
clearStorage: () => void;
|
|
42
|
-
rehydrate: () => Promise<void>;
|
|
42
|
+
rehydrate: () => void | Promise<void>;
|
|
43
43
|
hasHydrated: () => boolean;
|
|
44
44
|
onHydrate: (fn: (state: WalletStore) => void) => () => void;
|
|
45
45
|
onFinishHydration: (fn: (state: WalletStore) => void) => () => void;
|
|
@@ -9,7 +9,7 @@ import PeraWalletClient from '../clients/pera/client';
|
|
|
9
9
|
import WalletConnectClient from '../clients/walletconnect2/client';
|
|
10
10
|
import { PROVIDER_ID } from '../constants';
|
|
11
11
|
import type { Account, ClientOptions } from '../types';
|
|
12
|
-
|
|
12
|
+
type ClientTypeMap = {
|
|
13
13
|
[PROVIDER_ID.ALGOSIGNER]: AlgoSignerClient;
|
|
14
14
|
[PROVIDER_ID.DAFFI]: DaffiWalletClient;
|
|
15
15
|
[PROVIDER_ID.DEFLY]: DeflyWalletClient;
|