@txnlab/use-wallet 0.0.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 +143 -0
- package/dist/cjs/clients/algosigner.d.ts +62 -0
- package/dist/cjs/clients/base.d.ts +72 -0
- package/dist/cjs/clients/defly.d.ts +51 -0
- package/dist/cjs/clients/exodus.d.ts +52 -0
- package/dist/cjs/clients/index.d.ts +300 -0
- package/dist/cjs/clients/myalgowallet.d.ts +40 -0
- package/dist/cjs/clients/perawallet.d.ts +51 -0
- package/dist/cjs/constants/constants.d.ts +10 -0
- package/dist/cjs/constants/index.d.ts +1 -0
- package/dist/cjs/hooks/index.d.ts +2 -0
- package/dist/cjs/hooks/useConnectWallet.d.ts +22 -0
- package/dist/cjs/hooks/useWallet.d.ts +10 -0
- package/dist/cjs/index.d.ts +3 -0
- package/dist/cjs/index.js +3536 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/media/audio.d.ts +1 -0
- package/dist/cjs/providers/algosigner.d.ts +2 -0
- package/dist/cjs/providers/defly.d.ts +2 -0
- package/dist/cjs/providers/exodus.d.ts +2 -0
- package/dist/cjs/providers/index.d.ts +7 -0
- package/dist/cjs/providers/myalgowallet.d.ts +2 -0
- package/dist/cjs/providers/perawallet.d.ts +2 -0
- package/dist/cjs/store/index.d.ts +1 -0
- package/dist/cjs/store/middelware/immer.d.ts +10 -0
- package/dist/cjs/store/state/walletStore.d.ts +19 -0
- package/dist/cjs/types/api.d.ts +11 -0
- package/dist/cjs/types/index.d.ts +3 -0
- package/dist/cjs/types/node.d.ts +41 -0
- package/dist/cjs/types/wallet.d.ts +47 -0
- package/dist/cjs/utils/index.d.ts +4 -0
- package/dist/esm/clients/algosigner.d.ts +62 -0
- package/dist/esm/clients/base.d.ts +72 -0
- package/dist/esm/clients/defly.d.ts +51 -0
- package/dist/esm/clients/exodus.d.ts +52 -0
- package/dist/esm/clients/index.d.ts +300 -0
- package/dist/esm/clients/myalgowallet.d.ts +40 -0
- package/dist/esm/clients/perawallet.d.ts +51 -0
- package/dist/esm/constants/constants.d.ts +10 -0
- package/dist/esm/constants/index.d.ts +1 -0
- package/dist/esm/hooks/index.d.ts +2 -0
- package/dist/esm/hooks/useConnectWallet.d.ts +22 -0
- package/dist/esm/hooks/useWallet.d.ts +10 -0
- package/dist/esm/index.d.ts +3 -0
- package/dist/esm/index.js +3506 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/media/audio.d.ts +1 -0
- package/dist/esm/providers/algosigner.d.ts +2 -0
- package/dist/esm/providers/defly.d.ts +2 -0
- package/dist/esm/providers/exodus.d.ts +2 -0
- package/dist/esm/providers/index.d.ts +7 -0
- package/dist/esm/providers/myalgowallet.d.ts +2 -0
- package/dist/esm/providers/perawallet.d.ts +2 -0
- package/dist/esm/store/index.d.ts +1 -0
- package/dist/esm/store/middelware/immer.d.ts +10 -0
- package/dist/esm/store/state/walletStore.d.ts +19 -0
- package/dist/esm/types/api.d.ts +11 -0
- package/dist/esm/types/index.d.ts +3 -0
- package/dist/esm/types/node.d.ts +41 -0
- package/dist/esm/types/wallet.d.ts +47 -0
- package/dist/esm/utils/index.d.ts +4 -0
- package/dist/index.d.ts +160 -0
- package/package.json +94 -0
package/README.md
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
### @txnlab/use-wallet
|
|
2
|
+
|
|
3
|
+
React hooks for using Algorand compatible wallets with web applications.
|
|
4
|
+
|
|
5
|
+
### Quick Start
|
|
6
|
+
|
|
7
|
+
Install with Yarn.
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
yarn add @txnlab/use-wallet
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Install with NPM.
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install @txnlab/use-wallet
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Install the peer dependencies if you don't have them.
|
|
20
|
+
|
|
21
|
+
With Yarn.
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
yarn add @blockshake/defly-connect @perawallet/connect @randlabs/myalgo-connect @walletconnect/client algosdk
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
With NPM.
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npm install algosdk @blockshake/defly-connect @perawallet/connect @randlabs/myalgo-connect @walletconnect/client
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Setup the wallet providers
|
|
34
|
+
|
|
35
|
+
```jsx
|
|
36
|
+
import React from "react";
|
|
37
|
+
import { useConnectWallet } from "../../index";
|
|
38
|
+
|
|
39
|
+
type ConnectWalletProps = {
|
|
40
|
+
foo?: string;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export default function ConnectWallet(props: ConnectWalletProps) {
|
|
44
|
+
const { providers, reconnectProviders, accounts, activeAccount } =
|
|
45
|
+
useConnectWallet();
|
|
46
|
+
|
|
47
|
+
// Reconnect the session when the user returns to the dApp
|
|
48
|
+
React.useEffect(() => {
|
|
49
|
+
reconnectProviders();
|
|
50
|
+
}, []);
|
|
51
|
+
|
|
52
|
+
// Use these properties to display connected accounts to users.
|
|
53
|
+
React.useEffect(() => {
|
|
54
|
+
console.log("connected accounts", accounts);
|
|
55
|
+
console.log("active account", activeAccount);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
// Map through the providers, and render "connect", "set active", and "disconnect" buttons
|
|
59
|
+
return (
|
|
60
|
+
<div>
|
|
61
|
+
{providers.map((provider) => (
|
|
62
|
+
<div key={"provider-" + provider.id}>
|
|
63
|
+
<h4>
|
|
64
|
+
<img width={30} height={30} src={provider.icon} />
|
|
65
|
+
{provider.name} {provider.isActive && "[active]"}
|
|
66
|
+
</h4>
|
|
67
|
+
<div>
|
|
68
|
+
{/* If the wallet provider isn't connected, render a "connect" button */}
|
|
69
|
+
{!provider.isConnected && (
|
|
70
|
+
<button onClick={provider.connect}>Connect</button>
|
|
71
|
+
)}
|
|
72
|
+
{/* If the wallet provider is connected and active, render a "disconnect" button */}
|
|
73
|
+
{provider.isConnected && (
|
|
74
|
+
<button onClick={provider.disconnect}>Disonnect</button>
|
|
75
|
+
)}
|
|
76
|
+
{/* If the wallet provider is connected but not active, render a "set active" button */}
|
|
77
|
+
{provider.isConnected && !provider.isActive && (
|
|
78
|
+
<button onClick={provider.setActive}>Set Active</button>
|
|
79
|
+
)}
|
|
80
|
+
</div>
|
|
81
|
+
</div>
|
|
82
|
+
))}
|
|
83
|
+
</div>
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Sign and send transactions
|
|
89
|
+
|
|
90
|
+
```jsx
|
|
91
|
+
const Wallet = (props: WalletProps) => {
|
|
92
|
+
const { activeAccount, signTransactions, sendTransactions } = useWallet();
|
|
93
|
+
|
|
94
|
+
const sendTransaction = async (
|
|
95
|
+
from?: string,
|
|
96
|
+
to?: string,
|
|
97
|
+
amount?: number
|
|
98
|
+
) => {
|
|
99
|
+
if (!from || !to || !amount) {
|
|
100
|
+
throw new Error("Missing transaction params.");
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const params = await algodClient.getTransactionParams().do();
|
|
104
|
+
|
|
105
|
+
const transaction = algosdk.makePaymentTxnWithSuggestedParamsFromObject({
|
|
106
|
+
from,
|
|
107
|
+
to,
|
|
108
|
+
amount,
|
|
109
|
+
suggestedParams: params,
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
const encodedTransaction = algosdk.encodeUnsignedTransaction(transaction);
|
|
113
|
+
const signedTransactions = await signTransactions([encodedTransaction]);
|
|
114
|
+
|
|
115
|
+
const { id } = await sendTransactions(signedTransactions);
|
|
116
|
+
|
|
117
|
+
console.log("Successfully sent transaction. Transaction ID: ", id);
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
if (!activeAccount) {
|
|
121
|
+
return <p>Connect an account first.</p>;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
return (
|
|
125
|
+
<div>
|
|
126
|
+
{
|
|
127
|
+
<button
|
|
128
|
+
onClick={() =>
|
|
129
|
+
sendTransaction(
|
|
130
|
+
activeAccount?.address,
|
|
131
|
+
activeAccount?.address,
|
|
132
|
+
1000
|
|
133
|
+
)
|
|
134
|
+
}
|
|
135
|
+
className="button"
|
|
136
|
+
>
|
|
137
|
+
Sign and send transactions
|
|
138
|
+
</button>
|
|
139
|
+
}
|
|
140
|
+
</div>
|
|
141
|
+
);
|
|
142
|
+
};
|
|
143
|
+
```
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helpful resources:
|
|
3
|
+
* https://github.com/PureStake/algosigner/blob/develop/docs/dApp-integration.md
|
|
4
|
+
*/
|
|
5
|
+
import BaseWallet from "./base";
|
|
6
|
+
import type { InitAlgodClient } from "./base";
|
|
7
|
+
import { PROVIDER_ID } from "../constants";
|
|
8
|
+
import { providers } from "../providers";
|
|
9
|
+
import type { WalletProvider } from "../types";
|
|
10
|
+
import { TransactionsArray } from "../types";
|
|
11
|
+
declare type AlgoSignerTransaction = {
|
|
12
|
+
txn: string;
|
|
13
|
+
signers?: [];
|
|
14
|
+
multisig?: string;
|
|
15
|
+
};
|
|
16
|
+
declare type SupportedLedgers = "MainNet" | "TestNet" | "BetaNet" | "devmodenet";
|
|
17
|
+
declare type AlgoSigner = {
|
|
18
|
+
connect: () => Promise<Record<string, never>>;
|
|
19
|
+
accounts: (ledger: {
|
|
20
|
+
ledger: SupportedLedgers;
|
|
21
|
+
}) => Promise<{
|
|
22
|
+
address: string;
|
|
23
|
+
}[]>;
|
|
24
|
+
signTxn: (transactions: AlgoSignerTransaction[]) => Promise<{
|
|
25
|
+
txID: string;
|
|
26
|
+
blob: string;
|
|
27
|
+
}[]>;
|
|
28
|
+
encoding: {
|
|
29
|
+
msgpackToBase64(transaction: Uint8Array): string;
|
|
30
|
+
byteArrayToString(transaction: Uint8Array): string;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
declare type InitWallet = {
|
|
34
|
+
client: AlgoSigner;
|
|
35
|
+
id: PROVIDER_ID;
|
|
36
|
+
providers: typeof providers;
|
|
37
|
+
};
|
|
38
|
+
declare class AlgoSignerClient extends BaseWallet {
|
|
39
|
+
#private;
|
|
40
|
+
id: PROVIDER_ID;
|
|
41
|
+
provider: WalletProvider;
|
|
42
|
+
constructor(initAlgodClient: InitAlgodClient, initWallet: InitWallet);
|
|
43
|
+
static init(): Promise<AlgoSignerClient>;
|
|
44
|
+
connect(): Promise<{
|
|
45
|
+
accounts: {
|
|
46
|
+
name: string;
|
|
47
|
+
address: string;
|
|
48
|
+
providerId: PROVIDER_ID;
|
|
49
|
+
}[];
|
|
50
|
+
id: PROVIDER_ID;
|
|
51
|
+
name: string;
|
|
52
|
+
icon: string;
|
|
53
|
+
isWalletConnect: boolean;
|
|
54
|
+
}>;
|
|
55
|
+
reconnect(onDisconnect: () => void): Promise<null>;
|
|
56
|
+
disconnect(): Promise<void>;
|
|
57
|
+
formatTransactionsArray(transactions: TransactionsArray): AlgoSignerTransaction[];
|
|
58
|
+
signTransactions(activeAdress: string, transactions: Uint8Array[]): Promise<Uint8Array[]>;
|
|
59
|
+
signEncodedTransactions(transactions: TransactionsArray): Promise<Uint8Array[]>;
|
|
60
|
+
}
|
|
61
|
+
declare const _default: Promise<void | AlgoSignerClient>;
|
|
62
|
+
export default _default;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type _algosdk from "algosdk";
|
|
2
|
+
import { PROVIDER_ID } from "../constants";
|
|
3
|
+
import type { WalletProvider, Asset, Wallet, AccountInfo } from "../types";
|
|
4
|
+
import { ConfirmedTxn } from "../types";
|
|
5
|
+
import { TransactionsArray, TxnInfo } from "../types";
|
|
6
|
+
/** @todo implement audio hack */
|
|
7
|
+
export declare type InitAlgodClient = {
|
|
8
|
+
algosdk: typeof _algosdk;
|
|
9
|
+
token: string;
|
|
10
|
+
server: string;
|
|
11
|
+
port: string;
|
|
12
|
+
};
|
|
13
|
+
export interface BaseWalletInterface {
|
|
14
|
+
connect(onDisconnect: () => void): Promise<Wallet>;
|
|
15
|
+
healthCheck(): Promise<Record<string, never>>;
|
|
16
|
+
disconnect(): Promise<void>;
|
|
17
|
+
reconnect(onDisconnect: () => void): Promise<Wallet | null>;
|
|
18
|
+
decodeTransaction(txn: string, isSigned: boolean): _algosdk.Transaction;
|
|
19
|
+
logEncodedTransaction(txn: string, isSigned: boolean): void;
|
|
20
|
+
groupTransactionsBySender(transactions: TransactionsArray): Record<string, TxnInfo[]>;
|
|
21
|
+
signTransactions(activeAddress: string, transactions: Array<Uint8Array>): Promise<Uint8Array[]>;
|
|
22
|
+
signEncodedTransactions(transactions: TransactionsArray): Promise<Uint8Array[]>;
|
|
23
|
+
sendRawTransactions(transactions: Uint8Array[]): Promise<ConfirmedTxn & {
|
|
24
|
+
id: string;
|
|
25
|
+
}>;
|
|
26
|
+
getAccountInfo(address: string): Promise<AccountInfo>;
|
|
27
|
+
getAssets(address: string): Promise<Asset[]>;
|
|
28
|
+
waitForConfirmation(txId: string, timeout?: number): Promise<ConfirmedTxn>;
|
|
29
|
+
}
|
|
30
|
+
declare abstract class BaseWallet implements BaseWalletInterface {
|
|
31
|
+
algodClient: _algosdk.Algodv2;
|
|
32
|
+
algosdk: typeof _algosdk;
|
|
33
|
+
keepWCAlive: HTMLAudioElement;
|
|
34
|
+
protected abstract id: PROVIDER_ID;
|
|
35
|
+
protected abstract provider: WalletProvider;
|
|
36
|
+
abstract connect(onDisconnect: () => void): Promise<Wallet>;
|
|
37
|
+
abstract disconnect(): Promise<void>;
|
|
38
|
+
abstract reconnect(onDisconnect: () => void): Promise<Wallet | null>;
|
|
39
|
+
abstract signTransactions(activeAdress: string, transactions: Array<Uint8Array>): Promise<Uint8Array[]>;
|
|
40
|
+
abstract signEncodedTransactions(transactions: TransactionsArray): Promise<Uint8Array[]>;
|
|
41
|
+
protected constructor({ algosdk, token, server, port }: InitAlgodClient);
|
|
42
|
+
healthCheck(): Promise<{}>;
|
|
43
|
+
getAccountInfo(address: string): Promise<AccountInfo>;
|
|
44
|
+
getAssets(address: string): Promise<Asset[]>;
|
|
45
|
+
waitForConfirmation(txId: string, timeout?: number): Promise<{
|
|
46
|
+
"confirmed-round": number;
|
|
47
|
+
"global-state-delta": Record<string, unknown>[];
|
|
48
|
+
"pool-error": string;
|
|
49
|
+
txn: {
|
|
50
|
+
sig: Uint8Array;
|
|
51
|
+
txn: import("../types").Txn;
|
|
52
|
+
};
|
|
53
|
+
txId: string;
|
|
54
|
+
}>;
|
|
55
|
+
decodeTransaction: (txn: string, isSigned: boolean) => _algosdk.Transaction;
|
|
56
|
+
logEncodedTransaction(txn: string, isSigned: boolean): void;
|
|
57
|
+
groupTransactionsBySender(transactions: TransactionsArray): Record<string, any>;
|
|
58
|
+
sendRawTransactions(transactions: Uint8Array[]): Promise<{
|
|
59
|
+
"confirmed-round": number;
|
|
60
|
+
"global-state-delta": Record<string, unknown>[];
|
|
61
|
+
"pool-error": string;
|
|
62
|
+
txn: {
|
|
63
|
+
sig: Uint8Array;
|
|
64
|
+
txn: import("../types").Txn;
|
|
65
|
+
};
|
|
66
|
+
txId: string;
|
|
67
|
+
id: any;
|
|
68
|
+
}>;
|
|
69
|
+
keepWCAliveStart(): void;
|
|
70
|
+
keepWCAliveStop(): void;
|
|
71
|
+
}
|
|
72
|
+
export default BaseWallet;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helpful resources:
|
|
3
|
+
* https://github.com/blockshake-io/defly-connect
|
|
4
|
+
*/
|
|
5
|
+
import { providers } from "../providers";
|
|
6
|
+
import type { WalletProvider, Wallet } from "../types";
|
|
7
|
+
import { PROVIDER_ID } from "../constants";
|
|
8
|
+
import type { Transaction } from "algosdk";
|
|
9
|
+
import BaseWallet from "./base";
|
|
10
|
+
import type { InitAlgodClient } from "./base";
|
|
11
|
+
import { TransactionsArray } from "../types";
|
|
12
|
+
import type { DeflyWalletConnect } from "@blockshake/defly-connect";
|
|
13
|
+
export interface DeflyTransaction {
|
|
14
|
+
txn: Transaction;
|
|
15
|
+
/**
|
|
16
|
+
* Optional list of addresses that must sign the transactions.
|
|
17
|
+
* Wallet skips to sign this txn if signers is empty array.
|
|
18
|
+
* If undefined, wallet tries to sign it.
|
|
19
|
+
*/
|
|
20
|
+
signers?: string[];
|
|
21
|
+
}
|
|
22
|
+
declare type InitWallet = {
|
|
23
|
+
id: PROVIDER_ID;
|
|
24
|
+
client: DeflyWalletConnect;
|
|
25
|
+
providers: typeof providers;
|
|
26
|
+
};
|
|
27
|
+
declare class DeflyWalletClient extends BaseWallet {
|
|
28
|
+
#private;
|
|
29
|
+
id: PROVIDER_ID;
|
|
30
|
+
provider: WalletProvider;
|
|
31
|
+
constructor(initAlgodClient: InitAlgodClient, initWallet: InitWallet);
|
|
32
|
+
static init(): Promise<DeflyWalletClient>;
|
|
33
|
+
connect(onDisconnect: () => void): Promise<Wallet>;
|
|
34
|
+
reconnect(onDisconnect: () => void): Promise<{
|
|
35
|
+
accounts: {
|
|
36
|
+
name: string;
|
|
37
|
+
address: string;
|
|
38
|
+
providerId: PROVIDER_ID;
|
|
39
|
+
}[];
|
|
40
|
+
id: PROVIDER_ID;
|
|
41
|
+
name: string;
|
|
42
|
+
icon: string;
|
|
43
|
+
isWalletConnect: boolean;
|
|
44
|
+
} | null>;
|
|
45
|
+
disconnect(): Promise<void>;
|
|
46
|
+
formatTransactionsArray(transactions: TransactionsArray): DeflyTransaction[];
|
|
47
|
+
signTransactions(activeAdress: string, transactions: Uint8Array[]): Promise<Uint8Array[]>;
|
|
48
|
+
signEncodedTransactions(transactions: TransactionsArray): Promise<Uint8Array[]>;
|
|
49
|
+
}
|
|
50
|
+
declare const _default: Promise<void | DeflyWalletClient>;
|
|
51
|
+
export default _default;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helpful resources:
|
|
3
|
+
* https://docs.exodus.com/api-reference/algorand-provider-api/
|
|
4
|
+
*/
|
|
5
|
+
import BaseWallet from "./base";
|
|
6
|
+
import type { InitAlgodClient } from "./base";
|
|
7
|
+
import { PROVIDER_ID } from "../constants";
|
|
8
|
+
import { providers } from "../providers";
|
|
9
|
+
import type { WalletProvider } from "../types";
|
|
10
|
+
import { TransactionsArray } from "../types";
|
|
11
|
+
declare type Bytes = Readonly<Uint8Array>;
|
|
12
|
+
declare type Exodus = {
|
|
13
|
+
isConnected: boolean;
|
|
14
|
+
address: string | null;
|
|
15
|
+
connect: () => Promise<{
|
|
16
|
+
address: string;
|
|
17
|
+
}>;
|
|
18
|
+
disconnect: () => void;
|
|
19
|
+
signAndSendTransaction(transactions: Bytes[]): Promise<{
|
|
20
|
+
txId: string;
|
|
21
|
+
}>;
|
|
22
|
+
signTransaction(transactions: Bytes[]): Promise<Bytes[]>;
|
|
23
|
+
};
|
|
24
|
+
declare type InitWallet = {
|
|
25
|
+
client: Exodus;
|
|
26
|
+
id: PROVIDER_ID;
|
|
27
|
+
providers: typeof providers;
|
|
28
|
+
};
|
|
29
|
+
declare class ExodusClient extends BaseWallet {
|
|
30
|
+
#private;
|
|
31
|
+
id: PROVIDER_ID;
|
|
32
|
+
provider: WalletProvider;
|
|
33
|
+
constructor(initAlgodClient: InitAlgodClient, initWallet: InitWallet);
|
|
34
|
+
static init(): Promise<ExodusClient>;
|
|
35
|
+
connect(): Promise<{
|
|
36
|
+
accounts: {
|
|
37
|
+
name: string;
|
|
38
|
+
address: string;
|
|
39
|
+
providerId: PROVIDER_ID;
|
|
40
|
+
}[];
|
|
41
|
+
id: PROVIDER_ID;
|
|
42
|
+
name: string;
|
|
43
|
+
icon: string;
|
|
44
|
+
isWalletConnect: boolean;
|
|
45
|
+
}>;
|
|
46
|
+
reconnect(onDisconnect: () => void): Promise<null>;
|
|
47
|
+
disconnect(): Promise<void>;
|
|
48
|
+
signTransactions(activeAdress: string, transactions: Array<Uint8Array>): Promise<Uint8Array[]>;
|
|
49
|
+
signEncodedTransactions(transactions: TransactionsArray): Promise<Uint8Array[]>;
|
|
50
|
+
}
|
|
51
|
+
declare const _default: Promise<void | ExodusClient>;
|
|
52
|
+
export default _default;
|
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
import { PROVIDER_ID } from "../constants";
|
|
2
|
+
export declare const clients: {
|
|
3
|
+
"Pera Wallet": Promise<void | {
|
|
4
|
+
"__#1@#client": import("@perawallet/connect/dist/PeraWalletConnect").default;
|
|
5
|
+
id: PROVIDER_ID;
|
|
6
|
+
provider: import("..").WalletProvider;
|
|
7
|
+
connect(onDisconnect: () => void): Promise<import("..").Wallet>;
|
|
8
|
+
reconnect(onDisconnect: () => void): Promise<{
|
|
9
|
+
accounts: {
|
|
10
|
+
name: string;
|
|
11
|
+
address: string;
|
|
12
|
+
providerId: PROVIDER_ID;
|
|
13
|
+
}[];
|
|
14
|
+
id: PROVIDER_ID;
|
|
15
|
+
name: string;
|
|
16
|
+
icon: string;
|
|
17
|
+
isWalletConnect: boolean;
|
|
18
|
+
} | null>;
|
|
19
|
+
disconnect(): Promise<void>;
|
|
20
|
+
formatTransactionsArray(transactions: import("..").TransactionsArray): import("./perawallet").PeraTransaction[];
|
|
21
|
+
signTransactions(activeAdress: string, transactions: Uint8Array[]): Promise<Uint8Array[]>;
|
|
22
|
+
signEncodedTransactions(transactions: import("..").TransactionsArray): Promise<Uint8Array[]>;
|
|
23
|
+
algodClient: import("algosdk").Algodv2;
|
|
24
|
+
algosdk: typeof import("algosdk/dist/types/src/main");
|
|
25
|
+
keepWCAlive: HTMLAudioElement;
|
|
26
|
+
healthCheck(): Promise<{}>;
|
|
27
|
+
getAccountInfo(address: string): Promise<import("..").AccountInfo>;
|
|
28
|
+
getAssets(address: string): Promise<import("..").Asset[]>;
|
|
29
|
+
waitForConfirmation(txId: string, timeout?: number): Promise<{
|
|
30
|
+
"confirmed-round": number;
|
|
31
|
+
"global-state-delta": Record<string, unknown>[];
|
|
32
|
+
"pool-error": string;
|
|
33
|
+
txn: {
|
|
34
|
+
sig: Uint8Array;
|
|
35
|
+
txn: import("..").Txn;
|
|
36
|
+
};
|
|
37
|
+
txId: string;
|
|
38
|
+
}>;
|
|
39
|
+
decodeTransaction: (txn: string, isSigned: boolean) => import("algosdk").Transaction;
|
|
40
|
+
logEncodedTransaction(txn: string, isSigned: boolean): void;
|
|
41
|
+
groupTransactionsBySender(transactions: import("..").TransactionsArray): Record<string, any>;
|
|
42
|
+
sendRawTransactions(transactions: Uint8Array[]): Promise<{
|
|
43
|
+
"confirmed-round": number;
|
|
44
|
+
"global-state-delta": Record<string, unknown>[];
|
|
45
|
+
"pool-error": string;
|
|
46
|
+
txn: {
|
|
47
|
+
sig: Uint8Array;
|
|
48
|
+
txn: import("..").Txn;
|
|
49
|
+
};
|
|
50
|
+
txId: string;
|
|
51
|
+
id: any;
|
|
52
|
+
}>;
|
|
53
|
+
keepWCAliveStart(): void;
|
|
54
|
+
keepWCAliveStop(): void;
|
|
55
|
+
}>;
|
|
56
|
+
"MyAlgo Wallet": Promise<void | {
|
|
57
|
+
"__#2@#client": import("@randlabs/myalgo-connect").default;
|
|
58
|
+
id: PROVIDER_ID;
|
|
59
|
+
provider: import("..").WalletProvider;
|
|
60
|
+
connect(): Promise<{
|
|
61
|
+
accounts: {
|
|
62
|
+
providerId: PROVIDER_ID;
|
|
63
|
+
address: string;
|
|
64
|
+
name: string;
|
|
65
|
+
}[];
|
|
66
|
+
id: PROVIDER_ID;
|
|
67
|
+
name: string;
|
|
68
|
+
icon: string;
|
|
69
|
+
isWalletConnect: boolean;
|
|
70
|
+
}>;
|
|
71
|
+
reconnect(): Promise<null>;
|
|
72
|
+
disconnect(): Promise<void>;
|
|
73
|
+
signTransactions(activeAdress: string, transactions: Uint8Array[]): Promise<Uint8Array[]>;
|
|
74
|
+
signEncodedTransactions(transactions: import("..").TransactionsArray): Promise<Uint8Array[]>;
|
|
75
|
+
algodClient: import("algosdk").Algodv2;
|
|
76
|
+
algosdk: typeof import("algosdk/dist/types/src/main");
|
|
77
|
+
keepWCAlive: HTMLAudioElement;
|
|
78
|
+
healthCheck(): Promise<{}>;
|
|
79
|
+
getAccountInfo(address: string): Promise<import("..").AccountInfo>;
|
|
80
|
+
getAssets(address: string): Promise<import("..").Asset[]>;
|
|
81
|
+
waitForConfirmation(txId: string, timeout?: number): Promise<{
|
|
82
|
+
"confirmed-round": number;
|
|
83
|
+
"global-state-delta": Record<string, unknown>[];
|
|
84
|
+
"pool-error": string;
|
|
85
|
+
txn: {
|
|
86
|
+
sig: Uint8Array;
|
|
87
|
+
txn: import("..").Txn;
|
|
88
|
+
};
|
|
89
|
+
txId: string;
|
|
90
|
+
}>;
|
|
91
|
+
decodeTransaction: (txn: string, isSigned: boolean) => import("algosdk").Transaction;
|
|
92
|
+
logEncodedTransaction(txn: string, isSigned: boolean): void;
|
|
93
|
+
groupTransactionsBySender(transactions: import("..").TransactionsArray): Record<string, any>;
|
|
94
|
+
sendRawTransactions(transactions: Uint8Array[]): Promise<{
|
|
95
|
+
"confirmed-round": number;
|
|
96
|
+
"global-state-delta": Record<string, unknown>[];
|
|
97
|
+
"pool-error": string;
|
|
98
|
+
txn: {
|
|
99
|
+
sig: Uint8Array;
|
|
100
|
+
txn: import("..").Txn;
|
|
101
|
+
};
|
|
102
|
+
txId: string;
|
|
103
|
+
id: any;
|
|
104
|
+
}>;
|
|
105
|
+
keepWCAliveStart(): void;
|
|
106
|
+
keepWCAliveStop(): void;
|
|
107
|
+
}>;
|
|
108
|
+
"Algo Signer": Promise<void | {
|
|
109
|
+
"__#3@#client": {
|
|
110
|
+
connect: () => Promise<Record<string, never>>;
|
|
111
|
+
accounts: (ledger: {
|
|
112
|
+
ledger: "MainNet" | "TestNet" | "BetaNet" | "devmodenet";
|
|
113
|
+
}) => Promise<{
|
|
114
|
+
address: string;
|
|
115
|
+
}[]>;
|
|
116
|
+
signTxn: (transactions: {
|
|
117
|
+
txn: string;
|
|
118
|
+
signers?: [] | undefined;
|
|
119
|
+
multisig?: string | undefined;
|
|
120
|
+
}[]) => Promise<{
|
|
121
|
+
txID: string;
|
|
122
|
+
blob: string;
|
|
123
|
+
}[]>;
|
|
124
|
+
encoding: {
|
|
125
|
+
msgpackToBase64(transaction: Uint8Array): string;
|
|
126
|
+
byteArrayToString(transaction: Uint8Array): string;
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
id: PROVIDER_ID;
|
|
130
|
+
provider: import("..").WalletProvider;
|
|
131
|
+
connect(): Promise<{
|
|
132
|
+
accounts: {
|
|
133
|
+
name: string;
|
|
134
|
+
address: string;
|
|
135
|
+
providerId: PROVIDER_ID;
|
|
136
|
+
}[];
|
|
137
|
+
id: PROVIDER_ID;
|
|
138
|
+
name: string;
|
|
139
|
+
icon: string;
|
|
140
|
+
isWalletConnect: boolean;
|
|
141
|
+
}>;
|
|
142
|
+
reconnect(onDisconnect: () => void): Promise<null>;
|
|
143
|
+
disconnect(): Promise<void>;
|
|
144
|
+
formatTransactionsArray(transactions: import("..").TransactionsArray): {
|
|
145
|
+
txn: string;
|
|
146
|
+
signers?: [] | undefined;
|
|
147
|
+
multisig?: string | undefined;
|
|
148
|
+
}[];
|
|
149
|
+
signTransactions(activeAdress: string, transactions: Uint8Array[]): Promise<Uint8Array[]>;
|
|
150
|
+
signEncodedTransactions(transactions: import("..").TransactionsArray): Promise<Uint8Array[]>;
|
|
151
|
+
algodClient: import("algosdk").Algodv2;
|
|
152
|
+
algosdk: typeof import("algosdk/dist/types/src/main");
|
|
153
|
+
keepWCAlive: HTMLAudioElement;
|
|
154
|
+
healthCheck(): Promise<{}>;
|
|
155
|
+
getAccountInfo(address: string): Promise<import("..").AccountInfo>;
|
|
156
|
+
getAssets(address: string): Promise<import("..").Asset[]>;
|
|
157
|
+
waitForConfirmation(txId: string, timeout?: number): Promise<{
|
|
158
|
+
"confirmed-round": number;
|
|
159
|
+
"global-state-delta": Record<string, unknown>[];
|
|
160
|
+
"pool-error": string;
|
|
161
|
+
txn: {
|
|
162
|
+
sig: Uint8Array;
|
|
163
|
+
txn: import("..").Txn;
|
|
164
|
+
};
|
|
165
|
+
txId: string;
|
|
166
|
+
}>;
|
|
167
|
+
decodeTransaction: (txn: string, isSigned: boolean) => import("algosdk").Transaction;
|
|
168
|
+
logEncodedTransaction(txn: string, isSigned: boolean): void;
|
|
169
|
+
groupTransactionsBySender(transactions: import("..").TransactionsArray): Record<string, any>;
|
|
170
|
+
sendRawTransactions(transactions: Uint8Array[]): Promise<{
|
|
171
|
+
"confirmed-round": number;
|
|
172
|
+
"global-state-delta": Record<string, unknown>[];
|
|
173
|
+
"pool-error": string;
|
|
174
|
+
txn: {
|
|
175
|
+
sig: Uint8Array;
|
|
176
|
+
txn: import("..").Txn;
|
|
177
|
+
};
|
|
178
|
+
txId: string;
|
|
179
|
+
id: any;
|
|
180
|
+
}>;
|
|
181
|
+
keepWCAliveStart(): void;
|
|
182
|
+
keepWCAliveStop(): void;
|
|
183
|
+
}>;
|
|
184
|
+
Defly: Promise<void | {
|
|
185
|
+
"__#4@#client": import("@blockshake/defly-connect/dist/DeflyWalletConnect").default;
|
|
186
|
+
id: PROVIDER_ID;
|
|
187
|
+
provider: import("..").WalletProvider;
|
|
188
|
+
connect(onDisconnect: () => void): Promise<import("..").Wallet>;
|
|
189
|
+
reconnect(onDisconnect: () => void): Promise<{
|
|
190
|
+
accounts: {
|
|
191
|
+
name: string;
|
|
192
|
+
address: string;
|
|
193
|
+
providerId: PROVIDER_ID;
|
|
194
|
+
}[];
|
|
195
|
+
id: PROVIDER_ID;
|
|
196
|
+
name: string;
|
|
197
|
+
icon: string;
|
|
198
|
+
isWalletConnect: boolean;
|
|
199
|
+
} | null>;
|
|
200
|
+
disconnect(): Promise<void>;
|
|
201
|
+
formatTransactionsArray(transactions: import("..").TransactionsArray): import("./defly").DeflyTransaction[];
|
|
202
|
+
signTransactions(activeAdress: string, transactions: Uint8Array[]): Promise<Uint8Array[]>;
|
|
203
|
+
signEncodedTransactions(transactions: import("..").TransactionsArray): Promise<Uint8Array[]>;
|
|
204
|
+
algodClient: import("algosdk").Algodv2;
|
|
205
|
+
algosdk: typeof import("algosdk/dist/types/src/main");
|
|
206
|
+
keepWCAlive: HTMLAudioElement;
|
|
207
|
+
healthCheck(): Promise<{}>;
|
|
208
|
+
getAccountInfo(address: string): Promise<import("..").AccountInfo>;
|
|
209
|
+
getAssets(address: string): Promise<import("..").Asset[]>;
|
|
210
|
+
waitForConfirmation(txId: string, timeout?: number): Promise<{
|
|
211
|
+
"confirmed-round": number;
|
|
212
|
+
"global-state-delta": Record<string, unknown>[];
|
|
213
|
+
"pool-error": string;
|
|
214
|
+
txn: {
|
|
215
|
+
sig: Uint8Array;
|
|
216
|
+
txn: import("..").Txn;
|
|
217
|
+
};
|
|
218
|
+
txId: string;
|
|
219
|
+
}>;
|
|
220
|
+
decodeTransaction: (txn: string, isSigned: boolean) => import("algosdk").Transaction;
|
|
221
|
+
logEncodedTransaction(txn: string, isSigned: boolean): void;
|
|
222
|
+
groupTransactionsBySender(transactions: import("..").TransactionsArray): Record<string, any>;
|
|
223
|
+
sendRawTransactions(transactions: Uint8Array[]): Promise<{
|
|
224
|
+
"confirmed-round": number;
|
|
225
|
+
"global-state-delta": Record<string, unknown>[];
|
|
226
|
+
"pool-error": string;
|
|
227
|
+
txn: {
|
|
228
|
+
sig: Uint8Array;
|
|
229
|
+
txn: import("..").Txn;
|
|
230
|
+
};
|
|
231
|
+
txId: string;
|
|
232
|
+
id: any;
|
|
233
|
+
}>;
|
|
234
|
+
keepWCAliveStart(): void;
|
|
235
|
+
keepWCAliveStop(): void;
|
|
236
|
+
}>;
|
|
237
|
+
Exodus: Promise<void | {
|
|
238
|
+
"__#5@#client": {
|
|
239
|
+
isConnected: boolean;
|
|
240
|
+
address: string | null;
|
|
241
|
+
connect: () => Promise<{
|
|
242
|
+
address: string;
|
|
243
|
+
}>;
|
|
244
|
+
disconnect: () => void;
|
|
245
|
+
signAndSendTransaction(transactions: Readonly<Uint8Array>[]): Promise<{
|
|
246
|
+
txId: string;
|
|
247
|
+
}>;
|
|
248
|
+
signTransaction(transactions: Readonly<Uint8Array>[]): Promise<Readonly<Uint8Array>[]>;
|
|
249
|
+
};
|
|
250
|
+
id: PROVIDER_ID;
|
|
251
|
+
provider: import("..").WalletProvider;
|
|
252
|
+
connect(): Promise<{
|
|
253
|
+
accounts: {
|
|
254
|
+
name: string;
|
|
255
|
+
address: string;
|
|
256
|
+
providerId: PROVIDER_ID;
|
|
257
|
+
}[];
|
|
258
|
+
id: PROVIDER_ID;
|
|
259
|
+
name: string;
|
|
260
|
+
icon: string;
|
|
261
|
+
isWalletConnect: boolean;
|
|
262
|
+
}>;
|
|
263
|
+
reconnect(onDisconnect: () => void): Promise<null>;
|
|
264
|
+
disconnect(): Promise<void>;
|
|
265
|
+
signTransactions(activeAdress: string, transactions: Uint8Array[]): Promise<Uint8Array[]>;
|
|
266
|
+
signEncodedTransactions(transactions: import("..").TransactionsArray): Promise<Uint8Array[]>;
|
|
267
|
+
algodClient: import("algosdk").Algodv2;
|
|
268
|
+
algosdk: typeof import("algosdk/dist/types/src/main");
|
|
269
|
+
keepWCAlive: HTMLAudioElement;
|
|
270
|
+
healthCheck(): Promise<{}>;
|
|
271
|
+
getAccountInfo(address: string): Promise<import("..").AccountInfo>;
|
|
272
|
+
getAssets(address: string): Promise<import("..").Asset[]>;
|
|
273
|
+
waitForConfirmation(txId: string, timeout?: number): Promise<{
|
|
274
|
+
"confirmed-round": number;
|
|
275
|
+
"global-state-delta": Record<string, unknown>[];
|
|
276
|
+
"pool-error": string;
|
|
277
|
+
txn: {
|
|
278
|
+
sig: Uint8Array;
|
|
279
|
+
txn: import("..").Txn;
|
|
280
|
+
};
|
|
281
|
+
txId: string;
|
|
282
|
+
}>;
|
|
283
|
+
decodeTransaction: (txn: string, isSigned: boolean) => import("algosdk").Transaction;
|
|
284
|
+
logEncodedTransaction(txn: string, isSigned: boolean): void;
|
|
285
|
+
groupTransactionsBySender(transactions: import("..").TransactionsArray): Record<string, any>;
|
|
286
|
+
sendRawTransactions(transactions: Uint8Array[]): Promise<{
|
|
287
|
+
"confirmed-round": number;
|
|
288
|
+
"global-state-delta": Record<string, unknown>[];
|
|
289
|
+
"pool-error": string;
|
|
290
|
+
txn: {
|
|
291
|
+
sig: Uint8Array;
|
|
292
|
+
txn: import("..").Txn;
|
|
293
|
+
};
|
|
294
|
+
txId: string;
|
|
295
|
+
id: any;
|
|
296
|
+
}>;
|
|
297
|
+
keepWCAliveStart(): void;
|
|
298
|
+
keepWCAliveStop(): void;
|
|
299
|
+
}>;
|
|
300
|
+
};
|