@txnlab/use-wallet 1.2.0 → 1.2.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/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 +2 -2
|
@@ -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/cjs/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/cjs/index.js
CHANGED
|
@@ -1168,6 +1168,18 @@ class PeraWalletClient extends BaseClient {
|
|
|
1168
1168
|
acc.push({
|
|
1169
1169
|
txn: this.algosdk.decodeUnsignedTransaction(transactions[i]),
|
|
1170
1170
|
});
|
|
1171
|
+
// If the indexes to be signed is specified, but it's not included in it,
|
|
1172
|
+
// designate that it should not be signed
|
|
1173
|
+
}
|
|
1174
|
+
else if (indexesToSign &&
|
|
1175
|
+
indexesToSign.length &&
|
|
1176
|
+
!indexesToSign.includes(i)) {
|
|
1177
|
+
acc.push({
|
|
1178
|
+
txn: isSigned
|
|
1179
|
+
? this.algosdk.decodeSignedTransaction(transactions[i]).txn
|
|
1180
|
+
: this.algosdk.decodeUnsignedTransaction(transactions[i]),
|
|
1181
|
+
signers: [],
|
|
1182
|
+
});
|
|
1171
1183
|
// If the transaction is unsigned and is to be sent from a connected account,
|
|
1172
1184
|
// designate that it should be signed
|
|
1173
1185
|
}
|
|
@@ -1208,47 +1220,10 @@ class PeraWalletClient extends BaseClient {
|
|
|
1208
1220
|
}, []);
|
|
1209
1221
|
return signedTxns;
|
|
1210
1222
|
}
|
|
1211
|
-
/** @deprecated */
|
|
1212
|
-
formatTransactionsArray(transactions) {
|
|
1213
|
-
const formattedTransactions = [];
|
|
1214
|
-
for (const [type, txn] of transactions) {
|
|
1215
|
-
if (type === "s") {
|
|
1216
|
-
formattedTransactions.push({
|
|
1217
|
-
...this.algosdk.decodeSignedTransaction(new Uint8Array(Buffer.from(txn, "base64"))),
|
|
1218
|
-
signers: [],
|
|
1219
|
-
});
|
|
1220
|
-
}
|
|
1221
|
-
else {
|
|
1222
|
-
formattedTransactions.push({
|
|
1223
|
-
txn: this.algosdk.decodeUnsignedTransaction(new Uint8Array(Buffer.from(txn, "base64"))),
|
|
1224
|
-
});
|
|
1225
|
-
}
|
|
1226
|
-
}
|
|
1227
|
-
return formattedTransactions;
|
|
1228
|
-
}
|
|
1229
|
-
/** @deprecated */
|
|
1230
|
-
async signEncodedTransactions(transactions) {
|
|
1231
|
-
const transactionsToSign = this.formatTransactionsArray(transactions);
|
|
1232
|
-
const result = (await this.#client.signTransaction([
|
|
1233
|
-
transactionsToSign,
|
|
1234
|
-
]));
|
|
1235
|
-
const signedTransactions = [];
|
|
1236
|
-
let resultIndex = 0;
|
|
1237
|
-
for (const [type, txn] of transactions) {
|
|
1238
|
-
if (type === "u") {
|
|
1239
|
-
signedTransactions.push(result[resultIndex]);
|
|
1240
|
-
resultIndex++;
|
|
1241
|
-
}
|
|
1242
|
-
else {
|
|
1243
|
-
signedTransactions.push(new Uint8Array(Buffer.from(txn, "base64")));
|
|
1244
|
-
}
|
|
1245
|
-
}
|
|
1246
|
-
return signedTransactions;
|
|
1247
|
-
}
|
|
1248
1223
|
}
|
|
1249
1224
|
|
|
1250
1225
|
const ICON$6 = "data:image/svg+xml;base64," +
|
|
1251
|
-
"
|
|
1226
|
+
"PHN2ZyB2aWV3Qm94PSIwIDAgMzIgMzIiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPgogIDxjaXJjbGUgZmlsbD0iIzI0NUVDNiIgY3g9IjE2IiBjeT0iMTYiIHI9IjE2Ii8+CiAgPHBvbHlnb24gZmlsbD0iI0ZGRkZGRiIgcG9pbnRzPSIxMi40LDIxLjIgMTQuNSwyMS4yIDE1LjMsMTkuOSAxNi42LDE3LjYgMTguMSwxNC45IDE5LjksMTEuNyAyMC4yLDExLjIgMjAuMywxMS43IDIyLjksMjEuMiAyNSwyMS4yIDIxLjUsOC45IDIxLjQsOC42IDE5LjUsOC42IDE5LjUsOC43IDE3LjgsMTEuOCAxNiwxNC45IDE1LjgsMTQuMSAxNS4yLDExLjcgMTUuMSwxMS41IDE0LjQsOC45IDE0LjMsOC42IDEyLjQsOC42IDEyLjQsOC43IDEwLjcsMTEuOCA4LjksMTUgNy4xLDE4IDUuMywyMS4yIDcuNCwyMS4yIDkuMiwxOCAxMSwxNC44IDEyLjgsMTEuNiAxMy4xLDExLjEgMTMuMiwxMS42IDEzLjcsMTMuNyAxNC40LDE2LjMgMTQuNiwxNy4yIDE0LjIsMTgiLz4KPC9zdmc+";
|
|
1252
1227
|
|
|
1253
1228
|
/**
|
|
1254
1229
|
* Helpful resources:
|
|
@@ -1347,31 +1322,6 @@ class MyAlgoWalletClient extends BaseClient {
|
|
|
1347
1322
|
}, []);
|
|
1348
1323
|
return signedTxns;
|
|
1349
1324
|
}
|
|
1350
|
-
/** @deprecated */
|
|
1351
|
-
async signEncodedTransactions(transactions) {
|
|
1352
|
-
const transactionsToSign = [];
|
|
1353
|
-
const signedRawTransactions = [];
|
|
1354
|
-
for (const [type, txn] of transactions) {
|
|
1355
|
-
if (type === "u") {
|
|
1356
|
-
transactionsToSign.push(txn);
|
|
1357
|
-
}
|
|
1358
|
-
}
|
|
1359
|
-
const result = await this.#client.signTransaction(transactionsToSign);
|
|
1360
|
-
if (!result) {
|
|
1361
|
-
throw new Error("Signing failed.");
|
|
1362
|
-
}
|
|
1363
|
-
let resultIndex = 0;
|
|
1364
|
-
for (const [type, txn] of transactions) {
|
|
1365
|
-
if (type === "u") {
|
|
1366
|
-
signedRawTransactions.push(result[resultIndex].blob);
|
|
1367
|
-
resultIndex++;
|
|
1368
|
-
}
|
|
1369
|
-
else {
|
|
1370
|
-
signedRawTransactions.push(new Uint8Array(Buffer.from(txn, "base64")));
|
|
1371
|
-
}
|
|
1372
|
-
}
|
|
1373
|
-
return signedRawTransactions;
|
|
1374
|
-
}
|
|
1375
1325
|
}
|
|
1376
1326
|
|
|
1377
1327
|
const ICON$5 = "data:image/svg+xml;base64," +
|
|
@@ -1505,43 +1455,6 @@ class DeflyWalletClient extends BaseClient {
|
|
|
1505
1455
|
}, []);
|
|
1506
1456
|
return signedTxns;
|
|
1507
1457
|
}
|
|
1508
|
-
/** @deprecated */
|
|
1509
|
-
async signEncodedTransactions(transactions) {
|
|
1510
|
-
const transactionsToSign = this.formatTransactionsArray(transactions);
|
|
1511
|
-
const result = await this.#client.signTransaction([
|
|
1512
|
-
transactionsToSign,
|
|
1513
|
-
]);
|
|
1514
|
-
const signedTransactions = [];
|
|
1515
|
-
let resultIndex = 0;
|
|
1516
|
-
for (const [type, txn] of transactions) {
|
|
1517
|
-
if (type === "u") {
|
|
1518
|
-
signedTransactions.push(result[resultIndex]);
|
|
1519
|
-
resultIndex++;
|
|
1520
|
-
}
|
|
1521
|
-
else {
|
|
1522
|
-
signedTransactions.push(new Uint8Array(Buffer.from(txn, "base64")));
|
|
1523
|
-
}
|
|
1524
|
-
}
|
|
1525
|
-
return signedTransactions;
|
|
1526
|
-
}
|
|
1527
|
-
/** @deprecated */
|
|
1528
|
-
formatTransactionsArray(transactions) {
|
|
1529
|
-
const formattedTransactions = [];
|
|
1530
|
-
for (const [type, txn] of transactions) {
|
|
1531
|
-
if (type === "s") {
|
|
1532
|
-
formattedTransactions.push({
|
|
1533
|
-
...this.algosdk.decodeSignedTransaction(new Uint8Array(Buffer.from(txn, "base64"))),
|
|
1534
|
-
signers: [],
|
|
1535
|
-
});
|
|
1536
|
-
}
|
|
1537
|
-
else {
|
|
1538
|
-
formattedTransactions.push({
|
|
1539
|
-
txn: this.algosdk.decodeUnsignedTransaction(new Uint8Array(Buffer.from(txn, "base64"))),
|
|
1540
|
-
});
|
|
1541
|
-
}
|
|
1542
|
-
}
|
|
1543
|
-
return formattedTransactions;
|
|
1544
|
-
}
|
|
1545
1458
|
}
|
|
1546
1459
|
|
|
1547
1460
|
const ICON$4 = "data:image/svg+xml;base64," +
|
|
@@ -1658,32 +1571,6 @@ class ExodusClient extends BaseClient {
|
|
|
1658
1571
|
}, []);
|
|
1659
1572
|
return signedTxns;
|
|
1660
1573
|
}
|
|
1661
|
-
/** @deprecated */
|
|
1662
|
-
async signEncodedTransactions(transactions) {
|
|
1663
|
-
const transactionsToSign = [];
|
|
1664
|
-
const signedRawTransactions = [];
|
|
1665
|
-
for (const [type, txn] of transactions) {
|
|
1666
|
-
if (type === "u") {
|
|
1667
|
-
const decoded = this.algosdk.decodeUnsignedTransaction(Buffer.from(txn, "base64"));
|
|
1668
|
-
transactionsToSign.push(decoded.toByte());
|
|
1669
|
-
}
|
|
1670
|
-
}
|
|
1671
|
-
const result = await this.#client.signTransaction(transactionsToSign);
|
|
1672
|
-
if (!result) {
|
|
1673
|
-
throw new Error("Signing failed.");
|
|
1674
|
-
}
|
|
1675
|
-
let resultIndex = 0;
|
|
1676
|
-
for (const [type, txn] of transactions) {
|
|
1677
|
-
if (type === "u") {
|
|
1678
|
-
signedRawTransactions.push(result[resultIndex]);
|
|
1679
|
-
resultIndex++;
|
|
1680
|
-
}
|
|
1681
|
-
else {
|
|
1682
|
-
signedRawTransactions.push(new Uint8Array(Buffer.from(txn, "base64")));
|
|
1683
|
-
}
|
|
1684
|
-
}
|
|
1685
|
-
return signedRawTransactions;
|
|
1686
|
-
}
|
|
1687
1574
|
}
|
|
1688
1575
|
|
|
1689
1576
|
const ICON$3 = "data:image/svg+xml;base64," +
|
|
@@ -1815,43 +1702,6 @@ class AlgoSignerClient extends BaseClient {
|
|
|
1815
1702
|
}, []);
|
|
1816
1703
|
return signedTxns;
|
|
1817
1704
|
}
|
|
1818
|
-
/** @deprecated */
|
|
1819
|
-
formatTransactionsArray(transactions) {
|
|
1820
|
-
const formattedTransactions = transactions.map(([type, txn]) => {
|
|
1821
|
-
const formattedTxn = {
|
|
1822
|
-
txn: txn[1],
|
|
1823
|
-
};
|
|
1824
|
-
if (type === "s") {
|
|
1825
|
-
formattedTxn.signers = [];
|
|
1826
|
-
const decoded = this.algosdk.decodeSignedTransaction(new Uint8Array(Buffer.from(txn, "base64")));
|
|
1827
|
-
formattedTxn.txn = this.#client.encoding.msgpackToBase64(decoded.txn.toByte());
|
|
1828
|
-
}
|
|
1829
|
-
else {
|
|
1830
|
-
const decoded = this.algosdk.decodeUnsignedTransaction(Buffer.from(txn, "base64"));
|
|
1831
|
-
formattedTxn.txn = this.#client.encoding.msgpackToBase64(decoded.toByte());
|
|
1832
|
-
}
|
|
1833
|
-
return formattedTxn;
|
|
1834
|
-
});
|
|
1835
|
-
return formattedTransactions;
|
|
1836
|
-
}
|
|
1837
|
-
/** @deprecated */
|
|
1838
|
-
async signEncodedTransactions(transactions) {
|
|
1839
|
-
const transactionsToSign = this.formatTransactionsArray(transactions);
|
|
1840
|
-
const result = await this.#client.signTxn(transactionsToSign);
|
|
1841
|
-
if (!result) {
|
|
1842
|
-
throw new Error("Signing failed.");
|
|
1843
|
-
}
|
|
1844
|
-
const signedRawTransactions = result.reduce((signedTxns, txn, currentIndex) => {
|
|
1845
|
-
if (txn) {
|
|
1846
|
-
signedTxns.push(new Uint8Array(Buffer.from(txn.blob, "base64")));
|
|
1847
|
-
}
|
|
1848
|
-
if (txn === null) {
|
|
1849
|
-
signedTxns.push(new Uint8Array(Buffer.from(transactions[currentIndex][1], "base64")));
|
|
1850
|
-
}
|
|
1851
|
-
return signedTxns;
|
|
1852
|
-
}, []);
|
|
1853
|
-
return signedRawTransactions;
|
|
1854
|
-
}
|
|
1855
1705
|
}
|
|
1856
1706
|
|
|
1857
1707
|
const ICON$2 = "data:image/svg+xml;base64," +
|
|
@@ -2019,40 +1869,6 @@ class WalletConnectClient extends BaseClient {
|
|
|
2019
1869
|
}, []);
|
|
2020
1870
|
return signedTxns;
|
|
2021
1871
|
}
|
|
2022
|
-
/** @deprecarted */
|
|
2023
|
-
formatTransactionsArray(transactions) {
|
|
2024
|
-
const formattedTransactions = transactions.map((txn) => {
|
|
2025
|
-
const formattedTxn = {
|
|
2026
|
-
txn: txn[1],
|
|
2027
|
-
};
|
|
2028
|
-
if (txn[0] === "s") {
|
|
2029
|
-
const decodedTxn = this.algosdk.decodeSignedTransaction(new Uint8Array(Buffer.from(txn[1], "base64")));
|
|
2030
|
-
formattedTxn.txn = Buffer.from(this.algosdk.encodeUnsignedTransaction(decodedTxn.txn)).toString("base64");
|
|
2031
|
-
formattedTxn.signers = [];
|
|
2032
|
-
}
|
|
2033
|
-
return formattedTxn;
|
|
2034
|
-
});
|
|
2035
|
-
return formattedTransactions;
|
|
2036
|
-
}
|
|
2037
|
-
/** @deprecated */
|
|
2038
|
-
async signEncodedTransactions(transactions) {
|
|
2039
|
-
const transactionsToSign = this.formatTransactionsArray(transactions);
|
|
2040
|
-
const requestParams = [transactionsToSign];
|
|
2041
|
-
const request = utils.formatJsonRpcRequest("algo_signTxn", requestParams);
|
|
2042
|
-
this.keepWCAliveStart();
|
|
2043
|
-
const result = await this.#client.sendCustomRequest(request);
|
|
2044
|
-
this.keepWCAliveStop();
|
|
2045
|
-
const signedRawTransactions = result.reduce((signedTxns, txn, currentIndex) => {
|
|
2046
|
-
if (txn) {
|
|
2047
|
-
signedTxns.push(new Uint8Array(Buffer.from(txn, "base64")));
|
|
2048
|
-
}
|
|
2049
|
-
if (txn === null) {
|
|
2050
|
-
signedTxns.push(new Uint8Array(Buffer.from(transactions[currentIndex][1], "base64")));
|
|
2051
|
-
}
|
|
2052
|
-
return signedTxns;
|
|
2053
|
-
}, []);
|
|
2054
|
-
return signedRawTransactions;
|
|
2055
|
-
}
|
|
2056
1872
|
}
|
|
2057
1873
|
|
|
2058
1874
|
const ICON$1 = "data:image/svg+xml;base64," +
|
|
@@ -2218,9 +2034,6 @@ class KMDWalletClient extends BaseClient {
|
|
|
2218
2034
|
}, []);
|
|
2219
2035
|
return formattedTxns;
|
|
2220
2036
|
}
|
|
2221
|
-
signEncodedTransactions(transactions) {
|
|
2222
|
-
throw new Error("Method not implemented.");
|
|
2223
|
-
}
|
|
2224
2037
|
}
|
|
2225
2038
|
|
|
2226
2039
|
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";
|
|
@@ -2538,14 +2351,6 @@ function useWallet() {
|
|
|
2538
2351
|
const walletClient = await getClient(activeAccount?.providerId);
|
|
2539
2352
|
return walletClient?.groupTransactionsBySender(transactions);
|
|
2540
2353
|
};
|
|
2541
|
-
const signEncodedTransactions = async (transactions) => {
|
|
2542
|
-
const walletClient = await getClient(activeAccount?.providerId);
|
|
2543
|
-
return await walletClient?.signEncodedTransactions(transactions);
|
|
2544
|
-
};
|
|
2545
|
-
const sendRawTransactions = async (transactions, waitRoundsToConfirm) => {
|
|
2546
|
-
const walletClient = await getClient(activeAccount?.providerId);
|
|
2547
|
-
return await walletClient?.sendRawTransactions(transactions, waitRoundsToConfirm);
|
|
2548
|
-
};
|
|
2549
2354
|
return {
|
|
2550
2355
|
clients,
|
|
2551
2356
|
providers,
|
|
@@ -2563,8 +2368,6 @@ function useWallet() {
|
|
|
2563
2368
|
groupTransactionsBySender,
|
|
2564
2369
|
getAccountInfo,
|
|
2565
2370
|
getAssets,
|
|
2566
|
-
signEncodedTransactions,
|
|
2567
|
-
sendRawTransactions,
|
|
2568
2371
|
};
|
|
2569
2372
|
}
|
|
2570
2373
|
|
|
@@ -2611,6 +2414,12 @@ const reconnectProviders = async (providers) => {
|
|
|
2611
2414
|
}
|
|
2612
2415
|
};
|
|
2613
2416
|
|
|
2417
|
+
function encodeNFDTransactionsArray(transactionsArray) {
|
|
2418
|
+
return transactionsArray.map(([type, txn]) => {
|
|
2419
|
+
return new Uint8Array(Buffer.from(txn, "base64"));
|
|
2420
|
+
});
|
|
2421
|
+
}
|
|
2422
|
+
|
|
2614
2423
|
exports.DEFAULT_NETWORK = DEFAULT_NETWORK$1;
|
|
2615
2424
|
exports.DEFAULT_NODE_BASEURL = DEFAULT_NODE_BASEURL;
|
|
2616
2425
|
exports.DEFAULT_NODE_PORT = DEFAULT_NODE_PORT;
|
|
@@ -2618,6 +2427,7 @@ exports.DEFAULT_NODE_TOKEN = DEFAULT_NODE_TOKEN;
|
|
|
2618
2427
|
exports.WalletProvider = clientStore;
|
|
2619
2428
|
exports.algosigner = AlgoSignerClient;
|
|
2620
2429
|
exports.defly = DeflyWalletClient;
|
|
2430
|
+
exports.encodeNFDTransactionsArray = encodeNFDTransactionsArray;
|
|
2621
2431
|
exports.exodus = ExodusClient;
|
|
2622
2432
|
exports.initializeProviders = initializeProviders;
|
|
2623
2433
|
exports.kmd = KMDWalletClient;
|