@txnlab/use-wallet 4.2.0 → 4.3.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/dist/index.cjs +152 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +27 -2
- package/dist/index.d.ts +27 -2
- package/dist/index.js +149 -5
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/dist/index.d.cts
CHANGED
|
@@ -524,6 +524,28 @@ declare class BiatecWallet extends WalletConnect {
|
|
|
524
524
|
};
|
|
525
525
|
}
|
|
526
526
|
|
|
527
|
+
interface W3WalletProvider {
|
|
528
|
+
isConnected: () => Promise<boolean>;
|
|
529
|
+
account: () => Promise<WalletAccount>;
|
|
530
|
+
signTxns: (transactions: WalletTransaction[]) => Promise<(string | null)[]>;
|
|
531
|
+
}
|
|
532
|
+
declare class W3Wallet extends BaseWallet {
|
|
533
|
+
private client;
|
|
534
|
+
protected store: Store<State>;
|
|
535
|
+
constructor({ id, store, subscribe, getAlgodClient, metadata }: WalletConstructor<WalletId.W3_WALLET>);
|
|
536
|
+
static defaultMetadata: {
|
|
537
|
+
name: string;
|
|
538
|
+
icon: string;
|
|
539
|
+
};
|
|
540
|
+
private initializeClient;
|
|
541
|
+
connect: () => Promise<WalletAccount[]>;
|
|
542
|
+
disconnect: () => Promise<void>;
|
|
543
|
+
resumeSession: () => Promise<void>;
|
|
544
|
+
private processTxns;
|
|
545
|
+
private processEncodedTxns;
|
|
546
|
+
signTransactions: <T extends algosdk.Transaction[] | Uint8Array[]>(txnGroup: T | T[], indexesToSign?: number[]) => Promise<(Uint8Array | null)[]>;
|
|
547
|
+
}
|
|
548
|
+
|
|
527
549
|
declare enum WalletId {
|
|
528
550
|
BIATEC = "biatec",
|
|
529
551
|
DEFLY = "defly",
|
|
@@ -537,7 +559,8 @@ declare enum WalletId {
|
|
|
537
559
|
MAGIC = "magic",
|
|
538
560
|
MNEMONIC = "mnemonic",
|
|
539
561
|
PERA = "pera",
|
|
540
|
-
WALLETCONNECT = "walletconnect"
|
|
562
|
+
WALLETCONNECT = "walletconnect",
|
|
563
|
+
W3_WALLET = "w3-wallet"
|
|
541
564
|
}
|
|
542
565
|
type WalletMap = {
|
|
543
566
|
[WalletId.BIATEC]: typeof BiatecWallet;
|
|
@@ -553,6 +576,7 @@ type WalletMap = {
|
|
|
553
576
|
[WalletId.MNEMONIC]: typeof MnemonicWallet;
|
|
554
577
|
[WalletId.PERA]: typeof PeraWallet;
|
|
555
578
|
[WalletId.WALLETCONNECT]: typeof WalletConnect;
|
|
579
|
+
[WalletId.W3_WALLET]: typeof W3Wallet;
|
|
556
580
|
};
|
|
557
581
|
type WalletOptionsMap = {
|
|
558
582
|
[WalletId.BIATEC]: WalletConnectOptions;
|
|
@@ -568,6 +592,7 @@ type WalletOptionsMap = {
|
|
|
568
592
|
[WalletId.MNEMONIC]: MnemonicOptions;
|
|
569
593
|
[WalletId.PERA]: PeraWalletConnectOptions;
|
|
570
594
|
[WalletId.WALLETCONNECT]: WalletConnectOptions;
|
|
595
|
+
[WalletId.W3_WALLET]: Record<string, never>;
|
|
571
596
|
};
|
|
572
597
|
type SupportedWallet = WalletIdConfig<WalletId> | WalletId;
|
|
573
598
|
type WalletConfigMap = {
|
|
@@ -820,4 +845,4 @@ declare const webpackFallback: {
|
|
|
820
845
|
'magic-sdk': boolean;
|
|
821
846
|
};
|
|
822
847
|
|
|
823
|
-
export { type AlgodConfig, BaseWallet, type BaseWalletConstructor, BiatecWallet, type CustomProvider, CustomWallet, type CustomWalletOptions, DEFAULT_NETWORK_CONFIG, DEFAULT_STATE, DEFLY_WEB_PROVIDER_ID, DeflyWallet, type DeflyWalletConnectOptions, DeflyWebWallet, type EnableResult, type Exodus, type ExodusOptions, ExodusWallet, ICON, type JsonRpcRequest, KIBISIS_AVM_WEB_PROVIDER_ID, KibisisWallet, type KmdOptions, KmdWallet, LOCAL_STORAGE_MNEMONIC_KEY, LiquidWallet, LogLevel, type LuteConnectOptions, LuteWallet, MagicAuth, type MagicAuthClient, type MagicAuthOptions, type ManagerStatus, type MnemonicOptions, MnemonicWallet, type MultisigMetadata, type NetworkConfig, NetworkConfigBuilder, NetworkId, PeraWallet, type PeraWalletConnectOptions, ScopeType, SessionError, type SignData, SignDataError, type SignDataResponse, type SignMetadata, SignTxnsError, type SignTxnsResponse, type SignTxnsResult, type SignerTransaction, type Siwa, type State, StorageAdapter, type SupportedWallet, type SupportedWallets, type WalletAccount, type WalletConfig, type WalletConfigMap, WalletConnect, type WalletConnectOptions, type WalletConstructor, WalletId, type WalletIdConfig, WalletManager, type WalletManagerConfig, type WalletManagerOptions, type WalletMap, type WalletMetadata, type WalletOptions, type WalletOptionsMap, type WalletState, type WalletTransaction, type WindowExtended, webpackFallback };
|
|
848
|
+
export { type AlgodConfig, BaseWallet, type BaseWalletConstructor, BiatecWallet, type CustomProvider, CustomWallet, type CustomWalletOptions, DEFAULT_NETWORK_CONFIG, DEFAULT_STATE, DEFLY_WEB_PROVIDER_ID, DeflyWallet, type DeflyWalletConnectOptions, DeflyWebWallet, type EnableResult, type Exodus, type ExodusOptions, ExodusWallet, ICON, type JsonRpcRequest, KIBISIS_AVM_WEB_PROVIDER_ID, KibisisWallet, type KmdOptions, KmdWallet, LOCAL_STORAGE_MNEMONIC_KEY, LiquidWallet, LogLevel, type LuteConnectOptions, LuteWallet, MagicAuth, type MagicAuthClient, type MagicAuthOptions, type ManagerStatus, type MnemonicOptions, MnemonicWallet, type MultisigMetadata, type NetworkConfig, NetworkConfigBuilder, NetworkId, PeraWallet, type PeraWalletConnectOptions, ScopeType, SessionError, type SignData, SignDataError, type SignDataResponse, type SignMetadata, SignTxnsError, type SignTxnsResponse, type SignTxnsResult, type SignerTransaction, type Siwa, type State, StorageAdapter, type SupportedWallet, type SupportedWallets, W3Wallet, type W3WalletProvider, type WalletAccount, type WalletConfig, type WalletConfigMap, WalletConnect, type WalletConnectOptions, type WalletConstructor, WalletId, type WalletIdConfig, WalletManager, type WalletManagerConfig, type WalletManagerOptions, type WalletMap, type WalletMetadata, type WalletOptions, type WalletOptionsMap, type WalletState, type WalletTransaction, type WindowExtended, webpackFallback };
|
package/dist/index.d.ts
CHANGED
|
@@ -524,6 +524,28 @@ declare class BiatecWallet extends WalletConnect {
|
|
|
524
524
|
};
|
|
525
525
|
}
|
|
526
526
|
|
|
527
|
+
interface W3WalletProvider {
|
|
528
|
+
isConnected: () => Promise<boolean>;
|
|
529
|
+
account: () => Promise<WalletAccount>;
|
|
530
|
+
signTxns: (transactions: WalletTransaction[]) => Promise<(string | null)[]>;
|
|
531
|
+
}
|
|
532
|
+
declare class W3Wallet extends BaseWallet {
|
|
533
|
+
private client;
|
|
534
|
+
protected store: Store<State>;
|
|
535
|
+
constructor({ id, store, subscribe, getAlgodClient, metadata }: WalletConstructor<WalletId.W3_WALLET>);
|
|
536
|
+
static defaultMetadata: {
|
|
537
|
+
name: string;
|
|
538
|
+
icon: string;
|
|
539
|
+
};
|
|
540
|
+
private initializeClient;
|
|
541
|
+
connect: () => Promise<WalletAccount[]>;
|
|
542
|
+
disconnect: () => Promise<void>;
|
|
543
|
+
resumeSession: () => Promise<void>;
|
|
544
|
+
private processTxns;
|
|
545
|
+
private processEncodedTxns;
|
|
546
|
+
signTransactions: <T extends algosdk.Transaction[] | Uint8Array[]>(txnGroup: T | T[], indexesToSign?: number[]) => Promise<(Uint8Array | null)[]>;
|
|
547
|
+
}
|
|
548
|
+
|
|
527
549
|
declare enum WalletId {
|
|
528
550
|
BIATEC = "biatec",
|
|
529
551
|
DEFLY = "defly",
|
|
@@ -537,7 +559,8 @@ declare enum WalletId {
|
|
|
537
559
|
MAGIC = "magic",
|
|
538
560
|
MNEMONIC = "mnemonic",
|
|
539
561
|
PERA = "pera",
|
|
540
|
-
WALLETCONNECT = "walletconnect"
|
|
562
|
+
WALLETCONNECT = "walletconnect",
|
|
563
|
+
W3_WALLET = "w3-wallet"
|
|
541
564
|
}
|
|
542
565
|
type WalletMap = {
|
|
543
566
|
[WalletId.BIATEC]: typeof BiatecWallet;
|
|
@@ -553,6 +576,7 @@ type WalletMap = {
|
|
|
553
576
|
[WalletId.MNEMONIC]: typeof MnemonicWallet;
|
|
554
577
|
[WalletId.PERA]: typeof PeraWallet;
|
|
555
578
|
[WalletId.WALLETCONNECT]: typeof WalletConnect;
|
|
579
|
+
[WalletId.W3_WALLET]: typeof W3Wallet;
|
|
556
580
|
};
|
|
557
581
|
type WalletOptionsMap = {
|
|
558
582
|
[WalletId.BIATEC]: WalletConnectOptions;
|
|
@@ -568,6 +592,7 @@ type WalletOptionsMap = {
|
|
|
568
592
|
[WalletId.MNEMONIC]: MnemonicOptions;
|
|
569
593
|
[WalletId.PERA]: PeraWalletConnectOptions;
|
|
570
594
|
[WalletId.WALLETCONNECT]: WalletConnectOptions;
|
|
595
|
+
[WalletId.W3_WALLET]: Record<string, never>;
|
|
571
596
|
};
|
|
572
597
|
type SupportedWallet = WalletIdConfig<WalletId> | WalletId;
|
|
573
598
|
type WalletConfigMap = {
|
|
@@ -820,4 +845,4 @@ declare const webpackFallback: {
|
|
|
820
845
|
'magic-sdk': boolean;
|
|
821
846
|
};
|
|
822
847
|
|
|
823
|
-
export { type AlgodConfig, BaseWallet, type BaseWalletConstructor, BiatecWallet, type CustomProvider, CustomWallet, type CustomWalletOptions, DEFAULT_NETWORK_CONFIG, DEFAULT_STATE, DEFLY_WEB_PROVIDER_ID, DeflyWallet, type DeflyWalletConnectOptions, DeflyWebWallet, type EnableResult, type Exodus, type ExodusOptions, ExodusWallet, ICON, type JsonRpcRequest, KIBISIS_AVM_WEB_PROVIDER_ID, KibisisWallet, type KmdOptions, KmdWallet, LOCAL_STORAGE_MNEMONIC_KEY, LiquidWallet, LogLevel, type LuteConnectOptions, LuteWallet, MagicAuth, type MagicAuthClient, type MagicAuthOptions, type ManagerStatus, type MnemonicOptions, MnemonicWallet, type MultisigMetadata, type NetworkConfig, NetworkConfigBuilder, NetworkId, PeraWallet, type PeraWalletConnectOptions, ScopeType, SessionError, type SignData, SignDataError, type SignDataResponse, type SignMetadata, SignTxnsError, type SignTxnsResponse, type SignTxnsResult, type SignerTransaction, type Siwa, type State, StorageAdapter, type SupportedWallet, type SupportedWallets, type WalletAccount, type WalletConfig, type WalletConfigMap, WalletConnect, type WalletConnectOptions, type WalletConstructor, WalletId, type WalletIdConfig, WalletManager, type WalletManagerConfig, type WalletManagerOptions, type WalletMap, type WalletMetadata, type WalletOptions, type WalletOptionsMap, type WalletState, type WalletTransaction, type WindowExtended, webpackFallback };
|
|
848
|
+
export { type AlgodConfig, BaseWallet, type BaseWalletConstructor, BiatecWallet, type CustomProvider, CustomWallet, type CustomWalletOptions, DEFAULT_NETWORK_CONFIG, DEFAULT_STATE, DEFLY_WEB_PROVIDER_ID, DeflyWallet, type DeflyWalletConnectOptions, DeflyWebWallet, type EnableResult, type Exodus, type ExodusOptions, ExodusWallet, ICON, type JsonRpcRequest, KIBISIS_AVM_WEB_PROVIDER_ID, KibisisWallet, type KmdOptions, KmdWallet, LOCAL_STORAGE_MNEMONIC_KEY, LiquidWallet, LogLevel, type LuteConnectOptions, LuteWallet, MagicAuth, type MagicAuthClient, type MagicAuthOptions, type ManagerStatus, type MnemonicOptions, MnemonicWallet, type MultisigMetadata, type NetworkConfig, NetworkConfigBuilder, NetworkId, PeraWallet, type PeraWalletConnectOptions, ScopeType, SessionError, type SignData, SignDataError, type SignDataResponse, type SignMetadata, SignTxnsError, type SignTxnsResponse, type SignTxnsResult, type SignerTransaction, type Siwa, type State, StorageAdapter, type SupportedWallet, type SupportedWallets, W3Wallet, type W3WalletProvider, type WalletAccount, type WalletConfig, type WalletConfigMap, WalletConnect, type WalletConnectOptions, type WalletConstructor, WalletId, type WalletIdConfig, WalletManager, type WalletManagerConfig, type WalletManagerOptions, type WalletMap, type WalletMetadata, type WalletOptions, type WalletOptionsMap, type WalletState, type WalletTransaction, type WindowExtended, webpackFallback };
|
package/dist/index.js
CHANGED
|
@@ -3283,7 +3283,7 @@ var logger = Logger.getInstance();
|
|
|
3283
3283
|
|
|
3284
3284
|
// src/manager.ts
|
|
3285
3285
|
import { Store } from "@tanstack/store";
|
|
3286
|
-
import
|
|
3286
|
+
import algosdk13 from "algosdk";
|
|
3287
3287
|
|
|
3288
3288
|
// src/network.ts
|
|
3289
3289
|
var DEFAULT_NETWORK_CONFIG = {
|
|
@@ -3491,6 +3491,7 @@ var WalletId = /* @__PURE__ */ ((WalletId2) => {
|
|
|
3491
3491
|
WalletId2["MNEMONIC"] = "mnemonic";
|
|
3492
3492
|
WalletId2["PERA"] = "pera";
|
|
3493
3493
|
WalletId2["WALLETCONNECT"] = "walletconnect";
|
|
3494
|
+
WalletId2["W3_WALLET"] = "w3-wallet";
|
|
3494
3495
|
return WalletId2;
|
|
3495
3496
|
})(WalletId || {});
|
|
3496
3497
|
var SignTxnsError = class extends Error {
|
|
@@ -3629,7 +3630,7 @@ function isValidPersistedState(state) {
|
|
|
3629
3630
|
}
|
|
3630
3631
|
|
|
3631
3632
|
// src/utils.ts
|
|
3632
|
-
import
|
|
3633
|
+
import algosdk12 from "algosdk";
|
|
3633
3634
|
|
|
3634
3635
|
// src/wallets/walletconnect.ts
|
|
3635
3636
|
import algosdk2 from "algosdk";
|
|
@@ -6359,6 +6360,147 @@ var PeraWallet = class extends BaseWallet {
|
|
|
6359
6360
|
};
|
|
6360
6361
|
};
|
|
6361
6362
|
|
|
6363
|
+
// src/wallets/w3wallet.ts
|
|
6364
|
+
import algosdk11 from "algosdk";
|
|
6365
|
+
var ICON14 = `data:image/svg+xml;base64,${btoa(`
|
|
6366
|
+
<svg width="860" height="860" viewBox="0 0 860 860" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
6367
|
+
<rect width="860" height="860" rx="30" fill="#151923"/>
|
|
6368
|
+
<path d="M766 207L496.627 623.406C463.521 675.336 382.014 652.248 382.014 590.941V432.568L260.638 623.28C227.559 675.255 146 652.186 146 590.854V274.844H234.646V499.761L356.022 309.049C389.101 257.074 470.66 280.143 470.66 341.475V499.978L660.146 207L766 207Z" fill="#4BB7D1"/>
|
|
6369
|
+
</svg>
|
|
6370
|
+
`)}`;
|
|
6371
|
+
var W3Wallet = class extends BaseWallet {
|
|
6372
|
+
client = null;
|
|
6373
|
+
store;
|
|
6374
|
+
constructor({
|
|
6375
|
+
id,
|
|
6376
|
+
store,
|
|
6377
|
+
subscribe,
|
|
6378
|
+
getAlgodClient,
|
|
6379
|
+
metadata = {}
|
|
6380
|
+
}) {
|
|
6381
|
+
super({ id, metadata, getAlgodClient, store, subscribe });
|
|
6382
|
+
this.store = store;
|
|
6383
|
+
}
|
|
6384
|
+
static defaultMetadata = {
|
|
6385
|
+
name: "W3 Wallet",
|
|
6386
|
+
icon: ICON14
|
|
6387
|
+
};
|
|
6388
|
+
async initializeClient() {
|
|
6389
|
+
this.logger.info("Initializing client...");
|
|
6390
|
+
if (typeof window === "undefined" || window.w3walletAlgorand === void 0) {
|
|
6391
|
+
this.logger.error("W3 Wallet is not available.");
|
|
6392
|
+
throw new Error("W3 Wallet is not available.");
|
|
6393
|
+
}
|
|
6394
|
+
const client = window.w3walletAlgorand;
|
|
6395
|
+
this.client = client;
|
|
6396
|
+
this.logger.info("Client initialized");
|
|
6397
|
+
return client;
|
|
6398
|
+
}
|
|
6399
|
+
connect = async () => {
|
|
6400
|
+
this.logger.info("Connecting...");
|
|
6401
|
+
const client = this.client || await this.initializeClient();
|
|
6402
|
+
const activeAccount = await client.account();
|
|
6403
|
+
const walletState = {
|
|
6404
|
+
accounts: [activeAccount],
|
|
6405
|
+
activeAccount
|
|
6406
|
+
};
|
|
6407
|
+
addWallet(this.store, {
|
|
6408
|
+
walletId: this.id,
|
|
6409
|
+
wallet: walletState
|
|
6410
|
+
});
|
|
6411
|
+
this.logger.info("\u2705 Connected.", walletState);
|
|
6412
|
+
return [activeAccount];
|
|
6413
|
+
};
|
|
6414
|
+
disconnect = async () => {
|
|
6415
|
+
this.logger.info("Disconnecting...");
|
|
6416
|
+
this.onDisconnect();
|
|
6417
|
+
this.logger.info("Disconnected.");
|
|
6418
|
+
};
|
|
6419
|
+
resumeSession = async () => {
|
|
6420
|
+
try {
|
|
6421
|
+
const state = this.store.state;
|
|
6422
|
+
const walletState = state.wallets[this.id];
|
|
6423
|
+
if (!walletState) {
|
|
6424
|
+
this.logger.info("No session to resume");
|
|
6425
|
+
return;
|
|
6426
|
+
}
|
|
6427
|
+
this.logger.info("Resuming session...");
|
|
6428
|
+
const client = await this.initializeClient();
|
|
6429
|
+
const isConnected = await client.isConnected();
|
|
6430
|
+
if (!isConnected) {
|
|
6431
|
+
this.logger.error("W3 Wallet is not connected.");
|
|
6432
|
+
throw new Error("W3 Wallet is not connected.");
|
|
6433
|
+
}
|
|
6434
|
+
this.logger.info("Session resumed");
|
|
6435
|
+
} catch (error) {
|
|
6436
|
+
this.logger.error("Error resuming session:", error.message);
|
|
6437
|
+
this.onDisconnect();
|
|
6438
|
+
throw error;
|
|
6439
|
+
}
|
|
6440
|
+
};
|
|
6441
|
+
processTxns(txnGroup, indexesToSign) {
|
|
6442
|
+
const txnsToSign = [];
|
|
6443
|
+
txnGroup.forEach((txn, index) => {
|
|
6444
|
+
const isIndexMatch = !indexesToSign || indexesToSign.includes(index);
|
|
6445
|
+
const signer = txn.sender.toString();
|
|
6446
|
+
const canSignTxn = this.addresses.includes(signer);
|
|
6447
|
+
const txnString = byteArrayToBase64(txn.toByte());
|
|
6448
|
+
if (isIndexMatch && canSignTxn) {
|
|
6449
|
+
txnsToSign.push({ txn: txnString });
|
|
6450
|
+
} else {
|
|
6451
|
+
txnsToSign.push({ txn: txnString, signers: [] });
|
|
6452
|
+
}
|
|
6453
|
+
});
|
|
6454
|
+
return txnsToSign;
|
|
6455
|
+
}
|
|
6456
|
+
processEncodedTxns(txnGroup, indexesToSign) {
|
|
6457
|
+
const txnsToSign = [];
|
|
6458
|
+
txnGroup.forEach((txnBuffer, index) => {
|
|
6459
|
+
const decodedObj = algosdk11.msgpackRawDecode(txnBuffer);
|
|
6460
|
+
const isSigned = isSignedTxn(decodedObj);
|
|
6461
|
+
const txn = isSigned ? algosdk11.decodeSignedTransaction(txnBuffer).txn : algosdk11.decodeUnsignedTransaction(txnBuffer);
|
|
6462
|
+
const isIndexMatch = !indexesToSign || indexesToSign.includes(index);
|
|
6463
|
+
const signer = txn.sender.toString();
|
|
6464
|
+
const canSignTxn = !isSigned && this.addresses.includes(signer);
|
|
6465
|
+
const txnString = byteArrayToBase64(txn.toByte());
|
|
6466
|
+
if (isIndexMatch && canSignTxn) {
|
|
6467
|
+
txnsToSign.push({ txn: txnString });
|
|
6468
|
+
} else {
|
|
6469
|
+
txnsToSign.push({ txn: txnString, signers: [] });
|
|
6470
|
+
}
|
|
6471
|
+
});
|
|
6472
|
+
return txnsToSign;
|
|
6473
|
+
}
|
|
6474
|
+
signTransactions = async (txnGroup, indexesToSign) => {
|
|
6475
|
+
try {
|
|
6476
|
+
this.logger.debug("Signing transactions...", { txnGroup, indexesToSign });
|
|
6477
|
+
let txnsToSign = [];
|
|
6478
|
+
if (isTransactionArray(txnGroup)) {
|
|
6479
|
+
const flatTxns = flattenTxnGroup(txnGroup);
|
|
6480
|
+
txnsToSign = this.processTxns(flatTxns, indexesToSign);
|
|
6481
|
+
} else {
|
|
6482
|
+
const flatTxns = flattenTxnGroup(txnGroup);
|
|
6483
|
+
txnsToSign = this.processEncodedTxns(flatTxns, indexesToSign);
|
|
6484
|
+
}
|
|
6485
|
+
const client = this.client || await this.initializeClient();
|
|
6486
|
+
this.logger.debug("Sending processed transactions to wallet...", txnsToSign);
|
|
6487
|
+
const signTxnsResult = await client.signTxns(txnsToSign);
|
|
6488
|
+
this.logger.debug("Received signed transactions from wallet", signTxnsResult);
|
|
6489
|
+
const result = signTxnsResult.map((value) => {
|
|
6490
|
+
if (value === null) {
|
|
6491
|
+
return null;
|
|
6492
|
+
}
|
|
6493
|
+
return base64ToByteArray(value);
|
|
6494
|
+
});
|
|
6495
|
+
this.logger.debug("Transactions signed successfully", result);
|
|
6496
|
+
return result;
|
|
6497
|
+
} catch (error) {
|
|
6498
|
+
this.logger.error("Error signing transactions:", error.message);
|
|
6499
|
+
throw error;
|
|
6500
|
+
}
|
|
6501
|
+
};
|
|
6502
|
+
};
|
|
6503
|
+
|
|
6362
6504
|
// src/utils.ts
|
|
6363
6505
|
function createWalletMap() {
|
|
6364
6506
|
return {
|
|
@@ -6374,7 +6516,8 @@ function createWalletMap() {
|
|
|
6374
6516
|
["magic" /* MAGIC */]: MagicAuth,
|
|
6375
6517
|
["mnemonic" /* MNEMONIC */]: MnemonicWallet,
|
|
6376
6518
|
["pera" /* PERA */]: PeraWallet,
|
|
6377
|
-
["walletconnect" /* WALLETCONNECT */]: WalletConnect
|
|
6519
|
+
["walletconnect" /* WALLETCONNECT */]: WalletConnect,
|
|
6520
|
+
["w3-wallet" /* W3_WALLET */]: W3Wallet
|
|
6378
6521
|
};
|
|
6379
6522
|
}
|
|
6380
6523
|
function compareAccounts(accounts, compareTo) {
|
|
@@ -6420,7 +6563,7 @@ function isSignedTxn(txnObj) {
|
|
|
6420
6563
|
return hasRequiredProps;
|
|
6421
6564
|
}
|
|
6422
6565
|
function isTransaction(item) {
|
|
6423
|
-
return item && typeof item === "object" && "sender" in item && (item.sender instanceof
|
|
6566
|
+
return item && typeof item === "object" && "sender" in item && (item.sender instanceof algosdk12.Address || typeof item.sender === "string");
|
|
6424
6567
|
}
|
|
6425
6568
|
function isTransactionArray(txnGroup) {
|
|
6426
6569
|
if (!Array.isArray(txnGroup) || txnGroup.length === 0) {
|
|
@@ -6674,7 +6817,7 @@ var WalletManager = class {
|
|
|
6674
6817
|
createAlgodClient(config) {
|
|
6675
6818
|
this.logger.info(`Creating new Algodv2 client...`);
|
|
6676
6819
|
const { token = "", baseServer, port = "", headers = {} } = config;
|
|
6677
|
-
return new
|
|
6820
|
+
return new algosdk13.Algodv2(token, baseServer, port, headers);
|
|
6678
6821
|
}
|
|
6679
6822
|
getAlgodClient = () => {
|
|
6680
6823
|
return this.algodClient;
|
|
@@ -6838,6 +6981,7 @@ export {
|
|
|
6838
6981
|
SignDataError,
|
|
6839
6982
|
SignTxnsError,
|
|
6840
6983
|
StorageAdapter,
|
|
6984
|
+
W3Wallet,
|
|
6841
6985
|
WalletConnect,
|
|
6842
6986
|
WalletId,
|
|
6843
6987
|
WalletManager,
|