@txnlab/use-wallet 2.4.0 → 2.6.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 -6
- package/dist/cjs/index.js +591 -29
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/src/clients/base/base.d.ts +1 -1
- package/dist/cjs/src/clients/index.d.ts +4 -2
- package/dist/cjs/src/clients/kibisis/client.d.ts +73 -0
- package/dist/cjs/src/clients/kibisis/constants.d.ts +37 -0
- package/dist/cjs/src/clients/kibisis/index.d.ts +2 -0
- package/dist/cjs/src/clients/kibisis/types.d.ts +86 -0
- package/dist/cjs/src/clients/kibisis/utils.d.ts +9 -0
- package/dist/cjs/src/clients/kibisis/utils.test.d.ts +1 -0
- package/dist/cjs/src/clients/magic/client.d.ts +35 -0
- package/dist/cjs/src/clients/magic/constants.d.ts +1 -0
- package/dist/cjs/src/clients/magic/index.d.ts +2 -0
- package/dist/cjs/src/clients/magic/types.d.ts +27 -0
- package/dist/cjs/src/constants/constants.d.ts +3 -1
- package/dist/cjs/src/testUtils/mockClients.d.ts +6 -0
- package/dist/cjs/src/types/providers.d.ts +19 -2
- package/dist/cjs/src/types/wallet.d.ts +2 -1
- package/dist/esm/index.js +590 -30
- package/dist/esm/src/clients/base/base.d.ts +1 -1
- package/dist/esm/src/clients/index.d.ts +4 -2
- package/dist/esm/src/clients/kibisis/client.d.ts +73 -0
- package/dist/esm/src/clients/kibisis/constants.d.ts +37 -0
- package/dist/esm/src/clients/kibisis/index.d.ts +2 -0
- package/dist/esm/src/clients/kibisis/types.d.ts +86 -0
- package/dist/esm/src/clients/kibisis/utils.d.ts +9 -0
- package/dist/esm/src/clients/kibisis/utils.test.d.ts +1 -0
- package/dist/esm/src/clients/magic/client.d.ts +35 -0
- package/dist/esm/src/clients/magic/constants.d.ts +1 -0
- package/dist/esm/src/clients/magic/index.d.ts +2 -0
- package/dist/esm/src/clients/magic/types.d.ts +27 -0
- package/dist/esm/src/constants/constants.d.ts +3 -1
- package/dist/esm/src/testUtils/mockClients.d.ts +6 -0
- package/dist/esm/src/types/providers.d.ts +19 -2
- package/dist/esm/src/types/wallet.d.ts +2 -1
- package/dist/index.d.ts +160 -6
- package/package.json +20 -7
|
@@ -8,7 +8,7 @@ declare abstract class BaseClient {
|
|
|
8
8
|
keepWCAlive: HTMLAudioElement;
|
|
9
9
|
metadata: Metadata;
|
|
10
10
|
static metadata: Metadata;
|
|
11
|
-
abstract connect(onDisconnect: () => void): Promise<Wallet>;
|
|
11
|
+
abstract connect(onDisconnect: () => void, arg?: any): Promise<Wallet>;
|
|
12
12
|
abstract disconnect(): Promise<void>;
|
|
13
13
|
abstract reconnect(onDisconnect: () => void): Promise<Wallet | null>;
|
|
14
14
|
abstract signTransactions(connectedAccounts: string[], txnGroups: Uint8Array[] | Uint8Array[][], indexesToSign?: number[], returnGroup?: boolean): Promise<Uint8Array[]>;
|
|
@@ -6,12 +6,14 @@ import exodus from './exodus';
|
|
|
6
6
|
import algosigner from './algosigner';
|
|
7
7
|
import lute from './lute';
|
|
8
8
|
import walletconnect from './walletconnect2';
|
|
9
|
+
import magic from './magic';
|
|
9
10
|
import kmd from './kmd';
|
|
10
11
|
import mnemonic from './mnemonic';
|
|
11
12
|
import { CustomProvider } from './custom/types';
|
|
12
13
|
import custom from './custom';
|
|
13
|
-
|
|
14
|
+
import kibisis from './kibisis';
|
|
15
|
+
export { pera, myalgo, defly, exodus, algosigner, lute, walletconnect, kmd, mnemonic, custom, CustomProvider, kibisis, magic };
|
|
14
16
|
declare const _default: {
|
|
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;
|
|
17
|
+
[x: string]: typeof pera | typeof myalgo | typeof defly | typeof exodus | typeof algosigner | typeof lute | typeof walletconnect | typeof kmd | typeof mnemonic | typeof custom | typeof kibisis | typeof magic | typeof daffi;
|
|
16
18
|
};
|
|
17
19
|
export default _default;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import BaseClient from '../base';
|
|
2
|
+
import { PROVIDER_ID } from '../../constants';
|
|
3
|
+
import type { InitParams, Network, Wallet } from '../../types';
|
|
4
|
+
import type { Arc0027Account, KibisisClientConstructor, ProviderMethods, SendRequestWithTimeoutOptions } from './types';
|
|
5
|
+
declare class KibisisClient extends BaseClient {
|
|
6
|
+
genesisHash: string;
|
|
7
|
+
methods: ProviderMethods[];
|
|
8
|
+
network: Network;
|
|
9
|
+
constructor({ metadata, algosdk, algodClient, genesisHash, methods, network }: KibisisClientConstructor);
|
|
10
|
+
static metadata: {
|
|
11
|
+
id: PROVIDER_ID;
|
|
12
|
+
icon: string;
|
|
13
|
+
isWalletConnect: boolean;
|
|
14
|
+
name: string;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* public static functions
|
|
18
|
+
*/
|
|
19
|
+
static init({ algodOptions, algosdkStatic, network }: InitParams<PROVIDER_ID.KIBISIS>): Promise<BaseClient | null>;
|
|
20
|
+
static mapAccountsToWallet(accounts: Arc0027Account[]): Wallet;
|
|
21
|
+
static sendRequestWithTimeout<Params, Result>({ method, params, timeout, reference }: SendRequestWithTimeoutOptions<Params>): Promise<Result | undefined>;
|
|
22
|
+
/**
|
|
23
|
+
* private functions
|
|
24
|
+
*/
|
|
25
|
+
private convertBytesToBase64;
|
|
26
|
+
private convertBase64ToBytes;
|
|
27
|
+
/**
|
|
28
|
+
* Calls the enable method on the provider that returns the authorized accounts.
|
|
29
|
+
* @returns {Arc0027Account[]} the authorized accounts.
|
|
30
|
+
* @throws {METHOD_CANCELED_ERROR} if the method was cancelled by the user.
|
|
31
|
+
* @throws {METHOD_NOT_SUPPORTED_ERROR} if the method is not supported for the configured network.
|
|
32
|
+
* @throws {METHOD_TIMED_OUT_ERROR} if the method timed out by lack of response.
|
|
33
|
+
* @throws {NETWORK_NOT_SUPPORTED_ERROR} if the network is not supported for the configured network.
|
|
34
|
+
* @throws {UNKNOWN_ERROR} if the response result was empty.
|
|
35
|
+
*/
|
|
36
|
+
private enable;
|
|
37
|
+
/**
|
|
38
|
+
* Convenience function that gets the provider information and updates the supported methods. This should be called
|
|
39
|
+
* before interacting with the provider to ensure methods are supported.
|
|
40
|
+
* @throws {METHOD_TIMED_OUT_ERROR} if the method timed out by lack of response.
|
|
41
|
+
* @throws {NETWORK_NOT_SUPPORTED_ERROR} if the network is not supported for the configured network.
|
|
42
|
+
* @throws {UNKNOWN_ERROR} if the response result was empty.
|
|
43
|
+
*/
|
|
44
|
+
private refreshSupportedMethods;
|
|
45
|
+
/**
|
|
46
|
+
* Calls the signTxns methods to sign the supplied transactions.
|
|
47
|
+
* @param {Arc0001SignTxns[]} txns - the unsigned or signed transactions as defined in ARC-0001.
|
|
48
|
+
* @returns {(string | null)[]} the authorized accounts.
|
|
49
|
+
* @throws {INVALID_INPUT_ERROR} if computed group ID for the txns does not match the assigned group ID.
|
|
50
|
+
* @throws {INVALID_GROUP_ID_ERROR} if the unsigned txns is malformed or not conforming to ARC-0001.
|
|
51
|
+
* @throws {METHOD_CANCELED_ERROR} if the method was cancelled by the user.
|
|
52
|
+
* @throws {METHOD_NOT_SUPPORTED_ERROR} if the method is not supported for the configured network.
|
|
53
|
+
* @throws {METHOD_TIMED_OUT_ERROR} if the method timed out by lack of response.
|
|
54
|
+
* @throws {NETWORK_NOT_SUPPORTED_ERROR} if the network is not supported for the configured network.
|
|
55
|
+
* @throws {UNAUTHORIZED_SIGNER_ERROR} if a signer in the request is not authorized by the provider.
|
|
56
|
+
* @throws {UNKNOWN_ERROR} if the response result was empty.
|
|
57
|
+
*/
|
|
58
|
+
private signTxns;
|
|
59
|
+
/**
|
|
60
|
+
* Validates whether a method is supported with the provider.
|
|
61
|
+
* @param {ProviderMethods} method - the method to validate.
|
|
62
|
+
* @throws {METHOD_NOT_SUPPORTED_ERROR} if the method is not supported for the configured network.
|
|
63
|
+
*/
|
|
64
|
+
private validateMethod;
|
|
65
|
+
/**
|
|
66
|
+
* public functions
|
|
67
|
+
*/
|
|
68
|
+
connect(): Promise<Wallet>;
|
|
69
|
+
disconnect(): Promise<void>;
|
|
70
|
+
reconnect(): Promise<Wallet | null>;
|
|
71
|
+
signTransactions(connectedAccounts: string[], transactions: Uint8Array[], indexesToSign?: number[], returnGroup?: boolean): Promise<Uint8Array[]>;
|
|
72
|
+
}
|
|
73
|
+
export default KibisisClient;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* arc-0027
|
|
3
|
+
*/
|
|
4
|
+
export declare const ARC_0027_PREFIX = "arc0027";
|
|
5
|
+
export declare const ARC_0027_CHANNEL_NAME: string;
|
|
6
|
+
export declare const ARC_0027_ENABLE_REQUEST: string;
|
|
7
|
+
export declare const ARC_0027_GET_PROVIDERS_REQUEST: string;
|
|
8
|
+
export declare const ARC_0027_PROVIDER_ID = "f6d1c86b-4493-42fb-b88d-a62407b4cdf6";
|
|
9
|
+
export declare const ARC_0027_SIGN_TXNS_REQUEST: string;
|
|
10
|
+
/**
|
|
11
|
+
* errors
|
|
12
|
+
*/
|
|
13
|
+
export declare const UNKNOWN_ERROR = 4000;
|
|
14
|
+
export declare const METHOD_CANCELED_ERROR = 4001;
|
|
15
|
+
export declare const METHOD_TIMED_OUT_ERROR = 4002;
|
|
16
|
+
export declare const METHOD_NOT_SUPPORTED_ERROR = 4003;
|
|
17
|
+
export declare const NETWORK_NOT_SUPPORTED_ERROR = 4004;
|
|
18
|
+
export declare const UNAUTHORIZED_SIGNER_ERROR = 4100;
|
|
19
|
+
export declare const INVALID_INPUT_ERROR = 4200;
|
|
20
|
+
export declare const INVALID_GROUP_ID_ERROR = 4201;
|
|
21
|
+
/**
|
|
22
|
+
* genesis hashes
|
|
23
|
+
*/
|
|
24
|
+
export declare const ALGORAND_BETANET_GENESIS_HASH = "mFgazF+2uRS1tMiL9dsj01hJGySEmPN28B/TjjvpVW0=";
|
|
25
|
+
export declare const ALGORAND_MAINNET_GENESIS_HASH = "wGHE2Pwdvd7S12BL5FaOP20EGYesN73ktiC1qzkkit8=";
|
|
26
|
+
export declare const ALGORAND_TESTNET_GENESIS_HASH = "SGO1GKSzyE7IEPItTxCByw9x8FmnrCDexi9/cOUJOiI=";
|
|
27
|
+
export declare const VOI_TESTNET_GENESIS_HASH = "IXnoWtviVVJW5LGivNFc0Dq14V3kqaXuK2u5OQrdVZo=";
|
|
28
|
+
/**
|
|
29
|
+
* timeouts
|
|
30
|
+
*/
|
|
31
|
+
export declare const DEFAULT_REQUEST_TIMEOUT = 180000;
|
|
32
|
+
export declare const LOWER_REQUEST_TIMEOUT = 750;
|
|
33
|
+
export declare const UPPER_REQUEST_TIMEOUT = 300000;
|
|
34
|
+
/**
|
|
35
|
+
* icon
|
|
36
|
+
*/
|
|
37
|
+
export declare const ICON: string;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type algosdk from 'algosdk';
|
|
2
|
+
import type { Metadata, Network } from '../../types';
|
|
3
|
+
export interface Arc0001SignTxns {
|
|
4
|
+
authAddr?: string;
|
|
5
|
+
multisig?: string;
|
|
6
|
+
signers?: string[];
|
|
7
|
+
stxn?: string;
|
|
8
|
+
txn: string;
|
|
9
|
+
}
|
|
10
|
+
export interface Arc0027Account {
|
|
11
|
+
address: string;
|
|
12
|
+
name?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface KibisisClientConstructor {
|
|
15
|
+
metadata: Metadata;
|
|
16
|
+
algosdk: typeof algosdk;
|
|
17
|
+
algodClient: algosdk.Algodv2;
|
|
18
|
+
genesisHash: string;
|
|
19
|
+
methods: ProviderMethods[];
|
|
20
|
+
network: Network;
|
|
21
|
+
}
|
|
22
|
+
export interface NetworkConfiguration {
|
|
23
|
+
genesisHash: string;
|
|
24
|
+
genesisId: string;
|
|
25
|
+
methods: ProviderMethods[];
|
|
26
|
+
}
|
|
27
|
+
export type ProviderMethods = 'enable' | 'getProviders' | 'postTxns' | 'signAndPostTxns' | 'signBytes' | 'signTxns';
|
|
28
|
+
export interface SendRequestWithTimeoutOptions<Params> {
|
|
29
|
+
method: ProviderMethods;
|
|
30
|
+
params: Params;
|
|
31
|
+
reference: string;
|
|
32
|
+
timeout?: number;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* message schema
|
|
36
|
+
*/
|
|
37
|
+
export interface RequestMessage<Params> {
|
|
38
|
+
id: string;
|
|
39
|
+
params: Params;
|
|
40
|
+
reference: string;
|
|
41
|
+
}
|
|
42
|
+
export interface ResponseMessage<Result = undefined, ErrorData = undefined> {
|
|
43
|
+
error?: ResponseError<ErrorData>;
|
|
44
|
+
id: string;
|
|
45
|
+
reference: string;
|
|
46
|
+
requestId: string;
|
|
47
|
+
result?: Result;
|
|
48
|
+
}
|
|
49
|
+
export interface ResponseError<Data = undefined> {
|
|
50
|
+
code: number;
|
|
51
|
+
data: Data;
|
|
52
|
+
message: string;
|
|
53
|
+
providerId: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* message payloads
|
|
57
|
+
*/
|
|
58
|
+
export interface EnableParams {
|
|
59
|
+
genesisHash: string;
|
|
60
|
+
providerId: string;
|
|
61
|
+
}
|
|
62
|
+
export interface EnableResult {
|
|
63
|
+
accounts: Arc0027Account[];
|
|
64
|
+
genesisHash: string;
|
|
65
|
+
genesisId: string;
|
|
66
|
+
providerId: string;
|
|
67
|
+
sessionId?: string;
|
|
68
|
+
}
|
|
69
|
+
export interface GetProvidersParams {
|
|
70
|
+
providerId: string;
|
|
71
|
+
}
|
|
72
|
+
export interface GetProvidersResult {
|
|
73
|
+
host: string;
|
|
74
|
+
icon: string;
|
|
75
|
+
name: string;
|
|
76
|
+
networks: NetworkConfiguration[];
|
|
77
|
+
providerId: string;
|
|
78
|
+
}
|
|
79
|
+
export interface SignTxnsParams {
|
|
80
|
+
providerId: string;
|
|
81
|
+
txns: Arc0001SignTxns[];
|
|
82
|
+
}
|
|
83
|
+
export interface SignTxnsResult {
|
|
84
|
+
providerId: string;
|
|
85
|
+
stxns: (string | null)[];
|
|
86
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generates a UUID version 4 string. This function attempts to use the `crypto.randomUUID()` function from the Web
|
|
3
|
+
* Crypto API if it is available, otherwise it uses a polyfill method.
|
|
4
|
+
*
|
|
5
|
+
* NOTE: `crypto.randomUUID()` is not available in non-secure contexts; only localhost and HTTPS.
|
|
6
|
+
* @returns {string} a valid UUID version 4 string.
|
|
7
|
+
* @see {@link https://stackoverflow.com/a/2117523}
|
|
8
|
+
*/
|
|
9
|
+
export declare function generateUuid(): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import BaseClient from '../base';
|
|
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 { MagicAuthConstructor, MagicAuthConnectOptions } from './types';
|
|
7
|
+
declare class MagicAuth extends BaseClient {
|
|
8
|
+
#private;
|
|
9
|
+
clientOptions?: MagicAuthConnectOptions;
|
|
10
|
+
network: Network;
|
|
11
|
+
constructor({ metadata, client, clientOptions, algosdk, algodClient, network }: MagicAuthConstructor);
|
|
12
|
+
static metadata: {
|
|
13
|
+
id: PROVIDER_ID;
|
|
14
|
+
name: string;
|
|
15
|
+
icon: string;
|
|
16
|
+
isWalletConnect: boolean;
|
|
17
|
+
};
|
|
18
|
+
static init({ clientOptions, algodOptions, clientStatic, getDynamicClient, algosdkStatic, network }: InitParams<PROVIDER_ID.MAGIC>): Promise<BaseClient | null>;
|
|
19
|
+
connect(_: () => void, arg?: any): Promise<Wallet>;
|
|
20
|
+
reconnect(): Promise<{
|
|
21
|
+
accounts: {
|
|
22
|
+
name: string;
|
|
23
|
+
address: string;
|
|
24
|
+
providerId: PROVIDER_ID;
|
|
25
|
+
email: string;
|
|
26
|
+
}[];
|
|
27
|
+
id: PROVIDER_ID;
|
|
28
|
+
name: string;
|
|
29
|
+
icon: string;
|
|
30
|
+
isWalletConnect: boolean;
|
|
31
|
+
} | null>;
|
|
32
|
+
disconnect(): Promise<void>;
|
|
33
|
+
signTransactions(connectedAccounts: string[], txnGroups: Uint8Array[] | Uint8Array[][], indexesToSign?: number[], returnGroup?: boolean): Promise<Uint8Array[]>;
|
|
34
|
+
}
|
|
35
|
+
export default MagicAuth;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ICON: string;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type algosdk from 'algosdk';
|
|
2
|
+
import type { Network } from '../../types/node';
|
|
3
|
+
import type { Metadata } from '../../types/wallet';
|
|
4
|
+
import { SDKBase, InstanceWithExtensions } from '@magic-sdk/provider';
|
|
5
|
+
import { AlgorandExtension } from '@magic-ext/algorand';
|
|
6
|
+
export type MagicAuthConnectOptions = {
|
|
7
|
+
apiKey: string;
|
|
8
|
+
};
|
|
9
|
+
export interface MagicAuthTransaction {
|
|
10
|
+
txn: string;
|
|
11
|
+
/**
|
|
12
|
+
* Optional list of addresses that must sign the transactions.
|
|
13
|
+
* Wallet skips to sign this txn if signers is empty array.
|
|
14
|
+
* If undefined, wallet tries to sign it.
|
|
15
|
+
*/
|
|
16
|
+
signers?: string[];
|
|
17
|
+
}
|
|
18
|
+
export type MagicAuthConstructor = {
|
|
19
|
+
metadata: Metadata;
|
|
20
|
+
client: InstanceWithExtensions<SDKBase, {
|
|
21
|
+
algorand: AlgorandExtension;
|
|
22
|
+
}>;
|
|
23
|
+
clientOptions: MagicAuthConnectOptions;
|
|
24
|
+
algosdk: typeof algosdk;
|
|
25
|
+
algodClient: algosdk.Algodv2;
|
|
26
|
+
network: Network;
|
|
27
|
+
};
|
|
@@ -9,8 +9,10 @@ export declare enum PROVIDER_ID {
|
|
|
9
9
|
ALGOSIGNER = "algosigner",
|
|
10
10
|
DEFLY = "defly",
|
|
11
11
|
EXODUS = "exodus",
|
|
12
|
+
KIBISIS = "kibisis",
|
|
12
13
|
WALLETCONNECT = "walletconnect",
|
|
13
|
-
MNEMONIC = "mnemonic"
|
|
14
|
+
MNEMONIC = "mnemonic",
|
|
15
|
+
MAGIC = "magic"
|
|
14
16
|
}
|
|
15
17
|
export declare const DEFAULT_NETWORK: Network;
|
|
16
18
|
export declare const DEFAULT_NODE_BASEURL = "https://mainnet-api.algonode.cloud";
|
|
@@ -3,6 +3,7 @@ import DaffiWalletClient from '../clients/daffi/client';
|
|
|
3
3
|
import DeflyWalletClient from '../clients/defly/client';
|
|
4
4
|
import ExodusClient from '../clients/exodus/client';
|
|
5
5
|
import LuteClient from '../clients/lute/client';
|
|
6
|
+
import KibisisClient from '../clients/kibisis/client';
|
|
6
7
|
import KMDWalletClient from '../clients/kmd/client';
|
|
7
8
|
import MnemonicWalletClient from '../clients/mnemonic/client';
|
|
8
9
|
import MyAlgoWalletClient from '../clients/myalgo/client';
|
|
@@ -11,6 +12,7 @@ import WalletConnectClient from '../clients/walletconnect2/client';
|
|
|
11
12
|
import { PROVIDER_ID } from '../constants';
|
|
12
13
|
import type { Account, ClientOptions } from '../types';
|
|
13
14
|
import CustomWalletClient from '../clients/custom/client';
|
|
15
|
+
import MagicAuthClient from '../clients/magic/client';
|
|
14
16
|
type ClientTypeMap = {
|
|
15
17
|
[PROVIDER_ID.ALGOSIGNER]: AlgoSignerClient;
|
|
16
18
|
[PROVIDER_ID.CUSTOM]: CustomWalletClient;
|
|
@@ -23,6 +25,8 @@ type ClientTypeMap = {
|
|
|
23
25
|
[PROVIDER_ID.PERA]: PeraWalletClient;
|
|
24
26
|
[PROVIDER_ID.WALLETCONNECT]: WalletConnectClient;
|
|
25
27
|
[PROVIDER_ID.LUTE]: LuteClient;
|
|
28
|
+
[PROVIDER_ID.KIBISIS]: KibisisClient;
|
|
29
|
+
[PROVIDER_ID.MAGIC]: MagicAuthClient;
|
|
26
30
|
};
|
|
27
31
|
export declare const createMockClient: <T extends PROVIDER_ID>(providerId: T, clientOptions?: ClientOptions, accounts?: Array<Account>) => ClientTypeMap[T];
|
|
28
32
|
export declare const createAlgoSignerMockInstance: (clientOptions?: ClientOptions, accounts?: Array<Account>) => AlgoSignerClient;
|
|
@@ -30,10 +34,12 @@ export declare const createDaffiMockInstance: (clientOptions?: ClientOptions, ac
|
|
|
30
34
|
export declare const createDeflyMockInstance: (clientOptions?: ClientOptions, accounts?: Array<Account>) => DeflyWalletClient;
|
|
31
35
|
export declare const createExodusMockInstance: (clientOptions?: ClientOptions, accounts?: Array<Account>) => ExodusClient;
|
|
32
36
|
export declare const createLuteMockInstance: (clientOptions?: ClientOptions, accounts?: Array<Account>) => LuteClient;
|
|
37
|
+
export declare const createKibisisMockInstance: (clientOptions?: ClientOptions, accounts?: Array<Account>) => KibisisClient;
|
|
33
38
|
export declare const createKmdMockInstance: (clientOptions?: ClientOptions, accounts?: Array<Account>) => KMDWalletClient;
|
|
34
39
|
export declare const createCustomMockInstance: (clientOptions?: ClientOptions, accounts?: Array<Account>) => CustomWalletClient;
|
|
35
40
|
export declare const createMnemonicMockInstance: (clientOptions?: ClientOptions, accounts?: Array<Account>) => MnemonicWalletClient;
|
|
36
41
|
export declare const createMyAlgoMockInstance: (clientOptions?: ClientOptions, accounts?: Array<Account>) => MyAlgoWalletClient;
|
|
37
42
|
export declare const createPeraMockInstance: (clientOptions?: ClientOptions, accounts?: Array<Account>) => PeraWalletClient;
|
|
38
43
|
export declare const createWalletConnectMockInstance: (clientOptions?: ClientOptions, accounts?: Array<Account>) => WalletConnectClient;
|
|
44
|
+
export declare const createMagicMockInstance: (clientOptions?: ClientOptions, accounts?: Array<Account>) => MagicAuthClient;
|
|
39
45
|
export {};
|
|
@@ -17,6 +17,7 @@ import type { DaffiWalletConnectOptions } from '../clients/daffi/types';
|
|
|
17
17
|
import type { NonEmptyArray } from './utilities';
|
|
18
18
|
import type BaseClient from '../clients/base';
|
|
19
19
|
import type { CustomOptions } from '../clients/custom/types';
|
|
20
|
+
import { Magic } from 'magic-sdk';
|
|
20
21
|
export type ProviderConfigMapping = {
|
|
21
22
|
[PROVIDER_ID.PERA]: {
|
|
22
23
|
clientOptions?: PeraWalletConnectOptions;
|
|
@@ -73,6 +74,18 @@ export type ProviderConfigMapping = {
|
|
|
73
74
|
clientStatic?: undefined;
|
|
74
75
|
getDynamicClient?: undefined;
|
|
75
76
|
};
|
|
77
|
+
[PROVIDER_ID.KIBISIS]: {
|
|
78
|
+
clientOptions?: undefined;
|
|
79
|
+
clientStatic?: undefined;
|
|
80
|
+
getDynamicClient?: undefined;
|
|
81
|
+
};
|
|
82
|
+
[PROVIDER_ID.MAGIC]: {
|
|
83
|
+
clientOptions?: {
|
|
84
|
+
apiKey: string;
|
|
85
|
+
};
|
|
86
|
+
clientStatic?: undefined;
|
|
87
|
+
getDynamicClient?: () => Promise<typeof Magic>;
|
|
88
|
+
};
|
|
76
89
|
};
|
|
77
90
|
/**
|
|
78
91
|
* Enforces correct configuration given for each provider. For example,
|
|
@@ -108,11 +121,15 @@ type DynamicClient<T> = {
|
|
|
108
121
|
getDynamicClient: () => Promise<T>;
|
|
109
122
|
};
|
|
110
123
|
type OneOfStaticOrDynamicClient<T> = StaticClient<T> | DynamicClient<T>;
|
|
111
|
-
type ProviderDef = (ProviderConfig<PROVIDER_ID.PERA> & OneOfStaticOrDynamicClient<typeof PeraWalletConnect>) | (ProviderConfig<PROVIDER_ID.
|
|
124
|
+
type ProviderDef = (ProviderConfig<PROVIDER_ID.PERA> & OneOfStaticOrDynamicClient<typeof PeraWalletConnect>) | (ProviderConfig<PROVIDER_ID.MAGIC> & OneOfStaticOrDynamicClient<typeof Magic> & {
|
|
125
|
+
clientOptions: {
|
|
126
|
+
apiKey: string;
|
|
127
|
+
};
|
|
128
|
+
}) | (ProviderConfig<PROVIDER_ID.DEFLY> & OneOfStaticOrDynamicClient<typeof DeflyWalletConnect>) | (ProviderConfig<PROVIDER_ID.DAFFI> & OneOfStaticOrDynamicClient<typeof DaffiWalletConnect>) | (ProviderConfig<PROVIDER_ID.LUTE> & OneOfStaticOrDynamicClient<typeof LuteConnect> & {
|
|
112
129
|
clientOptions: LuteConnectOptions;
|
|
113
130
|
}) | (ProviderConfig<PROVIDER_ID.WALLETCONNECT> & OneOfStaticOrDynamicClient<typeof WalletConnectModalSign> & {
|
|
114
131
|
clientOptions: WalletConnectModalSignOptions;
|
|
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;
|
|
132
|
+
}) | (ProviderConfig<PROVIDER_ID.MYALGO> & OneOfStaticOrDynamicClient<typeof MyAlgoConnect>) | ProviderConfig<PROVIDER_ID.EXODUS> | ProviderConfig<PROVIDER_ID.KMD> | ProviderConfig<PROVIDER_ID.CUSTOM> | ProviderConfig<PROVIDER_ID.KIBISIS> | PROVIDER_ID.EXODUS | PROVIDER_ID.KMD | PROVIDER_ID.ALGOSIGNER | PROVIDER_ID.MNEMONIC | PROVIDER_ID.CUSTOM | PROVIDER_ID.KIBISIS;
|
|
116
133
|
export type ProvidersArray = NonEmptyArray<ProviderDef>;
|
|
117
134
|
export type WalletClient = BaseClient;
|
|
118
135
|
export type SupportedProviders = Partial<Record<PROVIDER_ID, WalletClient | null>>;
|
|
@@ -4,12 +4,13 @@ export interface Account {
|
|
|
4
4
|
name: string;
|
|
5
5
|
address: string;
|
|
6
6
|
authAddr?: string;
|
|
7
|
+
email?: string;
|
|
7
8
|
}
|
|
8
9
|
export type Provider = {
|
|
9
10
|
accounts: Account[];
|
|
10
11
|
isActive: boolean;
|
|
11
12
|
isConnected: boolean;
|
|
12
|
-
connect: () => Promise<void>;
|
|
13
|
+
connect: (arg?: any) => Promise<void>;
|
|
13
14
|
disconnect: () => Promise<void>;
|
|
14
15
|
reconnect: () => Promise<void>;
|
|
15
16
|
setActiveProvider: () => void;
|