@txnlab/use-wallet 1.2.0 → 1.2.2
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 +0 -48
- package/dist/cjs/clients/algosigner/client.d.ts +2 -6
- package/dist/cjs/clients/base/base.d.ts +0 -1
- package/dist/cjs/clients/defly/client.d.ts +1 -6
- package/dist/cjs/clients/exodus/client.d.ts +1 -3
- package/dist/cjs/clients/kmd/client.d.ts +1 -2
- package/dist/cjs/clients/myalgo/client.d.ts +1 -3
- package/dist/cjs/clients/pera/client.d.ts +2 -6
- package/dist/cjs/clients/pera/types.d.ts +1 -6
- package/dist/cjs/clients/walletconnect/client.d.ts +2 -6
- package/dist/cjs/hooks/useWallet.d.ts +0 -12
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.js +20 -210
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/utils/encodeNFDTransactionsArray.d.ts +2 -0
- package/dist/cjs/utils/index.d.ts +1 -0
- package/dist/esm/clients/algosigner/client.d.ts +2 -6
- package/dist/esm/clients/base/base.d.ts +0 -1
- package/dist/esm/clients/defly/client.d.ts +1 -6
- package/dist/esm/clients/exodus/client.d.ts +1 -3
- package/dist/esm/clients/kmd/client.d.ts +1 -2
- package/dist/esm/clients/myalgo/client.d.ts +1 -3
- package/dist/esm/clients/pera/client.d.ts +2 -6
- package/dist/esm/clients/pera/types.d.ts +1 -6
- package/dist/esm/clients/walletconnect/client.d.ts +2 -6
- package/dist/esm/hooks/useWallet.d.ts +0 -12
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +20 -211
- package/dist/esm/utils/encodeNFDTransactionsArray.d.ts +2 -0
- package/dist/esm/utils/index.d.ts +1 -0
- package/dist/index.d.ts +6 -65
- package/package.json +4 -4
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import BaseWallet from "../base";
|
|
2
2
|
import { PROVIDER_ID } from "../../constants";
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
3
|
+
import type { Network } from "../../types";
|
|
4
|
+
import type { AlgoSignerClientConstructor, InitParams } from "./types";
|
|
5
5
|
declare class AlgoSignerClient extends BaseWallet {
|
|
6
6
|
#private;
|
|
7
7
|
network: Network;
|
|
@@ -27,9 +27,5 @@ declare class AlgoSignerClient extends BaseWallet {
|
|
|
27
27
|
reconnect(onDisconnect: () => void): Promise<null>;
|
|
28
28
|
disconnect(): Promise<void>;
|
|
29
29
|
signTransactions(connectedAccounts: string[], transactions: Uint8Array[], indexesToSign?: number[], returnGroup?: boolean): Promise<Uint8Array[]>;
|
|
30
|
-
/** @deprecated */
|
|
31
|
-
formatTransactionsArray(transactions: TransactionsArray): AlgoSignerTransaction[];
|
|
32
|
-
/** @deprecated */
|
|
33
|
-
signEncodedTransactions(transactions: TransactionsArray): Promise<Uint8Array[]>;
|
|
34
30
|
}
|
|
35
31
|
export default AlgoSignerClient;
|
|
@@ -10,7 +10,6 @@ declare abstract class BaseClient {
|
|
|
10
10
|
abstract disconnect(): Promise<void>;
|
|
11
11
|
abstract reconnect(onDisconnect: () => void): Promise<Wallet | null>;
|
|
12
12
|
abstract signTransactions(connectedAccounts: string[], transactions: Array<Uint8Array>, indexesToSign?: number[], returnGroup?: boolean): Promise<Uint8Array[]>;
|
|
13
|
-
abstract signEncodedTransactions(transactions: TransactionsArray): Promise<Uint8Array[]>;
|
|
14
13
|
protected constructor(metadata: Metadata, algosdk: typeof _algosdk, algodClient: _algosdk.Algodv2);
|
|
15
14
|
healthCheck(): Promise<{}>;
|
|
16
15
|
getAccountInfo(address: string): Promise<AccountInfo>;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type { Wallet } from "../../types";
|
|
2
2
|
import { PROVIDER_ID } from "../../constants";
|
|
3
3
|
import BaseWallet from "../base";
|
|
4
|
-
import { TransactionsArray } from "../../types";
|
|
5
4
|
import type { Network } from "../../types";
|
|
6
|
-
import {
|
|
5
|
+
import { InitParams, DeflyWalletClientConstructor } from "./types";
|
|
7
6
|
declare class DeflyWalletClient extends BaseWallet {
|
|
8
7
|
#private;
|
|
9
8
|
network: Network;
|
|
@@ -29,9 +28,5 @@ declare class DeflyWalletClient extends BaseWallet {
|
|
|
29
28
|
} | null>;
|
|
30
29
|
disconnect(): Promise<void>;
|
|
31
30
|
signTransactions(connectedAccounts: string[], transactions: Uint8Array[], indexesToSign?: number[], returnGroup?: boolean): Promise<Uint8Array[]>;
|
|
32
|
-
/** @deprecated */
|
|
33
|
-
signEncodedTransactions(transactions: TransactionsArray): Promise<Uint8Array[]>;
|
|
34
|
-
/** @deprecated */
|
|
35
|
-
formatTransactionsArray(transactions: TransactionsArray): DeflyTransaction[];
|
|
36
31
|
}
|
|
37
32
|
export default DeflyWalletClient;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import BaseWallet from "../base";
|
|
2
2
|
import { PROVIDER_ID } from "../../constants";
|
|
3
|
-
import type {
|
|
3
|
+
import type { Network } from "../../types";
|
|
4
4
|
import { InitParams, ExodusClientConstructor } from "./types";
|
|
5
5
|
declare class ExodusClient extends BaseWallet {
|
|
6
6
|
#private;
|
|
@@ -27,7 +27,5 @@ declare class ExodusClient extends BaseWallet {
|
|
|
27
27
|
reconnect(onDisconnect: () => void): Promise<null>;
|
|
28
28
|
disconnect(): Promise<void>;
|
|
29
29
|
signTransactions(connectedAccounts: string[], transactions: Array<Uint8Array>, indexesToSign?: number[], returnGroup?: boolean): Promise<Uint8Array[]>;
|
|
30
|
-
/** @deprecated */
|
|
31
|
-
signEncodedTransactions(transactions: TransactionsArray): Promise<Uint8Array[]>;
|
|
32
30
|
}
|
|
33
31
|
export default ExodusClient;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import BaseWallet from "../base";
|
|
2
2
|
import { PROVIDER_ID } from "../../constants";
|
|
3
|
-
import type { Account, Wallet,
|
|
3
|
+
import type { Account, Wallet, Network } from "../../types";
|
|
4
4
|
import { InitParams, KMDWalletClientConstructor } from "./types";
|
|
5
5
|
declare class KMDWalletClient extends BaseWallet {
|
|
6
6
|
#private;
|
|
@@ -25,6 +25,5 @@ declare class KMDWalletClient extends BaseWallet {
|
|
|
25
25
|
listAccounts(wallet: string, password: string): Promise<Array<Account>>;
|
|
26
26
|
getWalletId(): Promise<string>;
|
|
27
27
|
signTransactions(connectedAccounts: string[], transactions: Uint8Array[], indexesToSign?: number[], returnGroup?: boolean): Promise<Uint8Array[]>;
|
|
28
|
-
signEncodedTransactions(transactions: TransactionsArray): Promise<Uint8Array[]>;
|
|
29
28
|
}
|
|
30
29
|
export default KMDWalletClient;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import BaseWallet from "../base";
|
|
6
6
|
import { PROVIDER_ID } from "../../constants";
|
|
7
|
-
import {
|
|
7
|
+
import { Network } from "../../types";
|
|
8
8
|
import { MyAlgoWalletClientConstructor, InitParams } from "./types";
|
|
9
9
|
declare class MyAlgoWalletClient extends BaseWallet {
|
|
10
10
|
#private;
|
|
@@ -31,7 +31,5 @@ declare class MyAlgoWalletClient extends BaseWallet {
|
|
|
31
31
|
reconnect(): Promise<null>;
|
|
32
32
|
disconnect(): Promise<void>;
|
|
33
33
|
signTransactions(connectedAccounts: string[], transactions: Uint8Array[], indexesToSign?: number[], returnGroup?: boolean): Promise<Uint8Array[]>;
|
|
34
|
-
/** @deprecated */
|
|
35
|
-
signEncodedTransactions(transactions: TransactionsArray): Promise<Uint8Array[]>;
|
|
36
34
|
}
|
|
37
35
|
export default MyAlgoWalletClient;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Wallet,
|
|
1
|
+
import type { Wallet, Network } from "../../types";
|
|
2
2
|
import { PROVIDER_ID } from "../../constants";
|
|
3
3
|
import BaseWallet from "../base";
|
|
4
|
-
import {
|
|
4
|
+
import { PeraWalletClientConstructor, InitParams } from "./types";
|
|
5
5
|
declare class PeraWalletClient extends BaseWallet {
|
|
6
6
|
#private;
|
|
7
7
|
network: Network;
|
|
@@ -27,9 +27,5 @@ declare class PeraWalletClient extends BaseWallet {
|
|
|
27
27
|
} | null>;
|
|
28
28
|
disconnect(): Promise<void>;
|
|
29
29
|
signTransactions(connectedAccounts: string[], transactions: Uint8Array[], indexesToSign?: number[], returnGroup?: boolean): Promise<Uint8Array[]>;
|
|
30
|
-
/** @deprecated */
|
|
31
|
-
formatTransactionsArray(transactions: TransactionsArray): PeraTransaction[];
|
|
32
|
-
/** @deprecated */
|
|
33
|
-
signEncodedTransactions(transactions: TransactionsArray): Promise<Uint8Array[]>;
|
|
34
30
|
}
|
|
35
31
|
export default PeraWalletClient;
|
|
@@ -4,13 +4,8 @@ import type { Transaction } from "algosdk";
|
|
|
4
4
|
import type { AlgodClientOptions, Network, Metadata } from "../../types";
|
|
5
5
|
export declare type ClientOptions = {
|
|
6
6
|
bridge?: string;
|
|
7
|
-
deep_link?: string;
|
|
8
|
-
app_meta?: {
|
|
9
|
-
logo: string;
|
|
10
|
-
name: string;
|
|
11
|
-
main_color: string;
|
|
12
|
-
};
|
|
13
7
|
shouldShowSignTxnToast?: boolean;
|
|
8
|
+
chainId?: 416001 | 416002 | 416003 | 4160;
|
|
14
9
|
};
|
|
15
10
|
export interface PeraTransaction {
|
|
16
11
|
txn: Transaction;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PROVIDER_ID } from "../../constants";
|
|
2
2
|
import BaseWallet from "../base";
|
|
3
|
-
import { Wallet,
|
|
4
|
-
import { WalletConnectClientConstructor, InitParams
|
|
3
|
+
import { Wallet, Network } from "../../types";
|
|
4
|
+
import { WalletConnectClientConstructor, InitParams } from "./types";
|
|
5
5
|
declare class WalletConnectClient extends BaseWallet {
|
|
6
6
|
#private;
|
|
7
7
|
network: Network;
|
|
@@ -28,9 +28,5 @@ declare class WalletConnectClient extends BaseWallet {
|
|
|
28
28
|
check(): boolean;
|
|
29
29
|
disconnect(): Promise<void>;
|
|
30
30
|
signTransactions(connectedAccounts: string[], transactions: Uint8Array[], indexesToSign?: number[], returnGroup?: boolean): Promise<Uint8Array[]>;
|
|
31
|
-
/** @deprecarted */
|
|
32
|
-
formatTransactionsArray(transactions: TransactionsArray): WalletConnectTransaction[];
|
|
33
|
-
/** @deprecated */
|
|
34
|
-
signEncodedTransactions(transactions: TransactionsArray): Promise<Uint8Array[]>;
|
|
35
31
|
}
|
|
36
32
|
export default WalletConnectClient;
|
|
@@ -37,16 +37,4 @@ export default function useWallet(): {
|
|
|
37
37
|
groupTransactionsBySender: (transactions: TransactionsArray) => Promise<Record<string, any>>;
|
|
38
38
|
getAccountInfo: () => Promise<import("../types").AccountInfo>;
|
|
39
39
|
getAssets: () => Promise<import("../types").Asset[]>;
|
|
40
|
-
signEncodedTransactions: (transactions: TransactionsArray) => Promise<Uint8Array[]>;
|
|
41
|
-
sendRawTransactions: (transactions: Uint8Array[], waitRoundsToConfirm?: number) => Promise<{
|
|
42
|
-
"confirmed-round": number;
|
|
43
|
-
"global-state-delta": Record<string, unknown>[];
|
|
44
|
-
"pool-error": string;
|
|
45
|
-
txn: {
|
|
46
|
-
sig: Uint8Array;
|
|
47
|
-
txn: import("../types").Txn;
|
|
48
|
-
};
|
|
49
|
-
txId: string;
|
|
50
|
-
id: any;
|
|
51
|
-
}>;
|
|
52
40
|
};
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { useWallet } from "./hooks";
|
|
2
|
-
export { initializeProviders, reconnectProviders } from "./utils";
|
|
2
|
+
export { initializeProviders, reconnectProviders, encodeNFDTransactionsArray, } from "./utils";
|
|
3
3
|
export { WalletProvider } from "./store";
|
|
4
4
|
export * from "./constants";
|
|
5
5
|
export * from "./types";
|
package/dist/esm/index.js
CHANGED
|
@@ -1166,6 +1166,18 @@ class PeraWalletClient extends BaseClient {
|
|
|
1166
1166
|
acc.push({
|
|
1167
1167
|
txn: this.algosdk.decodeUnsignedTransaction(transactions[i]),
|
|
1168
1168
|
});
|
|
1169
|
+
// If the indexes to be signed is specified, but it's not included in it,
|
|
1170
|
+
// designate that it should not be signed
|
|
1171
|
+
}
|
|
1172
|
+
else if (indexesToSign &&
|
|
1173
|
+
indexesToSign.length &&
|
|
1174
|
+
!indexesToSign.includes(i)) {
|
|
1175
|
+
acc.push({
|
|
1176
|
+
txn: isSigned
|
|
1177
|
+
? this.algosdk.decodeSignedTransaction(transactions[i]).txn
|
|
1178
|
+
: this.algosdk.decodeUnsignedTransaction(transactions[i]),
|
|
1179
|
+
signers: [],
|
|
1180
|
+
});
|
|
1169
1181
|
// If the transaction is unsigned and is to be sent from a connected account,
|
|
1170
1182
|
// designate that it should be signed
|
|
1171
1183
|
}
|
|
@@ -1206,47 +1218,10 @@ class PeraWalletClient extends BaseClient {
|
|
|
1206
1218
|
}, []);
|
|
1207
1219
|
return signedTxns;
|
|
1208
1220
|
}
|
|
1209
|
-
/** @deprecated */
|
|
1210
|
-
formatTransactionsArray(transactions) {
|
|
1211
|
-
const formattedTransactions = [];
|
|
1212
|
-
for (const [type, txn] of transactions) {
|
|
1213
|
-
if (type === "s") {
|
|
1214
|
-
formattedTransactions.push({
|
|
1215
|
-
...this.algosdk.decodeSignedTransaction(new Uint8Array(Buffer.from(txn, "base64"))),
|
|
1216
|
-
signers: [],
|
|
1217
|
-
});
|
|
1218
|
-
}
|
|
1219
|
-
else {
|
|
1220
|
-
formattedTransactions.push({
|
|
1221
|
-
txn: this.algosdk.decodeUnsignedTransaction(new Uint8Array(Buffer.from(txn, "base64"))),
|
|
1222
|
-
});
|
|
1223
|
-
}
|
|
1224
|
-
}
|
|
1225
|
-
return formattedTransactions;
|
|
1226
|
-
}
|
|
1227
|
-
/** @deprecated */
|
|
1228
|
-
async signEncodedTransactions(transactions) {
|
|
1229
|
-
const transactionsToSign = this.formatTransactionsArray(transactions);
|
|
1230
|
-
const result = (await this.#client.signTransaction([
|
|
1231
|
-
transactionsToSign,
|
|
1232
|
-
]));
|
|
1233
|
-
const signedTransactions = [];
|
|
1234
|
-
let resultIndex = 0;
|
|
1235
|
-
for (const [type, txn] of transactions) {
|
|
1236
|
-
if (type === "u") {
|
|
1237
|
-
signedTransactions.push(result[resultIndex]);
|
|
1238
|
-
resultIndex++;
|
|
1239
|
-
}
|
|
1240
|
-
else {
|
|
1241
|
-
signedTransactions.push(new Uint8Array(Buffer.from(txn, "base64")));
|
|
1242
|
-
}
|
|
1243
|
-
}
|
|
1244
|
-
return signedTransactions;
|
|
1245
|
-
}
|
|
1246
1221
|
}
|
|
1247
1222
|
|
|
1248
1223
|
const ICON$6 = "data:image/svg+xml;base64," +
|
|
1249
|
-
"
|
|
1224
|
+
"PHN2ZyB2aWV3Qm94PSIwIDAgMzIgMzIiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPgogIDxjaXJjbGUgZmlsbD0iIzI0NUVDNiIgY3g9IjE2IiBjeT0iMTYiIHI9IjE2Ii8+CiAgPHBvbHlnb24gZmlsbD0iI0ZGRkZGRiIgcG9pbnRzPSIxMi40LDIxLjIgMTQuNSwyMS4yIDE1LjMsMTkuOSAxNi42LDE3LjYgMTguMSwxNC45IDE5LjksMTEuNyAyMC4yLDExLjIgMjAuMywxMS43IDIyLjksMjEuMiAyNSwyMS4yIDIxLjUsOC45IDIxLjQsOC42IDE5LjUsOC42IDE5LjUsOC43IDE3LjgsMTEuOCAxNiwxNC45IDE1LjgsMTQuMSAxNS4yLDExLjcgMTUuMSwxMS41IDE0LjQsOC45IDE0LjMsOC42IDEyLjQsOC42IDEyLjQsOC43IDEwLjcsMTEuOCA4LjksMTUgNy4xLDE4IDUuMywyMS4yIDcuNCwyMS4yIDkuMiwxOCAxMSwxNC44IDEyLjgsMTEuNiAxMy4xLDExLjEgMTMuMiwxMS42IDEzLjcsMTMuNyAxNC40LDE2LjMgMTQuNiwxNy4yIDE0LjIsMTgiLz4KPC9zdmc+";
|
|
1250
1225
|
|
|
1251
1226
|
/**
|
|
1252
1227
|
* Helpful resources:
|
|
@@ -1345,31 +1320,6 @@ class MyAlgoWalletClient extends BaseClient {
|
|
|
1345
1320
|
}, []);
|
|
1346
1321
|
return signedTxns;
|
|
1347
1322
|
}
|
|
1348
|
-
/** @deprecated */
|
|
1349
|
-
async signEncodedTransactions(transactions) {
|
|
1350
|
-
const transactionsToSign = [];
|
|
1351
|
-
const signedRawTransactions = [];
|
|
1352
|
-
for (const [type, txn] of transactions) {
|
|
1353
|
-
if (type === "u") {
|
|
1354
|
-
transactionsToSign.push(txn);
|
|
1355
|
-
}
|
|
1356
|
-
}
|
|
1357
|
-
const result = await this.#client.signTransaction(transactionsToSign);
|
|
1358
|
-
if (!result) {
|
|
1359
|
-
throw new Error("Signing failed.");
|
|
1360
|
-
}
|
|
1361
|
-
let resultIndex = 0;
|
|
1362
|
-
for (const [type, txn] of transactions) {
|
|
1363
|
-
if (type === "u") {
|
|
1364
|
-
signedRawTransactions.push(result[resultIndex].blob);
|
|
1365
|
-
resultIndex++;
|
|
1366
|
-
}
|
|
1367
|
-
else {
|
|
1368
|
-
signedRawTransactions.push(new Uint8Array(Buffer.from(txn, "base64")));
|
|
1369
|
-
}
|
|
1370
|
-
}
|
|
1371
|
-
return signedRawTransactions;
|
|
1372
|
-
}
|
|
1373
1323
|
}
|
|
1374
1324
|
|
|
1375
1325
|
const ICON$5 = "data:image/svg+xml;base64," +
|
|
@@ -1503,43 +1453,6 @@ class DeflyWalletClient extends BaseClient {
|
|
|
1503
1453
|
}, []);
|
|
1504
1454
|
return signedTxns;
|
|
1505
1455
|
}
|
|
1506
|
-
/** @deprecated */
|
|
1507
|
-
async signEncodedTransactions(transactions) {
|
|
1508
|
-
const transactionsToSign = this.formatTransactionsArray(transactions);
|
|
1509
|
-
const result = await this.#client.signTransaction([
|
|
1510
|
-
transactionsToSign,
|
|
1511
|
-
]);
|
|
1512
|
-
const signedTransactions = [];
|
|
1513
|
-
let resultIndex = 0;
|
|
1514
|
-
for (const [type, txn] of transactions) {
|
|
1515
|
-
if (type === "u") {
|
|
1516
|
-
signedTransactions.push(result[resultIndex]);
|
|
1517
|
-
resultIndex++;
|
|
1518
|
-
}
|
|
1519
|
-
else {
|
|
1520
|
-
signedTransactions.push(new Uint8Array(Buffer.from(txn, "base64")));
|
|
1521
|
-
}
|
|
1522
|
-
}
|
|
1523
|
-
return signedTransactions;
|
|
1524
|
-
}
|
|
1525
|
-
/** @deprecated */
|
|
1526
|
-
formatTransactionsArray(transactions) {
|
|
1527
|
-
const formattedTransactions = [];
|
|
1528
|
-
for (const [type, txn] of transactions) {
|
|
1529
|
-
if (type === "s") {
|
|
1530
|
-
formattedTransactions.push({
|
|
1531
|
-
...this.algosdk.decodeSignedTransaction(new Uint8Array(Buffer.from(txn, "base64"))),
|
|
1532
|
-
signers: [],
|
|
1533
|
-
});
|
|
1534
|
-
}
|
|
1535
|
-
else {
|
|
1536
|
-
formattedTransactions.push({
|
|
1537
|
-
txn: this.algosdk.decodeUnsignedTransaction(new Uint8Array(Buffer.from(txn, "base64"))),
|
|
1538
|
-
});
|
|
1539
|
-
}
|
|
1540
|
-
}
|
|
1541
|
-
return formattedTransactions;
|
|
1542
|
-
}
|
|
1543
1456
|
}
|
|
1544
1457
|
|
|
1545
1458
|
const ICON$4 = "data:image/svg+xml;base64," +
|
|
@@ -1656,32 +1569,6 @@ class ExodusClient extends BaseClient {
|
|
|
1656
1569
|
}, []);
|
|
1657
1570
|
return signedTxns;
|
|
1658
1571
|
}
|
|
1659
|
-
/** @deprecated */
|
|
1660
|
-
async signEncodedTransactions(transactions) {
|
|
1661
|
-
const transactionsToSign = [];
|
|
1662
|
-
const signedRawTransactions = [];
|
|
1663
|
-
for (const [type, txn] of transactions) {
|
|
1664
|
-
if (type === "u") {
|
|
1665
|
-
const decoded = this.algosdk.decodeUnsignedTransaction(Buffer.from(txn, "base64"));
|
|
1666
|
-
transactionsToSign.push(decoded.toByte());
|
|
1667
|
-
}
|
|
1668
|
-
}
|
|
1669
|
-
const result = await this.#client.signTransaction(transactionsToSign);
|
|
1670
|
-
if (!result) {
|
|
1671
|
-
throw new Error("Signing failed.");
|
|
1672
|
-
}
|
|
1673
|
-
let resultIndex = 0;
|
|
1674
|
-
for (const [type, txn] of transactions) {
|
|
1675
|
-
if (type === "u") {
|
|
1676
|
-
signedRawTransactions.push(result[resultIndex]);
|
|
1677
|
-
resultIndex++;
|
|
1678
|
-
}
|
|
1679
|
-
else {
|
|
1680
|
-
signedRawTransactions.push(new Uint8Array(Buffer.from(txn, "base64")));
|
|
1681
|
-
}
|
|
1682
|
-
}
|
|
1683
|
-
return signedRawTransactions;
|
|
1684
|
-
}
|
|
1685
1572
|
}
|
|
1686
1573
|
|
|
1687
1574
|
const ICON$3 = "data:image/svg+xml;base64," +
|
|
@@ -1813,43 +1700,6 @@ class AlgoSignerClient extends BaseClient {
|
|
|
1813
1700
|
}, []);
|
|
1814
1701
|
return signedTxns;
|
|
1815
1702
|
}
|
|
1816
|
-
/** @deprecated */
|
|
1817
|
-
formatTransactionsArray(transactions) {
|
|
1818
|
-
const formattedTransactions = transactions.map(([type, txn]) => {
|
|
1819
|
-
const formattedTxn = {
|
|
1820
|
-
txn: txn[1],
|
|
1821
|
-
};
|
|
1822
|
-
if (type === "s") {
|
|
1823
|
-
formattedTxn.signers = [];
|
|
1824
|
-
const decoded = this.algosdk.decodeSignedTransaction(new Uint8Array(Buffer.from(txn, "base64")));
|
|
1825
|
-
formattedTxn.txn = this.#client.encoding.msgpackToBase64(decoded.txn.toByte());
|
|
1826
|
-
}
|
|
1827
|
-
else {
|
|
1828
|
-
const decoded = this.algosdk.decodeUnsignedTransaction(Buffer.from(txn, "base64"));
|
|
1829
|
-
formattedTxn.txn = this.#client.encoding.msgpackToBase64(decoded.toByte());
|
|
1830
|
-
}
|
|
1831
|
-
return formattedTxn;
|
|
1832
|
-
});
|
|
1833
|
-
return formattedTransactions;
|
|
1834
|
-
}
|
|
1835
|
-
/** @deprecated */
|
|
1836
|
-
async signEncodedTransactions(transactions) {
|
|
1837
|
-
const transactionsToSign = this.formatTransactionsArray(transactions);
|
|
1838
|
-
const result = await this.#client.signTxn(transactionsToSign);
|
|
1839
|
-
if (!result) {
|
|
1840
|
-
throw new Error("Signing failed.");
|
|
1841
|
-
}
|
|
1842
|
-
const signedRawTransactions = result.reduce((signedTxns, txn, currentIndex) => {
|
|
1843
|
-
if (txn) {
|
|
1844
|
-
signedTxns.push(new Uint8Array(Buffer.from(txn.blob, "base64")));
|
|
1845
|
-
}
|
|
1846
|
-
if (txn === null) {
|
|
1847
|
-
signedTxns.push(new Uint8Array(Buffer.from(transactions[currentIndex][1], "base64")));
|
|
1848
|
-
}
|
|
1849
|
-
return signedTxns;
|
|
1850
|
-
}, []);
|
|
1851
|
-
return signedRawTransactions;
|
|
1852
|
-
}
|
|
1853
1703
|
}
|
|
1854
1704
|
|
|
1855
1705
|
const ICON$2 = "data:image/svg+xml;base64," +
|
|
@@ -2017,40 +1867,6 @@ class WalletConnectClient extends BaseClient {
|
|
|
2017
1867
|
}, []);
|
|
2018
1868
|
return signedTxns;
|
|
2019
1869
|
}
|
|
2020
|
-
/** @deprecarted */
|
|
2021
|
-
formatTransactionsArray(transactions) {
|
|
2022
|
-
const formattedTransactions = transactions.map((txn) => {
|
|
2023
|
-
const formattedTxn = {
|
|
2024
|
-
txn: txn[1],
|
|
2025
|
-
};
|
|
2026
|
-
if (txn[0] === "s") {
|
|
2027
|
-
const decodedTxn = this.algosdk.decodeSignedTransaction(new Uint8Array(Buffer.from(txn[1], "base64")));
|
|
2028
|
-
formattedTxn.txn = Buffer.from(this.algosdk.encodeUnsignedTransaction(decodedTxn.txn)).toString("base64");
|
|
2029
|
-
formattedTxn.signers = [];
|
|
2030
|
-
}
|
|
2031
|
-
return formattedTxn;
|
|
2032
|
-
});
|
|
2033
|
-
return formattedTransactions;
|
|
2034
|
-
}
|
|
2035
|
-
/** @deprecated */
|
|
2036
|
-
async signEncodedTransactions(transactions) {
|
|
2037
|
-
const transactionsToSign = this.formatTransactionsArray(transactions);
|
|
2038
|
-
const requestParams = [transactionsToSign];
|
|
2039
|
-
const request = formatJsonRpcRequest("algo_signTxn", requestParams);
|
|
2040
|
-
this.keepWCAliveStart();
|
|
2041
|
-
const result = await this.#client.sendCustomRequest(request);
|
|
2042
|
-
this.keepWCAliveStop();
|
|
2043
|
-
const signedRawTransactions = result.reduce((signedTxns, txn, currentIndex) => {
|
|
2044
|
-
if (txn) {
|
|
2045
|
-
signedTxns.push(new Uint8Array(Buffer.from(txn, "base64")));
|
|
2046
|
-
}
|
|
2047
|
-
if (txn === null) {
|
|
2048
|
-
signedTxns.push(new Uint8Array(Buffer.from(transactions[currentIndex][1], "base64")));
|
|
2049
|
-
}
|
|
2050
|
-
return signedTxns;
|
|
2051
|
-
}, []);
|
|
2052
|
-
return signedRawTransactions;
|
|
2053
|
-
}
|
|
2054
1870
|
}
|
|
2055
1871
|
|
|
2056
1872
|
const ICON$1 = "data:image/svg+xml;base64," +
|
|
@@ -2216,9 +2032,6 @@ class KMDWalletClient extends BaseClient {
|
|
|
2216
2032
|
}, []);
|
|
2217
2033
|
return formattedTxns;
|
|
2218
2034
|
}
|
|
2219
|
-
signEncodedTransactions(transactions) {
|
|
2220
|
-
throw new Error("Method not implemented.");
|
|
2221
|
-
}
|
|
2222
2035
|
}
|
|
2223
2036
|
|
|
2224
2037
|
const ICON = "data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8'%3f%3e %3c!-- Generated by Pixelmator Pro 3.2.2 --%3e %3csvg width='409' height='210' viewBox='0 0 409 210' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3ctext id='MNEMONIC' xml:space='preserve' x='0' y='129' font-family='Helvetica' font-size='72' fill='black'%3eMNEMONIC%3c/text%3e%3c/svg%3e";
|
|
@@ -2536,14 +2349,6 @@ function useWallet() {
|
|
|
2536
2349
|
const walletClient = await getClient(activeAccount?.providerId);
|
|
2537
2350
|
return walletClient?.groupTransactionsBySender(transactions);
|
|
2538
2351
|
};
|
|
2539
|
-
const signEncodedTransactions = async (transactions) => {
|
|
2540
|
-
const walletClient = await getClient(activeAccount?.providerId);
|
|
2541
|
-
return await walletClient?.signEncodedTransactions(transactions);
|
|
2542
|
-
};
|
|
2543
|
-
const sendRawTransactions = async (transactions, waitRoundsToConfirm) => {
|
|
2544
|
-
const walletClient = await getClient(activeAccount?.providerId);
|
|
2545
|
-
return await walletClient?.sendRawTransactions(transactions, waitRoundsToConfirm);
|
|
2546
|
-
};
|
|
2547
2352
|
return {
|
|
2548
2353
|
clients,
|
|
2549
2354
|
providers,
|
|
@@ -2561,8 +2366,6 @@ function useWallet() {
|
|
|
2561
2366
|
groupTransactionsBySender,
|
|
2562
2367
|
getAccountInfo,
|
|
2563
2368
|
getAssets,
|
|
2564
|
-
signEncodedTransactions,
|
|
2565
|
-
sendRawTransactions,
|
|
2566
2369
|
};
|
|
2567
2370
|
}
|
|
2568
2371
|
|
|
@@ -2609,4 +2412,10 @@ const reconnectProviders = async (providers) => {
|
|
|
2609
2412
|
}
|
|
2610
2413
|
};
|
|
2611
2414
|
|
|
2612
|
-
|
|
2415
|
+
function encodeNFDTransactionsArray(transactionsArray) {
|
|
2416
|
+
return transactionsArray.map(([type, txn]) => {
|
|
2417
|
+
return new Uint8Array(Buffer.from(txn, "base64"));
|
|
2418
|
+
});
|
|
2419
|
+
}
|
|
2420
|
+
|
|
2421
|
+
export { DEFAULT_NETWORK$1 as DEFAULT_NETWORK, DEFAULT_NODE_BASEURL, DEFAULT_NODE_PORT, DEFAULT_NODE_TOKEN, PROVIDER_ID, clientStore as WalletProvider, AlgoSignerClient as algosigner, DeflyWalletClient as defly, encodeNFDTransactionsArray, ExodusClient as exodus, initializeProviders, KMDWalletClient as kmd, MnemonicWalletClient as mnemonic, MyAlgoWalletClient as myalgo, PeraWalletClient as pera, reconnectProviders, useWallet, WalletConnectClient as walletconnect };
|