@txnlab/use-wallet 2.3.1 → 2.4.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 +31 -4
- package/dist/cjs/index.js +162 -40
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/src/clients/index.d.ts +3 -2
- package/dist/cjs/src/clients/lute/client.d.ts +34 -0
- package/dist/cjs/src/clients/lute/constants.d.ts +1 -0
- package/dist/cjs/src/clients/lute/index.d.ts +2 -0
- package/dist/cjs/src/clients/lute/types.d.ts +15 -0
- package/dist/cjs/src/constants/constants.d.ts +1 -0
- package/dist/cjs/src/testUtils/mockClients.d.ts +3 -0
- package/dist/cjs/src/types/providers.d.ts +10 -1
- package/dist/esm/index.js +162 -41
- package/dist/esm/src/clients/index.d.ts +3 -2
- package/dist/esm/src/clients/lute/client.d.ts +34 -0
- package/dist/esm/src/clients/lute/constants.d.ts +1 -0
- package/dist/esm/src/clients/lute/index.d.ts +2 -0
- package/dist/esm/src/clients/lute/types.d.ts +15 -0
- package/dist/esm/src/constants/constants.d.ts +1 -0
- package/dist/esm/src/testUtils/mockClients.d.ts +3 -0
- package/dist/esm/src/types/providers.d.ts +10 -1
- package/dist/index.d.ts +52 -2
- package/package.json +25 -31
|
@@ -4,13 +4,14 @@ import myalgo from './myalgo';
|
|
|
4
4
|
import defly from './defly';
|
|
5
5
|
import exodus from './exodus';
|
|
6
6
|
import algosigner from './algosigner';
|
|
7
|
+
import lute from './lute';
|
|
7
8
|
import walletconnect from './walletconnect2';
|
|
8
9
|
import kmd from './kmd';
|
|
9
10
|
import mnemonic from './mnemonic';
|
|
10
11
|
import { CustomProvider } from './custom/types';
|
|
11
12
|
import custom from './custom';
|
|
12
|
-
export { pera, myalgo, defly, exodus, algosigner, walletconnect, kmd, mnemonic, custom, CustomProvider };
|
|
13
|
+
export { pera, myalgo, defly, exodus, algosigner, lute, walletconnect, kmd, mnemonic, custom, CustomProvider };
|
|
13
14
|
declare const _default: {
|
|
14
|
-
[x: string]: typeof pera | typeof myalgo | typeof defly | typeof exodus | typeof algosigner | typeof walletconnect | typeof kmd | typeof mnemonic | typeof custom | typeof daffi;
|
|
15
|
+
[x: string]: typeof pera | typeof myalgo | typeof defly | typeof exodus | typeof algosigner | typeof lute | typeof walletconnect | typeof kmd | typeof mnemonic | typeof custom | typeof daffi;
|
|
15
16
|
};
|
|
16
17
|
export default _default;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { PROVIDER_ID } from '../../constants';
|
|
2
|
+
import { DecodedSignedTransaction, DecodedTransaction, Network } from '../../types/node';
|
|
3
|
+
import type { InitParams } from '../../types/providers';
|
|
4
|
+
import BaseClient from '../base';
|
|
5
|
+
import type { LuteClientConstructor, LuteConnectOptions } from './types';
|
|
6
|
+
declare class LuteClient extends BaseClient {
|
|
7
|
+
#private;
|
|
8
|
+
clientOptions?: LuteConnectOptions;
|
|
9
|
+
network: Network;
|
|
10
|
+
constructor({ metadata, client, clientOptions, algosdk, algodClient, network }: LuteClientConstructor);
|
|
11
|
+
static metadata: {
|
|
12
|
+
id: PROVIDER_ID;
|
|
13
|
+
name: string;
|
|
14
|
+
icon: string;
|
|
15
|
+
isWalletConnect: boolean;
|
|
16
|
+
};
|
|
17
|
+
static init({ clientOptions, algodOptions, clientStatic, getDynamicClient, algosdkStatic, network }: InitParams<PROVIDER_ID.LUTE>): Promise<BaseClient | null>;
|
|
18
|
+
connect(): 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
|
+
}>;
|
|
29
|
+
reconnect(): Promise<null>;
|
|
30
|
+
disconnect(): Promise<void>;
|
|
31
|
+
shouldSignTxnObject(txn: DecodedTransaction | DecodedSignedTransaction, addresses: string[], indexesToSign: number[] | undefined, idx: number): boolean;
|
|
32
|
+
signTransactions(connectedAccounts: string[], transactions: Uint8Array[], indexesToSign?: number[], returnGroup?: boolean): Promise<Uint8Array[]>;
|
|
33
|
+
}
|
|
34
|
+
export default LuteClient;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ICON: string;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type algosdk from 'algosdk';
|
|
2
|
+
import type { Network } from '../../types/node';
|
|
3
|
+
import type { Metadata } from '../../types/wallet';
|
|
4
|
+
import type LuteConnect from 'lute-connect';
|
|
5
|
+
export type LuteConnectOptions = {
|
|
6
|
+
siteName: string;
|
|
7
|
+
};
|
|
8
|
+
export type LuteClientConstructor = {
|
|
9
|
+
metadata: Metadata;
|
|
10
|
+
client: LuteConnect;
|
|
11
|
+
clientOptions?: LuteConnectOptions;
|
|
12
|
+
algosdk: typeof algosdk;
|
|
13
|
+
algodClient: algosdk.Algodv2;
|
|
14
|
+
network: Network;
|
|
15
|
+
};
|
|
@@ -2,6 +2,7 @@ import AlgoSignerClient from '../clients/algosigner/client';
|
|
|
2
2
|
import DaffiWalletClient from '../clients/daffi/client';
|
|
3
3
|
import DeflyWalletClient from '../clients/defly/client';
|
|
4
4
|
import ExodusClient from '../clients/exodus/client';
|
|
5
|
+
import LuteClient from '../clients/lute/client';
|
|
5
6
|
import KMDWalletClient from '../clients/kmd/client';
|
|
6
7
|
import MnemonicWalletClient from '../clients/mnemonic/client';
|
|
7
8
|
import MyAlgoWalletClient from '../clients/myalgo/client';
|
|
@@ -21,12 +22,14 @@ type ClientTypeMap = {
|
|
|
21
22
|
[PROVIDER_ID.MYALGO]: MyAlgoWalletClient;
|
|
22
23
|
[PROVIDER_ID.PERA]: PeraWalletClient;
|
|
23
24
|
[PROVIDER_ID.WALLETCONNECT]: WalletConnectClient;
|
|
25
|
+
[PROVIDER_ID.LUTE]: LuteClient;
|
|
24
26
|
};
|
|
25
27
|
export declare const createMockClient: <T extends PROVIDER_ID>(providerId: T, clientOptions?: ClientOptions, accounts?: Array<Account>) => ClientTypeMap[T];
|
|
26
28
|
export declare const createAlgoSignerMockInstance: (clientOptions?: ClientOptions, accounts?: Array<Account>) => AlgoSignerClient;
|
|
27
29
|
export declare const createDaffiMockInstance: (clientOptions?: ClientOptions, accounts?: Array<Account>) => DaffiWalletClient;
|
|
28
30
|
export declare const createDeflyMockInstance: (clientOptions?: ClientOptions, accounts?: Array<Account>) => DeflyWalletClient;
|
|
29
31
|
export declare const createExodusMockInstance: (clientOptions?: ClientOptions, accounts?: Array<Account>) => ExodusClient;
|
|
32
|
+
export declare const createLuteMockInstance: (clientOptions?: ClientOptions, accounts?: Array<Account>) => LuteClient;
|
|
30
33
|
export declare const createKmdMockInstance: (clientOptions?: ClientOptions, accounts?: Array<Account>) => KMDWalletClient;
|
|
31
34
|
export declare const createCustomMockInstance: (clientOptions?: ClientOptions, accounts?: Array<Account>) => CustomWalletClient;
|
|
32
35
|
export declare const createMnemonicMockInstance: (clientOptions?: ClientOptions, accounts?: Array<Account>) => MnemonicWalletClient;
|
|
@@ -2,6 +2,7 @@ import type { PROVIDER_ID } from '../constants';
|
|
|
2
2
|
import type { PeraWalletConnect } from '@perawallet/connect';
|
|
3
3
|
import type { DeflyWalletConnect } from '@blockshake/defly-connect';
|
|
4
4
|
import type { DaffiWalletConnect } from '@daffiwallet/connect';
|
|
5
|
+
import type LuteConnect from 'lute-connect';
|
|
5
6
|
import type MyAlgoConnect from '@randlabs/myalgo-connect';
|
|
6
7
|
import type { WalletConnectModalSign, WalletConnectModalSignOptions } from '@walletconnect/modal-sign-html';
|
|
7
8
|
import type algosdk from 'algosdk';
|
|
@@ -10,6 +11,7 @@ import type { PeraWalletConnectOptions } from '../clients/pera/types';
|
|
|
10
11
|
import type { DeflyWalletConnectOptions } from '../clients/defly/types';
|
|
11
12
|
import type { ExodusOptions } from '../clients/exodus/types';
|
|
12
13
|
import type { KmdOptions } from '../clients/kmd/types';
|
|
14
|
+
import type { LuteConnectOptions } from '../clients/lute/types';
|
|
13
15
|
import type { MyAlgoConnectOptions } from '../clients/myalgo/types';
|
|
14
16
|
import type { DaffiWalletConnectOptions } from '../clients/daffi/types';
|
|
15
17
|
import type { NonEmptyArray } from './utilities';
|
|
@@ -36,6 +38,11 @@ export type ProviderConfigMapping = {
|
|
|
36
38
|
clientStatic?: typeof WalletConnectModalSign;
|
|
37
39
|
getDynamicClient?: () => Promise<typeof WalletConnectModalSign>;
|
|
38
40
|
};
|
|
41
|
+
[PROVIDER_ID.LUTE]: {
|
|
42
|
+
clientOptions?: LuteConnectOptions;
|
|
43
|
+
clientStatic?: typeof LuteConnect;
|
|
44
|
+
getDynamicClient?: () => Promise<typeof LuteConnect>;
|
|
45
|
+
};
|
|
39
46
|
[PROVIDER_ID.MYALGO]: {
|
|
40
47
|
clientOptions?: MyAlgoConnectOptions;
|
|
41
48
|
clientStatic?: typeof MyAlgoConnect;
|
|
@@ -101,7 +108,9 @@ type DynamicClient<T> = {
|
|
|
101
108
|
getDynamicClient: () => Promise<T>;
|
|
102
109
|
};
|
|
103
110
|
type OneOfStaticOrDynamicClient<T> = StaticClient<T> | DynamicClient<T>;
|
|
104
|
-
type ProviderDef = (ProviderConfig<PROVIDER_ID.PERA> & OneOfStaticOrDynamicClient<typeof PeraWalletConnect>) | (ProviderConfig<PROVIDER_ID.DEFLY> & OneOfStaticOrDynamicClient<typeof DeflyWalletConnect>) | (ProviderConfig<PROVIDER_ID.DAFFI> & OneOfStaticOrDynamicClient<typeof DaffiWalletConnect>) | (ProviderConfig<PROVIDER_ID.
|
|
111
|
+
type ProviderDef = (ProviderConfig<PROVIDER_ID.PERA> & OneOfStaticOrDynamicClient<typeof PeraWalletConnect>) | (ProviderConfig<PROVIDER_ID.DEFLY> & OneOfStaticOrDynamicClient<typeof DeflyWalletConnect>) | (ProviderConfig<PROVIDER_ID.DAFFI> & OneOfStaticOrDynamicClient<typeof DaffiWalletConnect>) | (ProviderConfig<PROVIDER_ID.LUTE> & OneOfStaticOrDynamicClient<typeof LuteConnect> & {
|
|
112
|
+
clientOptions: LuteConnectOptions;
|
|
113
|
+
}) | (ProviderConfig<PROVIDER_ID.WALLETCONNECT> & OneOfStaticOrDynamicClient<typeof WalletConnectModalSign> & {
|
|
105
114
|
clientOptions: WalletConnectModalSignOptions;
|
|
106
115
|
}) | (ProviderConfig<PROVIDER_ID.MYALGO> & OneOfStaticOrDynamicClient<typeof MyAlgoConnect>) | ProviderConfig<PROVIDER_ID.EXODUS> | ProviderConfig<PROVIDER_ID.KMD> | ProviderConfig<PROVIDER_ID.CUSTOM> | PROVIDER_ID.EXODUS | PROVIDER_ID.KMD | PROVIDER_ID.ALGOSIGNER | PROVIDER_ID.MNEMONIC | PROVIDER_ID.CUSTOM;
|
|
107
116
|
export type ProvidersArray = NonEmptyArray<ProviderDef>;
|