@txnlab/use-wallet 1.3.2 → 2.0.0-alpha.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 +509 -188
- package/dist/cjs/index.js +234 -129
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/jest.config.d.ts +7 -0
- package/dist/cjs/src/clients/algosigner/client.d.ts +3 -3
- package/dist/cjs/src/clients/algosigner/types.d.ts +2 -8
- package/dist/cjs/src/clients/base/base.d.ts +3 -2
- package/dist/cjs/src/clients/base/index.d.ts +2 -2
- package/dist/cjs/src/clients/daffi/client.d.ts +5 -4
- package/dist/cjs/src/clients/daffi/types.d.ts +5 -7
- package/dist/cjs/src/clients/defly/client.d.ts +6 -5
- package/dist/cjs/src/clients/defly/types.d.ts +5 -7
- package/dist/cjs/src/clients/exodus/client.d.ts +6 -5
- package/dist/cjs/src/clients/exodus/types.d.ts +5 -10
- package/dist/cjs/src/clients/index.d.ts +1 -1
- package/dist/cjs/src/clients/kmd/client.d.ts +4 -5
- package/dist/cjs/src/clients/kmd/types.d.ts +4 -9
- package/dist/cjs/src/clients/mnemonic/client.d.ts +4 -5
- package/dist/cjs/src/clients/mnemonic/types.d.ts +2 -9
- package/dist/cjs/src/clients/myalgo/client.d.ts +6 -5
- package/dist/cjs/src/clients/myalgo/types.d.ts +10 -12
- package/dist/cjs/src/clients/pera/client.d.ts +6 -5
- package/dist/cjs/src/clients/pera/types.d.ts +5 -7
- package/dist/cjs/src/clients/{walletconnect → walletconnect2}/client.d.ts +8 -7
- package/dist/cjs/src/clients/walletconnect2/constants.d.ts +6 -0
- package/dist/cjs/src/clients/walletconnect2/index.d.ts +2 -0
- package/dist/cjs/src/clients/walletconnect2/types.d.ts +37 -0
- package/dist/cjs/src/clients/walletconnect2/utils.d.ts +2 -0
- package/dist/cjs/src/hooks/index.d.ts +1 -0
- package/dist/cjs/src/hooks/useInitializeProviders.d.ts +9 -0
- package/dist/cjs/src/hooks/useInitializeProviders.test.d.ts +4 -0
- package/dist/cjs/src/hooks/useWallet.d.ts +4 -13
- package/dist/cjs/src/hooks/useWallet.test.d.ts +4 -0
- package/dist/cjs/src/index.d.ts +1 -1
- package/dist/cjs/src/store/state/clientStore.d.ts +2 -23
- package/dist/cjs/src/testUtils/createWrapper.d.ts +6 -0
- package/dist/cjs/src/testUtils/mockAccounts.d.ts +3 -0
- package/dist/cjs/src/testUtils/mockClients.d.ts +33 -0
- package/dist/cjs/src/types/index.d.ts +1 -0
- package/dist/cjs/src/types/node.d.ts +2 -1
- package/dist/cjs/src/types/providers.d.ts +71 -0
- package/dist/cjs/src/types/wallet.d.ts +5 -3
- package/dist/cjs/src/utils/clearAccounts.d.ts +1 -1
- package/dist/cjs/src/utils/encodeNFDTransactionArray.spec.d.ts +1 -0
- package/dist/cjs/src/utils/initializeProviders.d.ts +2 -12
- package/dist/cjs/src/utils/initializeProviders.test.d.ts +4 -0
- package/dist/cjs/src/utils/providers.d.ts +1 -1
- package/dist/cjs/src/utils/providers.spec.d.ts +1 -0
- package/dist/cjs/src/utils/reconnectProviders.d.ts +1 -5
- package/dist/cjs/src/utils/reconnectProviders.test.d.ts +1 -0
- package/dist/cjs/src/utils/types.d.ts +2 -0
- package/dist/esm/index.js +234 -130
- package/dist/esm/jest.config.d.ts +7 -0
- package/dist/esm/src/clients/algosigner/client.d.ts +3 -3
- package/dist/esm/src/clients/algosigner/types.d.ts +2 -8
- package/dist/esm/src/clients/base/base.d.ts +3 -2
- package/dist/esm/src/clients/base/index.d.ts +2 -2
- package/dist/esm/src/clients/daffi/client.d.ts +5 -4
- package/dist/esm/src/clients/daffi/types.d.ts +5 -7
- package/dist/esm/src/clients/defly/client.d.ts +6 -5
- package/dist/esm/src/clients/defly/types.d.ts +5 -7
- package/dist/esm/src/clients/exodus/client.d.ts +6 -5
- package/dist/esm/src/clients/exodus/types.d.ts +5 -10
- package/dist/esm/src/clients/index.d.ts +1 -1
- package/dist/esm/src/clients/kmd/client.d.ts +4 -5
- package/dist/esm/src/clients/kmd/types.d.ts +4 -9
- package/dist/esm/src/clients/mnemonic/client.d.ts +4 -5
- package/dist/esm/src/clients/mnemonic/types.d.ts +2 -9
- package/dist/esm/src/clients/myalgo/client.d.ts +6 -5
- package/dist/esm/src/clients/myalgo/types.d.ts +10 -12
- package/dist/esm/src/clients/pera/client.d.ts +6 -5
- package/dist/esm/src/clients/pera/types.d.ts +5 -7
- package/dist/esm/src/clients/{walletconnect → walletconnect2}/client.d.ts +8 -7
- package/dist/esm/src/clients/walletconnect2/constants.d.ts +6 -0
- package/dist/esm/src/clients/walletconnect2/index.d.ts +2 -0
- package/dist/esm/src/clients/walletconnect2/types.d.ts +37 -0
- package/dist/esm/src/clients/walletconnect2/utils.d.ts +2 -0
- package/dist/esm/src/hooks/index.d.ts +1 -0
- package/dist/esm/src/hooks/useInitializeProviders.d.ts +9 -0
- package/dist/esm/src/hooks/useInitializeProviders.test.d.ts +4 -0
- package/dist/esm/src/hooks/useWallet.d.ts +4 -13
- package/dist/esm/src/hooks/useWallet.test.d.ts +4 -0
- package/dist/esm/src/index.d.ts +1 -1
- package/dist/esm/src/store/state/clientStore.d.ts +2 -23
- package/dist/esm/src/testUtils/createWrapper.d.ts +6 -0
- package/dist/esm/src/testUtils/mockAccounts.d.ts +3 -0
- package/dist/esm/src/testUtils/mockClients.d.ts +33 -0
- package/dist/esm/src/types/index.d.ts +1 -0
- package/dist/esm/src/types/node.d.ts +2 -1
- package/dist/esm/src/types/providers.d.ts +71 -0
- package/dist/esm/src/types/wallet.d.ts +5 -3
- package/dist/esm/src/utils/clearAccounts.d.ts +1 -1
- package/dist/esm/src/utils/encodeNFDTransactionArray.spec.d.ts +1 -0
- package/dist/esm/src/utils/initializeProviders.d.ts +2 -12
- package/dist/esm/src/utils/initializeProviders.test.d.ts +4 -0
- package/dist/esm/src/utils/providers.d.ts +1 -1
- package/dist/esm/src/utils/providers.spec.d.ts +1 -0
- package/dist/esm/src/utils/reconnectProviders.d.ts +1 -5
- package/dist/esm/src/utils/reconnectProviders.test.d.ts +1 -0
- package/dist/esm/src/utils/types.d.ts +2 -0
- package/dist/index.d.ts +239 -254
- package/package.json +15 -18
- package/dist/cjs/src/clients/walletconnect/constants.d.ts +0 -2
- package/dist/cjs/src/clients/walletconnect/index.d.ts +0 -2
- package/dist/cjs/src/clients/walletconnect/types.d.ts +0 -55
- package/dist/esm/src/clients/walletconnect/constants.d.ts +0 -2
- package/dist/esm/src/clients/walletconnect/index.d.ts +0 -2
- package/dist/esm/src/clients/walletconnect/types.d.ts +0 -55
|
@@ -2,6 +2,13 @@ declare const _default: {
|
|
|
2
2
|
clearMocks: boolean;
|
|
3
3
|
collectCoverage: boolean;
|
|
4
4
|
coverageDirectory: string;
|
|
5
|
+
moduleNameMapper: {
|
|
6
|
+
'@walletconnect/utils': string;
|
|
7
|
+
'@walletconnect/sign-client': string;
|
|
8
|
+
'@walletconnect/modal': string;
|
|
9
|
+
'@walletconnect/client': string;
|
|
10
|
+
};
|
|
11
|
+
setupFiles: string[];
|
|
5
12
|
testEnvironment: string;
|
|
6
13
|
};
|
|
7
14
|
export default _default;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import BaseClient from '../base';
|
|
2
2
|
import { PROVIDER_ID } from '../../constants';
|
|
3
3
|
import type { Network } from '../../types';
|
|
4
4
|
import type { AlgoSignerClientConstructor, InitParams } from './types';
|
|
5
5
|
import { useWalletStore } from '../../store';
|
|
6
|
-
declare class AlgoSignerClient extends
|
|
6
|
+
declare class AlgoSignerClient extends BaseClient {
|
|
7
7
|
#private;
|
|
8
8
|
network: Network;
|
|
9
9
|
walletStore: typeof useWalletStore;
|
|
@@ -14,7 +14,7 @@ declare class AlgoSignerClient extends BaseWallet {
|
|
|
14
14
|
icon: string;
|
|
15
15
|
isWalletConnect: boolean;
|
|
16
16
|
};
|
|
17
|
-
static init({ algodOptions, algosdkStatic, network }: InitParams): Promise<
|
|
17
|
+
static init({ algodOptions, algosdkStatic, network }: InitParams): Promise<BaseClient | null>;
|
|
18
18
|
connect(): Promise<{
|
|
19
19
|
accounts: {
|
|
20
20
|
authAddr?: string | undefined;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type _algosdk from 'algosdk';
|
|
2
|
-
import {
|
|
3
|
-
import type { AlgodClientOptions, Network, Metadata } from '../../types';
|
|
2
|
+
import type { Network, Metadata, CommonInitParams } from '../../types';
|
|
4
3
|
export declare type WindowExtended = {
|
|
5
4
|
algorand: AlgoSigner;
|
|
6
5
|
} & Window & typeof globalThis;
|
|
@@ -33,13 +32,8 @@ export declare type AlgoSigner = {
|
|
|
33
32
|
export declare type AlgoSignerClientConstructor = {
|
|
34
33
|
metadata: Metadata;
|
|
35
34
|
client: AlgoSigner;
|
|
36
|
-
id: PROVIDER_ID;
|
|
37
35
|
algosdk: typeof _algosdk;
|
|
38
36
|
algodClient: _algosdk.Algodv2;
|
|
39
37
|
network: Network;
|
|
40
38
|
};
|
|
41
|
-
export declare type InitParams =
|
|
42
|
-
algodOptions?: AlgodClientOptions;
|
|
43
|
-
algosdkStatic?: typeof _algosdk;
|
|
44
|
-
network?: Network;
|
|
45
|
-
};
|
|
39
|
+
export declare type InitParams = CommonInitParams;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type _algosdk from 'algosdk';
|
|
2
|
-
import type { Asset, Wallet, AccountInfo, TransactionsArray, TxnInfo, Metadata } from '../../types';
|
|
2
|
+
import type { Asset, Wallet, AccountInfo, TransactionsArray, TxnInfo, Metadata, ClientOptions } from '../../types';
|
|
3
3
|
declare abstract class BaseClient {
|
|
4
4
|
algosdk: typeof _algosdk;
|
|
5
5
|
algodClient: _algosdk.Algodv2;
|
|
6
|
+
clientOptions?: ClientOptions;
|
|
6
7
|
keepWCAlive: HTMLAudioElement;
|
|
7
8
|
metadata: Metadata;
|
|
8
9
|
static metadata: Metadata;
|
|
@@ -10,7 +11,7 @@ declare abstract class BaseClient {
|
|
|
10
11
|
abstract disconnect(): Promise<void>;
|
|
11
12
|
abstract reconnect(onDisconnect: () => void): Promise<Wallet | null>;
|
|
12
13
|
abstract signTransactions(connectedAccounts: string[], txnGroups: Uint8Array[] | Uint8Array[][], indexesToSign?: number[], returnGroup?: boolean): Promise<Uint8Array[]>;
|
|
13
|
-
protected constructor(metadata: Metadata, algosdk: typeof _algosdk, algodClient: _algosdk.Algodv2);
|
|
14
|
+
protected constructor(metadata: Metadata, algosdk: typeof _algosdk, algodClient: _algosdk.Algodv2, clientOptions?: ClientOptions);
|
|
14
15
|
healthCheck(): Promise<{}>;
|
|
15
16
|
getAccountInfo(address: string): Promise<AccountInfo>;
|
|
16
17
|
getAssets(address: string): Promise<Asset[]>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
export default
|
|
1
|
+
import BaseClient from './base';
|
|
2
|
+
export default BaseClient;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { Wallet, Network } from '../../types';
|
|
2
2
|
import { PROVIDER_ID } from '../../constants';
|
|
3
|
-
import
|
|
4
|
-
import { DaffiWalletClientConstructor, InitParams } from './types';
|
|
5
|
-
declare class DaffiWalletClient extends
|
|
3
|
+
import BaseClient from '../base';
|
|
4
|
+
import { DaffiWalletClientConstructor, DaffiWalletConnectOptions, InitParams } from './types';
|
|
5
|
+
declare class DaffiWalletClient extends BaseClient {
|
|
6
6
|
#private;
|
|
7
|
+
clientOptions?: DaffiWalletConnectOptions;
|
|
7
8
|
network: Network;
|
|
8
|
-
constructor({ metadata, client, algosdk, algodClient, network }: DaffiWalletClientConstructor);
|
|
9
|
+
constructor({ metadata, client, clientOptions, algosdk, algodClient, network }: DaffiWalletClientConstructor);
|
|
9
10
|
static metadata: {
|
|
10
11
|
id: PROVIDER_ID;
|
|
11
12
|
name: string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type _algosdk from 'algosdk';
|
|
2
2
|
import type { DaffiWalletConnect } from '@daffiwallet/connect';
|
|
3
3
|
import type { Transaction } from 'algosdk';
|
|
4
|
-
import type {
|
|
5
|
-
export declare type
|
|
4
|
+
import type { Network, Metadata, CommonInitParams } from '../../types';
|
|
5
|
+
export declare type DaffiWalletConnectOptions = {
|
|
6
6
|
bridge?: string;
|
|
7
7
|
shouldShowSignTxnToast?: boolean;
|
|
8
8
|
chainId?: 416001 | 416002 | 416003 | 4160;
|
|
@@ -19,14 +19,12 @@ export interface DaffiTransaction {
|
|
|
19
19
|
export declare type DaffiWalletClientConstructor = {
|
|
20
20
|
metadata: Metadata;
|
|
21
21
|
client: DaffiWalletConnect;
|
|
22
|
+
clientOptions?: DaffiWalletConnectOptions;
|
|
22
23
|
algosdk: typeof _algosdk;
|
|
23
24
|
algodClient: _algosdk.Algodv2;
|
|
24
25
|
network: Network;
|
|
25
26
|
};
|
|
26
|
-
export declare type InitParams = {
|
|
27
|
-
clientOptions?:
|
|
28
|
-
algodOptions?: AlgodClientOptions;
|
|
27
|
+
export declare type InitParams = CommonInitParams & {
|
|
28
|
+
clientOptions?: DaffiWalletConnectOptions;
|
|
29
29
|
clientStatic?: typeof DaffiWalletConnect;
|
|
30
|
-
algosdkStatic?: typeof _algosdk;
|
|
31
|
-
network?: Network;
|
|
32
30
|
};
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import type { Wallet } from '../../types';
|
|
2
2
|
import { PROVIDER_ID } from '../../constants';
|
|
3
|
-
import
|
|
3
|
+
import BaseClient from '../base';
|
|
4
4
|
import type { Network } from '../../types';
|
|
5
|
-
import { InitParams, DeflyWalletClientConstructor } from './types';
|
|
6
|
-
declare class DeflyWalletClient extends
|
|
5
|
+
import { InitParams, DeflyWalletClientConstructor, DeflyWalletConnectOptions } from './types';
|
|
6
|
+
declare class DeflyWalletClient extends BaseClient {
|
|
7
7
|
#private;
|
|
8
|
+
clientOptions?: DeflyWalletConnectOptions;
|
|
8
9
|
network: Network;
|
|
9
|
-
constructor({ metadata, client, algosdk, algodClient, network }: DeflyWalletClientConstructor);
|
|
10
|
+
constructor({ metadata, client, clientOptions, algosdk, algodClient, network }: DeflyWalletClientConstructor);
|
|
10
11
|
static metadata: {
|
|
11
12
|
id: PROVIDER_ID;
|
|
12
13
|
name: string;
|
|
13
14
|
icon: string;
|
|
14
15
|
isWalletConnect: boolean;
|
|
15
16
|
};
|
|
16
|
-
static init({ clientOptions, algodOptions, clientStatic, algosdkStatic, network }: InitParams): Promise<
|
|
17
|
+
static init({ clientOptions, algodOptions, clientStatic, algosdkStatic, network }: InitParams): Promise<BaseClient | null>;
|
|
17
18
|
connect(onDisconnect: () => void): Promise<Wallet>;
|
|
18
19
|
reconnect(onDisconnect: () => void): Promise<{
|
|
19
20
|
accounts: {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Transaction } from 'algosdk';
|
|
2
|
-
import type {
|
|
2
|
+
import type { Network, Metadata, CommonInitParams } from '../../types';
|
|
3
3
|
import type { DeflyWalletConnect } from '@blockshake/defly-connect';
|
|
4
4
|
import type _algosdk from 'algosdk';
|
|
5
|
-
export declare type
|
|
5
|
+
export declare type DeflyWalletConnectOptions = {
|
|
6
6
|
bridge?: string;
|
|
7
7
|
deep_link?: string;
|
|
8
8
|
app_meta?: {
|
|
@@ -24,14 +24,12 @@ export declare type DeflyTransaction = {
|
|
|
24
24
|
export declare type DeflyWalletClientConstructor = {
|
|
25
25
|
metadata: Metadata;
|
|
26
26
|
client: DeflyWalletConnect;
|
|
27
|
+
clientOptions?: DeflyWalletConnectOptions;
|
|
27
28
|
algosdk: typeof _algosdk;
|
|
28
29
|
algodClient: _algosdk.Algodv2;
|
|
29
30
|
network: Network;
|
|
30
31
|
};
|
|
31
|
-
export declare type InitParams = {
|
|
32
|
-
clientOptions?:
|
|
33
|
-
algodOptions?: AlgodClientOptions;
|
|
32
|
+
export declare type InitParams = CommonInitParams & {
|
|
33
|
+
clientOptions?: DeflyWalletConnectOptions;
|
|
34
34
|
clientStatic?: typeof DeflyWalletConnect;
|
|
35
|
-
algosdkStatic?: typeof _algosdk;
|
|
36
|
-
network?: Network;
|
|
37
35
|
};
|
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import
|
|
1
|
+
import BaseClient from '../base';
|
|
2
2
|
import { PROVIDER_ID } from '../../constants';
|
|
3
3
|
import type { Network } from '../../types';
|
|
4
|
-
import { InitParams, ExodusClientConstructor } from './types';
|
|
5
|
-
declare class ExodusClient extends
|
|
4
|
+
import { InitParams, ExodusClientConstructor, ExodusOptions } from './types';
|
|
5
|
+
declare class ExodusClient extends BaseClient {
|
|
6
6
|
#private;
|
|
7
|
+
clientOptions: ExodusOptions;
|
|
7
8
|
network: Network;
|
|
8
|
-
constructor({ metadata, client, algosdk, algodClient,
|
|
9
|
+
constructor({ metadata, client, clientOptions, algosdk, algodClient, network }: ExodusClientConstructor);
|
|
9
10
|
static metadata: {
|
|
10
11
|
id: PROVIDER_ID;
|
|
11
12
|
name: string;
|
|
12
13
|
icon: string;
|
|
13
14
|
isWalletConnect: boolean;
|
|
14
15
|
};
|
|
15
|
-
static init({ clientOptions, algodOptions, algosdkStatic, network }: InitParams): Promise<
|
|
16
|
+
static init({ clientOptions, algodOptions, algosdkStatic, network }: InitParams): Promise<BaseClient | null>;
|
|
16
17
|
connect(): Promise<{
|
|
17
18
|
accounts: {
|
|
18
19
|
name: string;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { PROVIDER_ID } from '../../constants';
|
|
2
1
|
import type _algosdk from 'algosdk';
|
|
3
|
-
import type {
|
|
4
|
-
export declare type
|
|
2
|
+
import type { Network, Metadata, CommonInitParams } from '../../types';
|
|
3
|
+
export declare type ExodusOptions = {
|
|
5
4
|
onlyIfTrusted: boolean;
|
|
6
5
|
};
|
|
7
6
|
export declare type WindowExtended = {
|
|
@@ -27,15 +26,11 @@ export declare type Exodus = {
|
|
|
27
26
|
export declare type ExodusClientConstructor = {
|
|
28
27
|
metadata: Metadata;
|
|
29
28
|
client: Exodus;
|
|
30
|
-
|
|
29
|
+
clientOptions: ExodusOptions;
|
|
31
30
|
algosdk: typeof _algosdk;
|
|
32
31
|
algodClient: _algosdk.Algodv2;
|
|
33
|
-
onlyIfTrusted: boolean;
|
|
34
32
|
network: Network;
|
|
35
33
|
};
|
|
36
|
-
export declare type InitParams = {
|
|
37
|
-
clientOptions?:
|
|
38
|
-
algodOptions?: AlgodClientOptions;
|
|
39
|
-
algosdkStatic?: typeof _algosdk;
|
|
40
|
-
network?: Network;
|
|
34
|
+
export declare type InitParams = CommonInitParams & {
|
|
35
|
+
clientOptions?: ExodusOptions;
|
|
41
36
|
};
|
|
@@ -4,7 +4,7 @@ import myalgo from './myalgo';
|
|
|
4
4
|
import defly from './defly';
|
|
5
5
|
import exodus from './exodus';
|
|
6
6
|
import algosigner from './algosigner';
|
|
7
|
-
import walletconnect from './
|
|
7
|
+
import walletconnect from './walletconnect2';
|
|
8
8
|
import kmd from './kmd';
|
|
9
9
|
import mnemonic from './mnemonic';
|
|
10
10
|
export { pera, myalgo, defly, exodus, algosigner, walletconnect, kmd, mnemonic };
|
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
import
|
|
1
|
+
import BaseClient from '../base';
|
|
2
2
|
import { PROVIDER_ID } from '../../constants';
|
|
3
3
|
import type { Account, Wallet, Network } from '../../types';
|
|
4
4
|
import { InitParams, KMDWalletClientConstructor } from './types';
|
|
5
|
-
declare class KMDWalletClient extends
|
|
5
|
+
declare class KMDWalletClient extends BaseClient {
|
|
6
6
|
#private;
|
|
7
7
|
walletId: string;
|
|
8
|
-
id: PROVIDER_ID;
|
|
9
8
|
network: Network;
|
|
10
|
-
constructor({ metadata, client,
|
|
9
|
+
constructor({ metadata, client, wallet, password, algosdk, algodClient, network }: KMDWalletClientConstructor);
|
|
11
10
|
static metadata: {
|
|
12
11
|
id: PROVIDER_ID;
|
|
13
12
|
name: string;
|
|
14
13
|
icon: string;
|
|
15
14
|
isWalletConnect: boolean;
|
|
16
15
|
};
|
|
17
|
-
static init({ clientOptions, algodOptions, algosdkStatic, network }: InitParams): Promise<
|
|
16
|
+
static init({ clientOptions, algodOptions, algosdkStatic, network }: InitParams): Promise<BaseClient | null>;
|
|
18
17
|
connect(): Promise<Wallet>;
|
|
19
18
|
disconnect(): Promise<void>;
|
|
20
19
|
reconnect(): Promise<Wallet | null>;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type _algosdk from 'algosdk';
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
export declare type ClientOptions = {
|
|
2
|
+
import type { Network, Metadata, CommonInitParams } from '../../types';
|
|
3
|
+
export declare type KmdOptions = {
|
|
5
4
|
wallet: string;
|
|
6
5
|
password: string;
|
|
7
6
|
host: string;
|
|
@@ -24,16 +23,12 @@ export interface InitWalletHandle {
|
|
|
24
23
|
export declare type KMDWalletClientConstructor = {
|
|
25
24
|
metadata: Metadata;
|
|
26
25
|
client: _algosdk.Kmd;
|
|
27
|
-
id: PROVIDER_ID;
|
|
28
26
|
algosdk: typeof _algosdk;
|
|
29
27
|
algodClient: _algosdk.Algodv2;
|
|
30
28
|
wallet: string;
|
|
31
29
|
password: string;
|
|
32
30
|
network: Network;
|
|
33
31
|
};
|
|
34
|
-
export declare type InitParams = {
|
|
35
|
-
clientOptions?:
|
|
36
|
-
algodOptions?: AlgodClientOptions;
|
|
37
|
-
algosdkStatic?: typeof _algosdk;
|
|
38
|
-
network?: Network;
|
|
32
|
+
export declare type InitParams = CommonInitParams & {
|
|
33
|
+
clientOptions?: KmdOptions;
|
|
39
34
|
};
|
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
import
|
|
1
|
+
import BaseClient from '../base';
|
|
2
2
|
import { PROVIDER_ID } from '../../constants';
|
|
3
3
|
import type { TransactionsArray, Network } from '../../types';
|
|
4
4
|
import { InitParams, MnemonicWalletClientConstructor } from './types';
|
|
5
|
-
declare class MnemonicWalletClient extends
|
|
5
|
+
declare class MnemonicWalletClient extends BaseClient {
|
|
6
6
|
#private;
|
|
7
|
-
id: PROVIDER_ID;
|
|
8
7
|
network: Network;
|
|
9
|
-
constructor({ metadata,
|
|
8
|
+
constructor({ metadata, algosdk, algodClient, network }: MnemonicWalletClientConstructor);
|
|
10
9
|
static metadata: {
|
|
11
10
|
id: PROVIDER_ID;
|
|
12
11
|
name: string;
|
|
13
12
|
icon: string;
|
|
14
13
|
isWalletConnect: boolean;
|
|
15
14
|
};
|
|
16
|
-
static init({ algodOptions, algosdkStatic, network }: InitParams): Promise<
|
|
15
|
+
static init({ algodOptions, algosdkStatic, network }: InitParams): Promise<BaseClient | null>;
|
|
17
16
|
connect(): Promise<{
|
|
18
17
|
accounts: {
|
|
19
18
|
name: string;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type _algosdk from 'algosdk';
|
|
2
|
-
import type {
|
|
3
|
-
import { PROVIDER_ID } from '../../constants';
|
|
2
|
+
import type { Network, Metadata, CommonInitParams } from '../../types';
|
|
4
3
|
export declare type ClientOptions = {
|
|
5
4
|
wallet: string;
|
|
6
5
|
password: string;
|
|
@@ -15,14 +14,8 @@ export interface InitWalletHandle {
|
|
|
15
14
|
}
|
|
16
15
|
export declare type MnemonicWalletClientConstructor = {
|
|
17
16
|
metadata: Metadata;
|
|
18
|
-
id: PROVIDER_ID;
|
|
19
17
|
algosdk: typeof _algosdk;
|
|
20
18
|
algodClient: _algosdk.Algodv2;
|
|
21
19
|
network: Network;
|
|
22
20
|
};
|
|
23
|
-
export declare type InitParams =
|
|
24
|
-
clientOptions?: ClientOptions;
|
|
25
|
-
algodOptions?: AlgodClientOptions;
|
|
26
|
-
algosdkStatic?: typeof _algosdk;
|
|
27
|
-
network?: Network;
|
|
28
|
-
};
|
|
21
|
+
export declare type InitParams = CommonInitParams;
|
|
@@ -2,21 +2,22 @@
|
|
|
2
2
|
* Helpful resources:
|
|
3
3
|
* https://github.com/randlabs/myalgo-connect
|
|
4
4
|
*/
|
|
5
|
-
import
|
|
5
|
+
import BaseClient from '../base';
|
|
6
6
|
import { PROVIDER_ID } from '../../constants';
|
|
7
7
|
import { Network } from '../../types';
|
|
8
|
-
import { MyAlgoWalletClientConstructor, InitParams } from './types';
|
|
9
|
-
declare class MyAlgoWalletClient extends
|
|
8
|
+
import { MyAlgoWalletClientConstructor, InitParams, MyAlgoConnectOptions } from './types';
|
|
9
|
+
declare class MyAlgoWalletClient extends BaseClient {
|
|
10
10
|
#private;
|
|
11
|
+
clientOptions?: MyAlgoConnectOptions;
|
|
11
12
|
network: Network;
|
|
12
|
-
constructor({ metadata, client, algosdk, algodClient, network }: MyAlgoWalletClientConstructor);
|
|
13
|
+
constructor({ metadata, client, clientOptions, algosdk, algodClient, network }: MyAlgoWalletClientConstructor);
|
|
13
14
|
static metadata: {
|
|
14
15
|
id: PROVIDER_ID;
|
|
15
16
|
name: string;
|
|
16
17
|
icon: string;
|
|
17
18
|
isWalletConnect: boolean;
|
|
18
19
|
};
|
|
19
|
-
static init({ clientOptions, algodOptions, clientStatic, algosdkStatic, network }: InitParams): Promise<
|
|
20
|
+
static init({ clientOptions, algodOptions, clientStatic, algosdkStatic, network }: InitParams): Promise<BaseClient | null>;
|
|
20
21
|
connect(): Promise<{
|
|
21
22
|
accounts: {
|
|
22
23
|
providerId: PROVIDER_ID;
|
|
@@ -2,23 +2,21 @@
|
|
|
2
2
|
* Helpful resources:
|
|
3
3
|
* https://github.com/randlabs/myalgo-connect
|
|
4
4
|
*/
|
|
5
|
-
import type
|
|
5
|
+
import type MyAlgoConnect from '@randlabs/myalgo-connect';
|
|
6
6
|
import type _algosdk from 'algosdk';
|
|
7
|
-
import {
|
|
7
|
+
import { Network, Metadata, CommonInitParams } from '../../types';
|
|
8
|
+
export declare type MyAlgoConnectOptions = {
|
|
9
|
+
disableLedgerNano: boolean;
|
|
10
|
+
};
|
|
8
11
|
export declare type MyAlgoWalletClientConstructor = {
|
|
9
12
|
metadata: Metadata;
|
|
10
|
-
client:
|
|
13
|
+
client: MyAlgoConnect;
|
|
14
|
+
clientOptions?: MyAlgoConnectOptions;
|
|
11
15
|
algosdk: typeof _algosdk;
|
|
12
16
|
algodClient: _algosdk.Algodv2;
|
|
13
17
|
network: Network;
|
|
14
18
|
};
|
|
15
|
-
export declare type
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
export declare type InitParams = {
|
|
19
|
-
clientOptions?: ClientOptions;
|
|
20
|
-
algodOptions?: AlgodClientOptions;
|
|
21
|
-
clientStatic?: typeof _MyAlgoConnect;
|
|
22
|
-
algosdkStatic?: typeof _algosdk;
|
|
23
|
-
network?: Network;
|
|
19
|
+
export declare type InitParams = CommonInitParams & {
|
|
20
|
+
clientOptions?: MyAlgoConnectOptions;
|
|
21
|
+
clientStatic?: typeof MyAlgoConnect;
|
|
24
22
|
};
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import type { Wallet, Network } from '../../types';
|
|
2
2
|
import { PROVIDER_ID } from '../../constants';
|
|
3
|
-
import
|
|
4
|
-
import { PeraWalletClientConstructor, InitParams } from './types';
|
|
5
|
-
declare class PeraWalletClient extends
|
|
3
|
+
import BaseClient from '../base';
|
|
4
|
+
import { PeraWalletClientConstructor, InitParams, PeraWalletConnectOptions } from './types';
|
|
5
|
+
declare class PeraWalletClient extends BaseClient {
|
|
6
6
|
#private;
|
|
7
|
+
clientOptions?: PeraWalletConnectOptions;
|
|
7
8
|
network: Network;
|
|
8
|
-
constructor({ metadata, client, algosdk, algodClient, network }: PeraWalletClientConstructor);
|
|
9
|
+
constructor({ metadata, client, clientOptions, algosdk, algodClient, network }: PeraWalletClientConstructor);
|
|
9
10
|
static metadata: {
|
|
10
11
|
id: PROVIDER_ID;
|
|
11
12
|
name: string;
|
|
12
13
|
icon: string;
|
|
13
14
|
isWalletConnect: boolean;
|
|
14
15
|
};
|
|
15
|
-
static init({ clientOptions, algodOptions, clientStatic, algosdkStatic, network }: InitParams): Promise<
|
|
16
|
+
static init({ clientOptions, algodOptions, clientStatic, algosdkStatic, network }: InitParams): Promise<BaseClient | null>;
|
|
16
17
|
connect(onDisconnect: () => void): Promise<Wallet>;
|
|
17
18
|
reconnect(onDisconnect: () => void): Promise<{
|
|
18
19
|
accounts: {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type _algosdk from 'algosdk';
|
|
2
2
|
import type { PeraWalletConnect } from '@perawallet/connect';
|
|
3
3
|
import type { Transaction } from 'algosdk';
|
|
4
|
-
import type {
|
|
5
|
-
export declare type
|
|
4
|
+
import type { Network, Metadata, CommonInitParams } from '../../types';
|
|
5
|
+
export declare type PeraWalletConnectOptions = {
|
|
6
6
|
bridge?: string;
|
|
7
7
|
shouldShowSignTxnToast?: boolean;
|
|
8
8
|
chainId?: 416001 | 416002 | 416003 | 4160;
|
|
@@ -19,14 +19,12 @@ export interface PeraTransaction {
|
|
|
19
19
|
export declare type PeraWalletClientConstructor = {
|
|
20
20
|
metadata: Metadata;
|
|
21
21
|
client: PeraWalletConnect;
|
|
22
|
+
clientOptions?: PeraWalletConnectOptions;
|
|
22
23
|
algosdk: typeof _algosdk;
|
|
23
24
|
algodClient: _algosdk.Algodv2;
|
|
24
25
|
network: Network;
|
|
25
26
|
};
|
|
26
|
-
export declare type InitParams = {
|
|
27
|
-
clientOptions?:
|
|
28
|
-
algodOptions?: AlgodClientOptions;
|
|
27
|
+
export declare type InitParams = CommonInitParams & {
|
|
28
|
+
clientOptions?: PeraWalletConnectOptions;
|
|
29
29
|
clientStatic?: typeof PeraWalletConnect;
|
|
30
|
-
algosdkStatic?: typeof _algosdk;
|
|
31
|
-
network?: Network;
|
|
32
30
|
};
|
|
@@ -1,18 +1,20 @@
|
|
|
1
|
+
import BaseClient from '../base';
|
|
1
2
|
import { PROVIDER_ID } from '../../constants';
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
declare class WalletConnectClient extends BaseWallet {
|
|
3
|
+
import type { Network, Wallet } from '../../types';
|
|
4
|
+
import type { InitParams, WalletConnectClientConstructor, WalletConnectOptions } from './types';
|
|
5
|
+
declare class WalletConnectClient extends BaseClient {
|
|
6
6
|
#private;
|
|
7
|
+
clientOptions?: WalletConnectOptions;
|
|
7
8
|
network: Network;
|
|
8
|
-
|
|
9
|
+
chain: string;
|
|
10
|
+
constructor({ metadata, client, clientOptions, modal, algosdk, algodClient, network, chain }: WalletConnectClientConstructor);
|
|
9
11
|
static metadata: {
|
|
10
12
|
id: PROVIDER_ID;
|
|
11
13
|
name: string;
|
|
12
14
|
icon: string;
|
|
13
15
|
isWalletConnect: boolean;
|
|
14
16
|
};
|
|
15
|
-
static init({ clientOptions, algodOptions, clientStatic, modalStatic, algosdkStatic, network }: InitParams): Promise<
|
|
17
|
+
static init({ clientOptions, algodOptions, clientStatic, modalStatic, modalOptions, algosdkStatic, network }: InitParams): Promise<BaseClient | null>;
|
|
16
18
|
connect(): Promise<Wallet>;
|
|
17
19
|
reconnect(): Promise<{
|
|
18
20
|
accounts: {
|
|
@@ -25,7 +27,6 @@ declare class WalletConnectClient extends BaseWallet {
|
|
|
25
27
|
icon: string;
|
|
26
28
|
isWalletConnect: boolean;
|
|
27
29
|
} | null>;
|
|
28
|
-
check(): boolean;
|
|
29
30
|
disconnect(): Promise<void>;
|
|
30
31
|
signTransactions(connectedAccounts: string[], txnGroups: Uint8Array[] | Uint8Array[][], indexesToSign?: number[], returnGroup?: boolean): Promise<Uint8Array[]>;
|
|
31
32
|
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type algosdk from 'algosdk';
|
|
2
|
+
import type SignClient from '@walletconnect/sign-client';
|
|
3
|
+
import type { CommonInitParams, Metadata, Network } from '../../types';
|
|
4
|
+
import type { WalletConnectModal, WalletConnectModalConfig } from '@walletconnect/modal';
|
|
5
|
+
export declare type WalletConnectOptions = SignClient['opts'];
|
|
6
|
+
export declare type WalletConnectModalOptions = Omit<WalletConnectModalConfig, 'projectId' | 'walletConnectVersion'>;
|
|
7
|
+
export declare type InitParams = CommonInitParams & {
|
|
8
|
+
clientOptions?: WalletConnectOptions;
|
|
9
|
+
clientStatic?: typeof SignClient;
|
|
10
|
+
modalStatic?: typeof WalletConnectModal;
|
|
11
|
+
modalOptions?: WalletConnectModalOptions;
|
|
12
|
+
};
|
|
13
|
+
export declare type WalletConnectClientConstructor = {
|
|
14
|
+
metadata: Metadata;
|
|
15
|
+
client: SignClient;
|
|
16
|
+
clientOptions?: WalletConnectOptions;
|
|
17
|
+
modal: WalletConnectModal;
|
|
18
|
+
algosdk: typeof algosdk;
|
|
19
|
+
algodClient: algosdk.Algodv2;
|
|
20
|
+
network: Network;
|
|
21
|
+
chain: string;
|
|
22
|
+
};
|
|
23
|
+
export declare type WalletConnectTransaction = {
|
|
24
|
+
txn: string;
|
|
25
|
+
signers?: string[];
|
|
26
|
+
message?: string;
|
|
27
|
+
};
|
|
28
|
+
export interface SignTxnOpts {
|
|
29
|
+
message?: string;
|
|
30
|
+
}
|
|
31
|
+
export declare type SignTxnParams = [WalletConnectTransaction[], SignTxnOpts?];
|
|
32
|
+
export interface JsonRpcRequest<T = any> {
|
|
33
|
+
id: number;
|
|
34
|
+
jsonrpc: string;
|
|
35
|
+
method: string;
|
|
36
|
+
params: T;
|
|
37
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type algosdk from 'algosdk';
|
|
2
|
+
import type { NodeConfig, ProviderConfig, ProviderConfigMapping } from '../types';
|
|
3
|
+
interface InitializeProvidersOptions<T extends keyof ProviderConfigMapping = keyof ProviderConfigMapping> {
|
|
4
|
+
providers?: Array<T | ProviderConfig<T>>;
|
|
5
|
+
nodeConfig?: NodeConfig;
|
|
6
|
+
algosdkStatic?: typeof algosdk;
|
|
7
|
+
}
|
|
8
|
+
export default function useInitializeProviders<T extends keyof ProviderConfigMapping = keyof ProviderConfigMapping>({ providers, nodeConfig, algosdkStatic }?: InitializeProvidersOptions<T>): Partial<Record<import("./useWallet").PROVIDER_ID, import("../clients/base/base").default | null>> | null;
|
|
9
|
+
export {};
|
|
@@ -1,18 +1,9 @@
|
|
|
1
1
|
import type algosdk from 'algosdk';
|
|
2
|
-
import {
|
|
2
|
+
import { TransactionsArray, Provider } from '../types';
|
|
3
|
+
import { PROVIDER_ID } from '../constants';
|
|
3
4
|
export { PROVIDER_ID };
|
|
4
5
|
export default function useWallet(): {
|
|
5
|
-
clients: Partial<
|
|
6
|
-
kmd: Promise<import("../clients/base/base").default | null>;
|
|
7
|
-
pera: Promise<import("../clients/base/base").default | null>;
|
|
8
|
-
daffi: Promise<import("../clients/base/base").default | null>;
|
|
9
|
-
myalgo: Promise<import("../clients/base/base").default | null>;
|
|
10
|
-
algosigner: Promise<import("../clients/base/base").default | null>;
|
|
11
|
-
defly: Promise<import("../clients/base/base").default | null>;
|
|
12
|
-
exodus: Promise<import("../clients/base/base").default | null>;
|
|
13
|
-
walletconnect: Promise<import("../clients/base/base").default | null>;
|
|
14
|
-
mnemonic: Promise<import("../clients/base/base").default | null>;
|
|
15
|
-
}> | null;
|
|
6
|
+
clients: Partial<Record<PROVIDER_ID, import("../clients/base/base").default | null>> | null;
|
|
16
7
|
providers: Provider[] | null;
|
|
17
8
|
connectedAccounts: import("../types").Account[];
|
|
18
9
|
connectedActiveAccounts: import("../types").Account[];
|
|
@@ -35,7 +26,7 @@ export default function useWallet(): {
|
|
|
35
26
|
id: string;
|
|
36
27
|
}>;
|
|
37
28
|
getAddress: () => string | undefined;
|
|
38
|
-
groupTransactionsBySender: (transactions: TransactionsArray) =>
|
|
29
|
+
groupTransactionsBySender: (transactions: TransactionsArray) => Record<string, import("../types").TxnInfo[]>;
|
|
39
30
|
getAccountInfo: () => Promise<import("../types").AccountInfo>;
|
|
40
31
|
getAssets: () => Promise<import("../types").Asset[]>;
|
|
41
32
|
};
|
package/dist/cjs/src/index.d.ts
CHANGED