@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.
@@ -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,2 @@
1
+ import lute from './client';
2
+ export default lute;
@@ -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
+ };
@@ -4,6 +4,7 @@ export declare enum PROVIDER_ID {
4
4
  CUSTOM = "custom",
5
5
  PERA = "pera",
6
6
  DAFFI = "daffi",
7
+ LUTE = "lute",
7
8
  MYALGO = "myalgo",
8
9
  ALGOSIGNER = "algosigner",
9
10
  DEFLY = "defly",
@@ -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.WALLETCONNECT> & OneOfStaticOrDynamicClient<typeof WalletConnectModalSign> & {
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>;
package/dist/index.d.ts CHANGED
@@ -2,6 +2,7 @@ import algosdk from 'algosdk';
2
2
  import { PeraWalletConnect } from '@perawallet/connect';
3
3
  import { DeflyWalletConnect } from '@blockshake/defly-connect';
4
4
  import { DaffiWalletConnect } from '@daffiwallet/connect';
5
+ import LuteConnect from 'lute-connect';
5
6
  import MyAlgoConnect from '@randlabs/myalgo-connect';
6
7
  import { WalletConnectModalSignOptions, WalletConnectModalSign } from '@walletconnect/modal-sign-html';
7
8
  import React from 'react';
@@ -72,6 +73,7 @@ declare enum PROVIDER_ID {
72
73
  CUSTOM = "custom",
73
74
  PERA = "pera",
74
75
  DAFFI = "daffi",
76
+ LUTE = "lute",
75
77
  MYALGO = "myalgo",
76
78
  ALGOSIGNER = "algosigner",
77
79
  DEFLY = "defly",
@@ -213,6 +215,18 @@ type KMDWalletClientConstructor = {
213
215
  network: Network;
214
216
  };
215
217
 
218
+ type LuteConnectOptions = {
219
+ siteName: string;
220
+ };
221
+ type LuteClientConstructor = {
222
+ metadata: Metadata;
223
+ client: LuteConnect;
224
+ clientOptions?: LuteConnectOptions;
225
+ algosdk: typeof algosdk;
226
+ algodClient: algosdk.Algodv2;
227
+ network: Network;
228
+ };
229
+
216
230
  /**
217
231
  * Helpful resources:
218
232
  * https://github.com/randlabs/myalgo-connect
@@ -325,6 +339,11 @@ type ProviderConfigMapping = {
325
339
  clientStatic?: typeof WalletConnectModalSign;
326
340
  getDynamicClient?: () => Promise<typeof WalletConnectModalSign>;
327
341
  };
342
+ [PROVIDER_ID.LUTE]: {
343
+ clientOptions?: LuteConnectOptions;
344
+ clientStatic?: typeof LuteConnect;
345
+ getDynamicClient?: () => Promise<typeof LuteConnect>;
346
+ };
328
347
  [PROVIDER_ID.MYALGO]: {
329
348
  clientOptions?: MyAlgoConnectOptions;
330
349
  clientStatic?: typeof MyAlgoConnect;
@@ -390,7 +409,9 @@ type DynamicClient<T> = {
390
409
  getDynamicClient: () => Promise<T>;
391
410
  };
392
411
  type OneOfStaticOrDynamicClient<T> = StaticClient<T> | DynamicClient<T>;
393
- 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.WALLETCONNECT> & OneOfStaticOrDynamicClient<typeof WalletConnectModalSign> & {
412
+ 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> & {
413
+ clientOptions: LuteConnectOptions;
414
+ }) | (ProviderConfig<PROVIDER_ID.WALLETCONNECT> & OneOfStaticOrDynamicClient<typeof WalletConnectModalSign> & {
394
415
  clientOptions: WalletConnectModalSignOptions;
395
416
  }) | (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;
396
417
  type ProvidersArray = NonEmptyArray<ProviderDef>;
@@ -611,6 +632,35 @@ declare class AlgoSignerClient extends BaseClient {
611
632
  getAuthAddress(address: string): string | undefined;
612
633
  }
613
634
 
635
+ declare class LuteClient extends BaseClient {
636
+ #private;
637
+ clientOptions?: LuteConnectOptions;
638
+ network: Network;
639
+ constructor({ metadata, client, clientOptions, algosdk, algodClient, network }: LuteClientConstructor);
640
+ static metadata: {
641
+ id: PROVIDER_ID;
642
+ name: string;
643
+ icon: string;
644
+ isWalletConnect: boolean;
645
+ };
646
+ static init({ clientOptions, algodOptions, clientStatic, getDynamicClient, algosdkStatic, network }: InitParams<PROVIDER_ID.LUTE>): Promise<BaseClient | null>;
647
+ connect(): Promise<{
648
+ accounts: {
649
+ name: string;
650
+ address: string;
651
+ providerId: PROVIDER_ID;
652
+ }[];
653
+ id: PROVIDER_ID;
654
+ name: string;
655
+ icon: string;
656
+ isWalletConnect: boolean;
657
+ }>;
658
+ reconnect(): Promise<null>;
659
+ disconnect(): Promise<void>;
660
+ shouldSignTxnObject(txn: DecodedTransaction | DecodedSignedTransaction, addresses: string[], indexesToSign: number[] | undefined, idx: number): boolean;
661
+ signTransactions(connectedAccounts: string[], transactions: Uint8Array[], indexesToSign?: number[], returnGroup?: boolean): Promise<Uint8Array[]>;
662
+ }
663
+
614
664
  type WalletConnectClientConstructor = {
615
665
  metadata: Metadata;
616
666
  client: WalletConnectModalSign;
@@ -759,4 +809,4 @@ interface InitializeProvidersOptions {
759
809
  }
760
810
  declare function useInitializeProviders({ providers, nodeConfig, algosdkStatic, debug }: InitializeProvidersOptions): Partial<Record<PROVIDER_ID, BaseClient | null>> | null;
761
811
 
762
- export { Account, AccountInfo, AlgodClientOptions, Asset, ClientOptions, CommonInitParams, ConfirmedTxn, CustomProvider, DEFAULT_NETWORK, DEFAULT_NODE_BASEURL, DEFAULT_NODE_PORT, DEFAULT_NODE_TOKEN, DecodedSignedTransaction, DecodedTransaction, InitParams, Metadata, Network, NodeConfig, PROVIDER_ID, Provider, ProviderConfig, ProviderConfigMapping, ProvidersArray, PublicNetwork, RawTxnResponse, SupportedProviders, TransactionsArray, Txn, TxnInfo, TxnType, Wallet, WalletClient, WalletProvider, AlgoSignerClient as algosigner, CustomWalletClient as custom, DeflyWalletClient as defly, encodeNFDTransactionsArray, ExodusClient as exodus, KMDWalletClient as kmd, MnemonicWalletClient as mnemonic, MyAlgoWalletClient as myalgo, PeraWalletClient as pera, reconnectProviders, useInitializeProviders, useWallet, WalletConnectClient as walletconnect };
812
+ export { Account, AccountInfo, AlgodClientOptions, Asset, ClientOptions, CommonInitParams, ConfirmedTxn, CustomProvider, DEFAULT_NETWORK, DEFAULT_NODE_BASEURL, DEFAULT_NODE_PORT, DEFAULT_NODE_TOKEN, DecodedSignedTransaction, DecodedTransaction, InitParams, Metadata, Network, NodeConfig, PROVIDER_ID, Provider, ProviderConfig, ProviderConfigMapping, ProvidersArray, PublicNetwork, RawTxnResponse, SupportedProviders, TransactionsArray, Txn, TxnInfo, TxnType, Wallet, WalletClient, WalletProvider, AlgoSignerClient as algosigner, CustomWalletClient as custom, DeflyWalletClient as defly, encodeNFDTransactionsArray, ExodusClient as exodus, KMDWalletClient as kmd, LuteClient as lute, MnemonicWalletClient as mnemonic, MyAlgoWalletClient as myalgo, PeraWalletClient as pera, reconnectProviders, useInitializeProviders, useWallet, WalletConnectClient as walletconnect };
package/package.json CHANGED
@@ -1,18 +1,8 @@
1
1
  {
2
2
  "name": "@txnlab/use-wallet",
3
- "publishConfig": {
4
- "access": "public",
5
- "registry": "https://registry.npmjs.org/"
6
- },
7
- "repository": {
8
- "type": "git",
9
- "url": "https://github.com/txnlab/use-wallet"
10
- },
11
- "bugs": {
12
- "url": "https://github.com/txnlab/use-wallet/issues"
13
- },
14
- "homepage": "https://txnlab.github.io/use-wallet",
15
- "version": "2.3.1",
3
+ "author": "TxnLab, Inc.",
4
+ "version": "2.4.0",
5
+ "license": "MIT",
16
6
  "description": "React hooks for using Algorand compatible wallets in dApps.",
17
7
  "scripts": {
18
8
  "dev": "yarn storybook",
@@ -28,8 +18,27 @@
28
18
  "pre-release": "yarn lint && yarn format && yarn check-types && yarn test && yarn build",
29
19
  "release": "release-it"
30
20
  },
31
- "author": "txnlab",
32
- "license": "MIT",
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "https://github.com/txnlab/use-wallet"
24
+ },
25
+ "bugs": {
26
+ "url": "https://github.com/txnlab/use-wallet/issues"
27
+ },
28
+ "publishConfig": {
29
+ "access": "public",
30
+ "registry": "https://registry.npmjs.org/"
31
+ },
32
+ "types": "dist/index.d.ts",
33
+ "main": "dist/cjs/index.js",
34
+ "module": "dist/esm/index.js",
35
+ "files": [
36
+ "dist"
37
+ ],
38
+ "dependencies": {
39
+ "immer": "^9.0.15",
40
+ "zustand": "^4.3.8"
41
+ },
33
42
  "devDependencies": {
34
43
  "@babel/core": "^7.16.0",
35
44
  "@babel/preset-env": "^7.16.4",
@@ -37,7 +46,6 @@
37
46
  "@babel/preset-typescript": "^7.16.0",
38
47
  "@blockshake/defly-connect": "^1.1.5",
39
48
  "@daffiwallet/connect": "^1.0.3",
40
- "@mdx-js/react": "^2.3.0",
41
49
  "@perawallet/connect": "^1.2.1",
42
50
  "@randlabs/myalgo-connect": "^1.4.2",
43
51
  "@release-it/conventional-changelog": "^7.0.0",
@@ -58,8 +66,6 @@
58
66
  "@typescript-eslint/parser": "^5.55.0",
59
67
  "@walletconnect/modal-sign-html": "^2.5.4",
60
68
  "algosdk": "^2.1.0",
61
- "babel-jest": "^29.1.2",
62
- "babel-loader": "^9.0.0",
63
69
  "buffer": "^6.0.3",
64
70
  "commitizen": "4.3.0",
65
71
  "css-loader": "^6.5.1",
@@ -70,17 +76,15 @@
70
76
  "eslint-plugin-react": "^7.32.2",
71
77
  "eslint-plugin-react-hooks": "^4.6.0",
72
78
  "gh-pages": "^5.0.0",
73
- "html-webpack-plugin": "^5.5.0",
74
- "identity-obj-proxy": "^3.0.0",
75
79
  "jest": "^29.1.2",
76
80
  "jest-canvas-mock": "^2.5.0",
77
81
  "jest-environment-jsdom": "^29.3.1",
82
+ "lute-connect": "^1.0.7",
78
83
  "postcss": "^8.4.17",
79
84
  "prettier": "2.8.8",
80
85
  "react": "^18.2.0",
81
86
  "react-dom": "^18.2.0",
82
87
  "release-it": "^16.1.0",
83
- "require-from-string": "^2.0.2",
84
88
  "rimraf": "^5.0.1",
85
89
  "rollup": "^3.3.0",
86
90
  "rollup-plugin-analyzer": "^4.0.0",
@@ -122,16 +126,6 @@
122
126
  "optional": true
123
127
  }
124
128
  },
125
- "main": "dist/cjs/index.js",
126
- "module": "dist/esm/index.js",
127
- "files": [
128
- "dist"
129
- ],
130
- "types": "dist/index.d.ts",
131
- "dependencies": {
132
- "immer": "^9.0.15",
133
- "zustand": "^4.3.8"
134
- },
135
129
  "config": {
136
130
  "commitizen": {
137
131
  "path": "cz-conventional-changelog"