@txnlab/use-wallet 3.7.0 → 3.7.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/dist/index.js CHANGED
@@ -3374,7 +3374,159 @@ var StorageAdapter = class {
3374
3374
  };
3375
3375
 
3376
3376
  // src/store.ts
3377
- import algosdk11 from "algosdk";
3377
+ import algosdk from "algosdk";
3378
+
3379
+ // src/wallets/types.ts
3380
+ var WalletId = /* @__PURE__ */ ((WalletId2) => {
3381
+ WalletId2["BIATEC"] = "biatec";
3382
+ WalletId2["DEFLY"] = "defly";
3383
+ WalletId2["CUSTOM"] = "custom";
3384
+ WalletId2["EXODUS"] = "exodus";
3385
+ WalletId2["KIBISIS"] = "kibisis";
3386
+ WalletId2["KMD"] = "kmd";
3387
+ WalletId2["LUTE"] = "lute";
3388
+ WalletId2["MAGIC"] = "magic";
3389
+ WalletId2["MNEMONIC"] = "mnemonic";
3390
+ WalletId2["PERA"] = "pera";
3391
+ WalletId2["PERA2"] = "pera-beta";
3392
+ WalletId2["WALLETCONNECT"] = "walletconnect";
3393
+ return WalletId2;
3394
+ })(WalletId || {});
3395
+ var SignTxnsError = class extends Error {
3396
+ code;
3397
+ data;
3398
+ constructor(message, code, data) {
3399
+ super(message);
3400
+ this.name = "SignTxnsError";
3401
+ this.code = code;
3402
+ this.data = data;
3403
+ }
3404
+ };
3405
+
3406
+ // src/store.ts
3407
+ var defaultState = {
3408
+ wallets: {},
3409
+ activeWallet: null,
3410
+ activeNetwork: "testnet" /* TESTNET */,
3411
+ algodClient: new algosdk.Algodv2("", "https://testnet-api.4160.nodely.dev/")
3412
+ };
3413
+ var LOCAL_STORAGE_KEY = "@txnlab/use-wallet:v3";
3414
+ function addWallet(store, { walletId, wallet }) {
3415
+ store.setState((state) => {
3416
+ const updatedWallets = {
3417
+ ...state.wallets,
3418
+ [walletId]: {
3419
+ accounts: wallet.accounts.map((account) => ({ ...account })),
3420
+ activeAccount: wallet.activeAccount ? { ...wallet.activeAccount } : null
3421
+ }
3422
+ };
3423
+ return {
3424
+ ...state,
3425
+ wallets: updatedWallets,
3426
+ activeWallet: walletId
3427
+ };
3428
+ });
3429
+ }
3430
+ function removeWallet(store, { walletId }) {
3431
+ store.setState((state) => {
3432
+ const updatedWallets = { ...state.wallets };
3433
+ delete updatedWallets[walletId];
3434
+ return {
3435
+ ...state,
3436
+ wallets: updatedWallets,
3437
+ activeWallet: state.activeWallet === walletId ? null : state.activeWallet
3438
+ };
3439
+ });
3440
+ }
3441
+ function setActiveWallet(store, { walletId }) {
3442
+ store.setState((state) => ({
3443
+ ...state,
3444
+ activeWallet: walletId
3445
+ }));
3446
+ }
3447
+ function setActiveAccount(store, { walletId, address }) {
3448
+ store.setState((state) => {
3449
+ const wallet = state.wallets[walletId];
3450
+ if (!wallet) {
3451
+ logger.warn(`Wallet with id "${walletId}" not found`);
3452
+ return state;
3453
+ }
3454
+ const newActiveAccount = wallet.accounts.find((a2) => a2.address === address);
3455
+ if (!newActiveAccount) {
3456
+ logger.warn(`Account with address ${address} not found in wallet "${walletId}"`);
3457
+ return state;
3458
+ }
3459
+ const updatedWallet = {
3460
+ ...wallet,
3461
+ accounts: wallet.accounts.map((account) => ({ ...account })),
3462
+ activeAccount: { ...newActiveAccount }
3463
+ };
3464
+ const updatedWallets = {
3465
+ ...state.wallets,
3466
+ [walletId]: updatedWallet
3467
+ };
3468
+ return {
3469
+ ...state,
3470
+ wallets: updatedWallets
3471
+ };
3472
+ });
3473
+ }
3474
+ function setAccounts(store, { walletId, accounts }) {
3475
+ store.setState((state) => {
3476
+ const wallet = state.wallets[walletId];
3477
+ if (!wallet) {
3478
+ logger.warn(`Wallet with id "${walletId}" not found`);
3479
+ return state;
3480
+ }
3481
+ const newAccounts = accounts.map((account) => ({ ...account }));
3482
+ const isActiveAccountConnected = newAccounts.some(
3483
+ (account) => account.address === wallet.activeAccount?.address
3484
+ );
3485
+ const newActiveAccount = isActiveAccountConnected ? { ...wallet.activeAccount } : newAccounts[0] || null;
3486
+ const updatedWallet = {
3487
+ ...wallet,
3488
+ accounts: newAccounts,
3489
+ activeAccount: newActiveAccount
3490
+ };
3491
+ const updatedWallets = {
3492
+ ...state.wallets,
3493
+ [walletId]: updatedWallet
3494
+ };
3495
+ return {
3496
+ ...state,
3497
+ wallets: updatedWallets
3498
+ };
3499
+ });
3500
+ }
3501
+ function setActiveNetwork(store, { networkId, algodClient }) {
3502
+ store.setState((state) => ({
3503
+ ...state,
3504
+ activeNetwork: networkId,
3505
+ algodClient
3506
+ }));
3507
+ }
3508
+ function isValidWalletId(walletId) {
3509
+ return Object.values(WalletId).includes(walletId);
3510
+ }
3511
+ function isValidWalletAccount(account) {
3512
+ return typeof account === "object" && account !== null && typeof account.name === "string" && typeof account.address === "string";
3513
+ }
3514
+ function isValidWalletState(wallet) {
3515
+ return typeof wallet === "object" && wallet !== null && Array.isArray(wallet.accounts) && wallet.accounts.every(isValidWalletAccount) && (wallet.activeAccount === null || isValidWalletAccount(wallet.activeAccount));
3516
+ }
3517
+ function isValidState(state) {
3518
+ if (!state || typeof state !== "object") return false;
3519
+ if (typeof state.wallets !== "object") return false;
3520
+ for (const [walletId, wallet] of Object.entries(state.wallets)) {
3521
+ if (!isValidWalletId(walletId) || !isValidWalletState(wallet)) return false;
3522
+ }
3523
+ if (state.activeWallet !== null && !isValidWalletId(state.activeWallet)) return false;
3524
+ if (!isValidNetworkId(state.activeNetwork)) return false;
3525
+ return true;
3526
+ }
3527
+
3528
+ // src/wallets/walletconnect.ts
3529
+ import algosdk2 from "algosdk";
3378
3530
 
3379
3531
  // src/wallets/base.ts
3380
3532
  var BaseWallet = class {
@@ -3479,35 +3631,7 @@ var BaseWallet = class {
3479
3631
  };
3480
3632
  };
3481
3633
 
3482
- // src/wallets/types.ts
3483
- var WalletId = /* @__PURE__ */ ((WalletId2) => {
3484
- WalletId2["BIATEC"] = "biatec";
3485
- WalletId2["DEFLY"] = "defly";
3486
- WalletId2["CUSTOM"] = "custom";
3487
- WalletId2["EXODUS"] = "exodus";
3488
- WalletId2["KIBISIS"] = "kibisis";
3489
- WalletId2["KMD"] = "kmd";
3490
- WalletId2["LUTE"] = "lute";
3491
- WalletId2["MAGIC"] = "magic";
3492
- WalletId2["MNEMONIC"] = "mnemonic";
3493
- WalletId2["PERA"] = "pera";
3494
- WalletId2["PERA2"] = "pera-beta";
3495
- WalletId2["WALLETCONNECT"] = "walletconnect";
3496
- return WalletId2;
3497
- })(WalletId || {});
3498
- var SignTxnsError = class extends Error {
3499
- code;
3500
- data;
3501
- constructor(message, code, data) {
3502
- super(message);
3503
- this.name = "SignTxnsError";
3504
- this.code = code;
3505
- this.data = data;
3506
- }
3507
- };
3508
-
3509
3634
  // src/wallets/walletconnect.ts
3510
- import algosdk from "algosdk";
3511
3635
  var SessionError = class extends Error {
3512
3636
  constructor(message) {
3513
3637
  super(message);
@@ -3526,7 +3650,6 @@ var WalletConnect = class extends BaseWallet {
3526
3650
  modal = null;
3527
3651
  modalOptions;
3528
3652
  session = null;
3529
- chains;
3530
3653
  store;
3531
3654
  constructor({
3532
3655
  id,
@@ -3557,7 +3680,6 @@ var WalletConnect = class extends BaseWallet {
3557
3680
  metadata: clientMetadata
3558
3681
  };
3559
3682
  this.modalOptions = modalOptions;
3560
- this.chains = Object.values(caipChainId);
3561
3683
  this.store = store;
3562
3684
  }
3563
3685
  static defaultMetadata = {
@@ -3712,7 +3834,6 @@ var WalletConnect = class extends BaseWallet {
3712
3834
  const WalletConnectModal = (await import("@walletconnect/modal")).WalletConnectModal;
3713
3835
  const modal = new WalletConnectModal({
3714
3836
  projectId: this.options.projectId,
3715
- chains: this.chains,
3716
3837
  ...this.modalOptions
3717
3838
  });
3718
3839
  modal.subscribeModal((state) => this.logger.info(`Modal ${state.open ? "open" : "closed"}`));
@@ -3759,6 +3880,14 @@ var WalletConnect = class extends BaseWallet {
3759
3880
  this.session = session;
3760
3881
  return walletAccounts;
3761
3882
  }
3883
+ get activeChainId() {
3884
+ const chainId = caipChainId[this.activeNetwork];
3885
+ if (!chainId) {
3886
+ this.logger.warn(`No CAIP-2 chain ID found for network: ${this.activeNetwork}`);
3887
+ return "";
3888
+ }
3889
+ return chainId;
3890
+ }
3762
3891
  connect = async () => {
3763
3892
  this.logger.info("Connecting...");
3764
3893
  try {
@@ -3766,7 +3895,7 @@ var WalletConnect = class extends BaseWallet {
3766
3895
  const modal = this.modal || await this.initializeModal();
3767
3896
  const requiredNamespaces = {
3768
3897
  algorand: {
3769
- chains: this.chains,
3898
+ chains: [this.activeChainId],
3770
3899
  methods: ["algo_signTxn"],
3771
3900
  events: []
3772
3901
  }
@@ -3833,7 +3962,7 @@ var WalletConnect = class extends BaseWallet {
3833
3962
  const txnsToSign = [];
3834
3963
  txnGroup.forEach((txn, index) => {
3835
3964
  const isIndexMatch = !indexesToSign || indexesToSign.includes(index);
3836
- const signer = algosdk.encodeAddress(txn.from.publicKey);
3965
+ const signer = algosdk2.encodeAddress(txn.from.publicKey);
3837
3966
  const canSignTxn = this.addresses.includes(signer);
3838
3967
  const txnString = byteArrayToBase64(txn.toByte());
3839
3968
  if (isIndexMatch && canSignTxn) {
@@ -3847,11 +3976,11 @@ var WalletConnect = class extends BaseWallet {
3847
3976
  processEncodedTxns(txnGroup, indexesToSign) {
3848
3977
  const txnsToSign = [];
3849
3978
  txnGroup.forEach((txnBuffer, index) => {
3850
- const txnDecodeObj = algosdk.decodeObj(txnBuffer);
3979
+ const txnDecodeObj = algosdk2.decodeObj(txnBuffer);
3851
3980
  const isSigned = isSignedTxn(txnDecodeObj);
3852
- const txn = isSigned ? algosdk.decodeSignedTransaction(txnBuffer).txn : algosdk.decodeUnsignedTransaction(txnBuffer);
3981
+ const txn = isSigned ? algosdk2.decodeSignedTransaction(txnBuffer).txn : algosdk2.decodeUnsignedTransaction(txnBuffer);
3853
3982
  const isIndexMatch = !indexesToSign || indexesToSign.includes(index);
3854
- const signer = algosdk.encodeAddress(txn.from.publicKey);
3983
+ const signer = algosdk2.encodeAddress(txn.from.publicKey);
3855
3984
  const canSignTxn = !isSigned && this.addresses.includes(signer);
3856
3985
  const txnString = byteArrayToBase64(txn.toByte());
3857
3986
  if (isIndexMatch && canSignTxn) {
@@ -3881,7 +4010,7 @@ var WalletConnect = class extends BaseWallet {
3881
4010
  this.logger.debug("Sending processed transactions to wallet...", [txnsToSign]);
3882
4011
  const request = formatJsonRpcRequest("algo_signTxn", [txnsToSign]);
3883
4012
  const signTxnsResult = await client.request({
3884
- chainId: caipChainId[this.activeNetwork],
4013
+ chainId: this.activeChainId,
3885
4014
  topic: this.session.topic,
3886
4015
  request
3887
4016
  });
@@ -3934,56 +4063,170 @@ var BiatecWallet = class extends WalletConnect {
3934
4063
  };
3935
4064
  };
3936
4065
 
3937
- // src/wallets/defly.ts
3938
- import algosdk2 from "algosdk";
4066
+ // src/wallets/custom.ts
3939
4067
  var ICON3 = `data:image/svg+xml;base64,${btoa(`
3940
- <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
3941
- <rect width="1024" height="1024" />
3942
- <path fill="#FFFFFF" d="M779.9,684.4L512,230L244.1,684.4L512,529.5L779.9,684.4z" />
3943
- <path fill="#FFFFFF" d="M733.1,730L512,613.5L290.9,730L512,658L733.1,730z" />
4068
+ <svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
4069
+ <rect width="24" height="24" fill="#525252" />
3944
4070
  </svg>
3945
4071
  `)}`;
3946
- var DeflyWallet = class extends BaseWallet {
3947
- client = null;
3948
- options;
4072
+ var CustomWallet = class extends BaseWallet {
4073
+ provider;
3949
4074
  store;
3950
4075
  constructor({
3951
4076
  id,
3952
4077
  store,
3953
4078
  subscribe,
3954
4079
  getAlgodClient,
3955
- options = {},
4080
+ options,
3956
4081
  metadata = {}
3957
4082
  }) {
3958
4083
  super({ id, metadata, getAlgodClient, store, subscribe });
3959
- this.options = options;
4084
+ if (!options?.provider) {
4085
+ this.logger.error("Missing required option: provider");
4086
+ throw new Error("Missing required option: provider");
4087
+ }
4088
+ this.provider = options.provider;
3960
4089
  this.store = store;
3961
4090
  }
3962
4091
  static defaultMetadata = {
3963
- name: "Defly",
4092
+ name: "Custom",
3964
4093
  icon: ICON3
3965
4094
  };
3966
- async initializeClient() {
3967
- this.logger.info("Initializing client...");
3968
- const module = await import("@blockshake/defly-connect");
3969
- const DeflyWalletConnect = module.default ? module.default.DeflyWalletConnect : module.DeflyWalletConnect;
3970
- const client = new DeflyWalletConnect(this.options);
3971
- this.client = client;
3972
- this.logger.info("Client initialized");
3973
- return client;
3974
- }
3975
- connect = async () => {
4095
+ connect = async (args) => {
3976
4096
  this.logger.info("Connecting...");
3977
- const currentActiveWallet = this.store.state.activeWallet;
3978
- if (currentActiveWallet && currentActiveWallet !== this.id) {
3979
- this.manageWalletConnectSession("backup", currentActiveWallet);
4097
+ try {
4098
+ if (!this.provider.connect) {
4099
+ this.logger.error("Method not supported: connect");
4100
+ throw new Error("Method not supported: connect");
4101
+ }
4102
+ const walletAccounts = await this.provider.connect(args);
4103
+ if (walletAccounts.length === 0) {
4104
+ this.logger.error("No accounts found!");
4105
+ throw new Error("No accounts found!");
4106
+ }
4107
+ const activeAccount = walletAccounts[0];
4108
+ const walletState = {
4109
+ accounts: walletAccounts,
4110
+ activeAccount
4111
+ };
4112
+ addWallet(this.store, {
4113
+ walletId: this.id,
4114
+ wallet: walletState
4115
+ });
4116
+ this.logger.info("\u2705 Connected.", walletState);
4117
+ return walletAccounts;
4118
+ } catch (error) {
4119
+ this.logger.error("Error connecting:", error.message || error);
4120
+ throw error;
3980
4121
  }
3981
- const client = this.client || await this.initializeClient();
3982
- const accounts = await client.connect();
3983
- client.connector?.on("disconnect", this.onDisconnect);
3984
- if (accounts.length === 0) {
3985
- this.logger.error("No accounts found!");
3986
- throw new Error("No accounts found!");
4122
+ };
4123
+ disconnect = async () => {
4124
+ this.logger.info("Disconnecting...");
4125
+ this.onDisconnect();
4126
+ await this.provider.disconnect?.();
4127
+ };
4128
+ resumeSession = async () => {
4129
+ try {
4130
+ const state = this.store.state;
4131
+ const walletState = state.wallets[this.id];
4132
+ if (!walletState) {
4133
+ this.logger.info("No session to resume");
4134
+ return;
4135
+ }
4136
+ this.logger.info("Resuming session...");
4137
+ const result = await this.provider.resumeSession?.();
4138
+ if (Array.isArray(result)) {
4139
+ const walletAccounts = result;
4140
+ if (walletAccounts.length === 0) {
4141
+ this.logger.error("No accounts found!");
4142
+ throw new Error("No accounts found!");
4143
+ }
4144
+ const match = compareAccounts(walletAccounts, walletState.accounts);
4145
+ if (!match) {
4146
+ this.logger.warn("Session accounts mismatch, updating accounts", {
4147
+ prev: walletState.accounts,
4148
+ current: walletAccounts
4149
+ });
4150
+ setAccounts(this.store, {
4151
+ walletId: this.id,
4152
+ accounts: walletAccounts
4153
+ });
4154
+ }
4155
+ }
4156
+ this.logger.info("Session resumed.");
4157
+ } catch (error) {
4158
+ this.logger.error("Error resuming session:", error.message);
4159
+ throw error;
4160
+ }
4161
+ };
4162
+ signTransactions = async (txnGroup, indexesToSign) => {
4163
+ if (!this.provider.signTransactions) {
4164
+ this.logger.error("Method not supported: signTransactions");
4165
+ throw new Error("Method not supported: signTransactions");
4166
+ }
4167
+ this.logger.debug("Signing transactions...", { txnGroup, indexesToSign });
4168
+ return await this.provider.signTransactions(txnGroup, indexesToSign);
4169
+ };
4170
+ transactionSigner = async (txnGroup, indexesToSign) => {
4171
+ if (!this.provider.transactionSigner) {
4172
+ this.logger.error("Method not supported: transactionSigner");
4173
+ throw new Error("Method not supported: transactionSigner");
4174
+ }
4175
+ this.logger.debug("Transaction signer called...", { txnGroup, indexesToSign });
4176
+ return await this.provider.transactionSigner(txnGroup, indexesToSign);
4177
+ };
4178
+ };
4179
+
4180
+ // src/wallets/defly.ts
4181
+ import algosdk3 from "algosdk";
4182
+ var ICON4 = `data:image/svg+xml;base64,${btoa(`
4183
+ <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
4184
+ <rect width="1024" height="1024" />
4185
+ <path fill="#FFFFFF" d="M779.9,684.4L512,230L244.1,684.4L512,529.5L779.9,684.4z" />
4186
+ <path fill="#FFFFFF" d="M733.1,730L512,613.5L290.9,730L512,658L733.1,730z" />
4187
+ </svg>
4188
+ `)}`;
4189
+ var DeflyWallet = class extends BaseWallet {
4190
+ client = null;
4191
+ options;
4192
+ store;
4193
+ constructor({
4194
+ id,
4195
+ store,
4196
+ subscribe,
4197
+ getAlgodClient,
4198
+ options = {},
4199
+ metadata = {}
4200
+ }) {
4201
+ super({ id, metadata, getAlgodClient, store, subscribe });
4202
+ this.options = options;
4203
+ this.store = store;
4204
+ }
4205
+ static defaultMetadata = {
4206
+ name: "Defly",
4207
+ icon: ICON4
4208
+ };
4209
+ async initializeClient() {
4210
+ this.logger.info("Initializing client...");
4211
+ const module = await import("@blockshake/defly-connect");
4212
+ const DeflyWalletConnect = module.default ? module.default.DeflyWalletConnect : module.DeflyWalletConnect;
4213
+ const client = new DeflyWalletConnect(this.options);
4214
+ this.client = client;
4215
+ this.logger.info("Client initialized");
4216
+ return client;
4217
+ }
4218
+ connect = async () => {
4219
+ this.logger.info("Connecting...");
4220
+ const currentActiveWallet = this.store.state.activeWallet;
4221
+ if (currentActiveWallet && currentActiveWallet !== this.id) {
4222
+ this.manageWalletConnectSession("backup", currentActiveWallet);
4223
+ }
4224
+ const client = this.client || await this.initializeClient();
4225
+ const accounts = await client.connect();
4226
+ client.connector?.on("disconnect", this.onDisconnect);
4227
+ if (accounts.length === 0) {
4228
+ this.logger.error("No accounts found!");
4229
+ throw new Error("No accounts found!");
3987
4230
  }
3988
4231
  const walletAccounts = accounts.map((address, idx) => ({
3989
4232
  name: `${this.metadata.name} Account ${idx + 1}`,
@@ -4067,7 +4310,7 @@ var DeflyWallet = class extends BaseWallet {
4067
4310
  const txnsToSign = [];
4068
4311
  txnGroup.forEach((txn, index) => {
4069
4312
  const isIndexMatch = !indexesToSign || indexesToSign.includes(index);
4070
- const signer = algosdk2.encodeAddress(txn.from.publicKey);
4313
+ const signer = algosdk3.encodeAddress(txn.from.publicKey);
4071
4314
  const canSignTxn = this.addresses.includes(signer);
4072
4315
  if (isIndexMatch && canSignTxn) {
4073
4316
  txnsToSign.push({ txn });
@@ -4080,11 +4323,11 @@ var DeflyWallet = class extends BaseWallet {
4080
4323
  processEncodedTxns(txnGroup, indexesToSign) {
4081
4324
  const txnsToSign = [];
4082
4325
  txnGroup.forEach((txnBuffer, index) => {
4083
- const txnDecodeObj = algosdk2.decodeObj(txnBuffer);
4326
+ const txnDecodeObj = algosdk3.decodeObj(txnBuffer);
4084
4327
  const isSigned = isSignedTxn(txnDecodeObj);
4085
- const txn = isSigned ? algosdk2.decodeSignedTransaction(txnBuffer).txn : algosdk2.decodeUnsignedTransaction(txnBuffer);
4328
+ const txn = isSigned ? algosdk3.decodeSignedTransaction(txnBuffer).txn : algosdk3.decodeUnsignedTransaction(txnBuffer);
4086
4329
  const isIndexMatch = !indexesToSign || indexesToSign.includes(index);
4087
- const signer = algosdk2.encodeAddress(txn.from.publicKey);
4330
+ const signer = algosdk3.encodeAddress(txn.from.publicKey);
4088
4331
  const canSignTxn = !isSigned && this.addresses.includes(signer);
4089
4332
  if (isIndexMatch && canSignTxn) {
4090
4333
  txnsToSign.push({ txn });
@@ -4130,8 +4373,8 @@ var DeflyWallet = class extends BaseWallet {
4130
4373
  };
4131
4374
 
4132
4375
  // src/wallets/exodus.ts
4133
- import algosdk3 from "algosdk";
4134
- var ICON4 = `data:image/svg+xml;base64,${btoa(`
4376
+ import algosdk4 from "algosdk";
4377
+ var ICON5 = `data:image/svg+xml;base64,${btoa(`
4135
4378
  <svg viewBox="0 0 300 300" xmlns="http://www.w3.org/2000/svg">
4136
4379
  <linearGradient id="grad1" gradientUnits="userSpaceOnUse" x1="246.603" y1="9.2212" x2="174.158" y2="308.5426" gradientTransform="matrix(1 0 0 -1 0 302)">
4137
4380
  <stop offset="0" stop-color="#0B46F9" />
@@ -4175,7 +4418,7 @@ var ExodusWallet = class extends BaseWallet {
4175
4418
  }
4176
4419
  static defaultMetadata = {
4177
4420
  name: "Exodus",
4178
- icon: ICON4
4421
+ icon: ICON5
4179
4422
  };
4180
4423
  async initializeClient() {
4181
4424
  this.logger.info("Initializing client...");
@@ -4242,7 +4485,7 @@ var ExodusWallet = class extends BaseWallet {
4242
4485
  const txnsToSign = [];
4243
4486
  txnGroup.forEach((txn, index) => {
4244
4487
  const isIndexMatch = !indexesToSign || indexesToSign.includes(index);
4245
- const signer = algosdk3.encodeAddress(txn.from.publicKey);
4488
+ const signer = algosdk4.encodeAddress(txn.from.publicKey);
4246
4489
  const canSignTxn = this.addresses.includes(signer);
4247
4490
  const txnString = byteArrayToBase64(txn.toByte());
4248
4491
  if (isIndexMatch && canSignTxn) {
@@ -4256,11 +4499,11 @@ var ExodusWallet = class extends BaseWallet {
4256
4499
  processEncodedTxns(txnGroup, indexesToSign) {
4257
4500
  const txnsToSign = [];
4258
4501
  txnGroup.forEach((txnBuffer, index) => {
4259
- const txnDecodeObj = algosdk3.decodeObj(txnBuffer);
4502
+ const txnDecodeObj = algosdk4.decodeObj(txnBuffer);
4260
4503
  const isSigned = isSignedTxn(txnDecodeObj);
4261
- const txn = isSigned ? algosdk3.decodeSignedTransaction(txnBuffer).txn : algosdk3.decodeUnsignedTransaction(txnBuffer);
4504
+ const txn = isSigned ? algosdk4.decodeSignedTransaction(txnBuffer).txn : algosdk4.decodeUnsignedTransaction(txnBuffer);
4262
4505
  const isIndexMatch = !indexesToSign || indexesToSign.includes(index);
4263
- const signer = algosdk3.encodeAddress(txn.from.publicKey);
4506
+ const signer = algosdk4.encodeAddress(txn.from.publicKey);
4264
4507
  const canSignTxn = !isSigned && this.addresses.includes(signer);
4265
4508
  const txnString = byteArrayToBase64(txn.toByte());
4266
4509
  if (isIndexMatch && canSignTxn) {
@@ -4302,12 +4545,12 @@ var ExodusWallet = class extends BaseWallet {
4302
4545
  };
4303
4546
 
4304
4547
  // src/wallets/kibisis.ts
4305
- import algosdk4 from "algosdk";
4548
+ import algosdk5 from "algosdk";
4306
4549
  function isAVMWebProviderSDKError(error) {
4307
4550
  return typeof error === "object" && "code" in error && "message" in error;
4308
4551
  }
4309
4552
  var KIBISIS_AVM_WEB_PROVIDER_ID = "f6d1c86b-4493-42fb-b88d-a62407b4cdf6";
4310
- var ICON5 = `data:image/svg+xml;base64,${btoa(`
4553
+ var ICON6 = `data:image/svg+xml;base64,${btoa(`
4311
4554
  <svg viewBox="0 0 480 480" xmlns="http://www.w3.org/2000/svg">
4312
4555
  <rect fill="#801C96" width="480" height="480" />
4313
4556
  <path fill="#FFFFFF" d="M393.5,223.2c0-7.3-0.6-14.6-1.6-21.6c-0.9-6.5-2.3-12.8-4-18.9c-18-64.9-77.4-112.5-148-112.5c-70.6,0-130,47.6-148,112.5c-1.7,6.2-3,12.5-4,19c-1,7.1-1.6,14.3-1.6,21.6h0v85.5h19.7v-85.5c0-7.2,0.6-14.4,1.8-21.4c14,1.1,27.6,4.3,40.5,9.5c15.9,6.4,30.3,15.6,42.6,27.3c12.3,11.7,22,25.4,28.7,40.6c6.9,15.6,10.5,32.2,10.5,49.2v81.4h0.1h19.6h0.1v-81.5c0.1-17.1,3.6-33.7,10.5-49.2c6.7-15.2,16.4-28.8,28.7-40.6c4.2-4,8.6-7.7,13.2-11.1v132.2h19.7V223.2h0c0-2.5-0.1-5-0.4-7.4c3.3-1.6,6.6-3.1,10-4.5c12.9-5.2,26.4-8.4,40.4-9.5c1.2,7,1.7,14.2,1.8,21.4v85.5h19.7L393.5,223.2L393.5,223.2z M240.1,277.3c-11.6-29.3-32.7-54.1-59.8-71c2.9-10,8.2-19.1,15.8-26.6c11.8-11.8,27.4-18.2,44-18.2s32.3,6.5,44,18.2c4.1,4.1,7.5,8.7,10.3,13.6c5.6-3.4,11.4-6.4,17.4-9.2c-14-25.2-40.9-42.3-71.8-42.3c-35.9,0-66.3,23-77.5,55.1c-15.5-7.1-32.5-11.8-50.4-13.5c1.3-4,2.7-7.9,4.3-11.8c6.7-15.9,16.4-30.3,28.7-42.6s26.6-22,42.6-28.7c16.5-7,34-10.5,52.1-10.5s35.6,3.5,52.1,10.5c15.9,6.7,30.3,16.4,42.6,28.7s22,26.6,28.7,42.6c1.6,3.9,3.1,7.8,4.3,11.8C309,189.2,260.1,226.5,240.1,277.3z" />
@@ -4330,7 +4573,7 @@ var KibisisWallet = class extends BaseWallet {
4330
4573
  }
4331
4574
  static defaultMetadata = {
4332
4575
  name: "Kibisis",
4333
- icon: ICON5
4576
+ icon: ICON6
4334
4577
  };
4335
4578
  /**
4336
4579
  * private functions
@@ -4622,7 +4865,7 @@ var KibisisWallet = class extends BaseWallet {
4622
4865
  const txnsToSign = [];
4623
4866
  txnGroup.forEach((txn, index) => {
4624
4867
  const isIndexMatch = !indexesToSign || indexesToSign.includes(index);
4625
- const signer = algosdk4.encodeAddress(txn.from.publicKey);
4868
+ const signer = algosdk5.encodeAddress(txn.from.publicKey);
4626
4869
  const canSignTxn = this.addresses.includes(signer);
4627
4870
  const txnString = byteArrayToBase64(txn.toByte());
4628
4871
  if (isIndexMatch && canSignTxn) {
@@ -4636,11 +4879,11 @@ var KibisisWallet = class extends BaseWallet {
4636
4879
  processEncodedTxns(txnGroup, indexesToSign) {
4637
4880
  const txnsToSign = [];
4638
4881
  txnGroup.forEach((txnBuffer, index) => {
4639
- const txnDecodeObj = algosdk4.decodeObj(txnBuffer);
4882
+ const txnDecodeObj = algosdk5.decodeObj(txnBuffer);
4640
4883
  const isSigned = isSignedTxn(txnDecodeObj);
4641
- const txn = isSigned ? algosdk4.decodeSignedTransaction(txnBuffer).txn : algosdk4.decodeUnsignedTransaction(txnBuffer);
4884
+ const txn = isSigned ? algosdk5.decodeSignedTransaction(txnBuffer).txn : algosdk5.decodeUnsignedTransaction(txnBuffer);
4642
4885
  const isIndexMatch = !indexesToSign || indexesToSign.includes(index);
4643
- const signer = algosdk4.encodeAddress(txn.from.publicKey);
4886
+ const signer = algosdk5.encodeAddress(txn.from.publicKey);
4644
4887
  const canSignTxn = !isSigned && this.addresses.includes(signer);
4645
4888
  const txnString = byteArrayToBase64(txn.toByte());
4646
4889
  if (isIndexMatch && canSignTxn) {
@@ -4684,8 +4927,8 @@ var KibisisWallet = class extends BaseWallet {
4684
4927
  };
4685
4928
 
4686
4929
  // src/wallets/kmd.ts
4687
- import algosdk5 from "algosdk";
4688
- var ICON6 = `data:image/svg+xml;base64,${btoa(`
4930
+ import algosdk6 from "algosdk";
4931
+ var ICON7 = `data:image/svg+xml;base64,${btoa(`
4689
4932
  <svg viewBox="0 0 400 400" xmlns="http://www.w3.org/2000/svg">
4690
4933
  <linearGradient id="algokitGradient" gradientUnits="userSpaceOnUse" x1="0" y1="400" x2="400" y2="0">
4691
4934
  <stop offset="0" style="stop-color:#31D8EE"/>
@@ -4723,12 +4966,12 @@ var KmdWallet = class extends BaseWallet {
4723
4966
  }
4724
4967
  static defaultMetadata = {
4725
4968
  name: "KMD",
4726
- icon: ICON6
4969
+ icon: ICON7
4727
4970
  };
4728
4971
  async initializeClient() {
4729
4972
  this.logger.info("Initializing client...");
4730
4973
  const { token, baseServer, port } = this.options;
4731
- const client = new algosdk5.Kmd(token, baseServer, port);
4974
+ const client = new algosdk6.Kmd(token, baseServer, port);
4732
4975
  this.client = client;
4733
4976
  this.logger.info("Client initialized");
4734
4977
  return client;
@@ -4791,7 +5034,7 @@ var KmdWallet = class extends BaseWallet {
4791
5034
  const txnsToSign = [];
4792
5035
  txnGroup.forEach((txn, index) => {
4793
5036
  const isIndexMatch = !indexesToSign || indexesToSign.includes(index);
4794
- const signer = algosdk5.encodeAddress(txn.from.publicKey);
5037
+ const signer = algosdk6.encodeAddress(txn.from.publicKey);
4795
5038
  const canSignTxn = this.addresses.includes(signer);
4796
5039
  if (isIndexMatch && canSignTxn) {
4797
5040
  txnsToSign.push(txn);
@@ -4802,11 +5045,11 @@ var KmdWallet = class extends BaseWallet {
4802
5045
  processEncodedTxns(txnGroup, indexesToSign) {
4803
5046
  const txnsToSign = [];
4804
5047
  txnGroup.forEach((txnBuffer, index) => {
4805
- const txnDecodeObj = algosdk5.decodeObj(txnBuffer);
5048
+ const txnDecodeObj = algosdk6.decodeObj(txnBuffer);
4806
5049
  const isSigned = isSignedTxn(txnDecodeObj);
4807
- const txn = isSigned ? algosdk5.decodeSignedTransaction(txnBuffer).txn : algosdk5.decodeUnsignedTransaction(txnBuffer);
5050
+ const txn = isSigned ? algosdk6.decodeSignedTransaction(txnBuffer).txn : algosdk6.decodeUnsignedTransaction(txnBuffer);
4808
5051
  const isIndexMatch = !indexesToSign || indexesToSign.includes(index);
4809
- const signer = algosdk5.encodeAddress(txn.from.publicKey);
5052
+ const signer = algosdk6.encodeAddress(txn.from.publicKey);
4810
5053
  const canSignTxn = !isSigned && this.addresses.includes(signer);
4811
5054
  if (isIndexMatch && canSignTxn) {
4812
5055
  txnsToSign.push(txn);
@@ -4890,11 +5133,11 @@ var KmdWallet = class extends BaseWallet {
4890
5133
  };
4891
5134
 
4892
5135
  // src/wallets/lute.ts
4893
- import algosdk6 from "algosdk";
5136
+ import algosdk7 from "algosdk";
4894
5137
  function isSignTxnsError(error) {
4895
5138
  return error instanceof Error && "code" in error;
4896
5139
  }
4897
- var ICON7 = `data:image/svg+xml;base64,${btoa(`
5140
+ var ICON8 = `data:image/svg+xml;base64,${btoa(`
4898
5141
  <svg viewBox="0 0 400 400" xmlns="http://www.w3.org/2000/svg">
4899
5142
  <path fill="#AB47BC" d="M283.7,263.6c-0.6,0-1.3-0.1-1.8-0.4c-0.6-0.3-1.1-0.8-1.5-1.3c-0.4-0.6-0.7-1.3-0.8-2 c-0.1-0.8-0.1-1.7,0.1-2.5c0.2-0.9,0.6-1.8,1.2-2.6c0.6-0.8,1.4-1.7,2.2-2.3c0.9-0.7,2.1-1.2,3.2-1.6c1.2-0.4,2.7-0.5,4-0.5 c1.4,0,3,0.3,4.4,0.8c1.5,0.5,3.1,1.4,4.3,2.3c1.4,1,2.8,2.4,3.8,3.7c1.1,1.5,2.1,3.3,2.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4.8,5.4,10,8.7,14 c3.2,3.9,7.6,8,11.7,10.9c4,2.9,9.1,5.6,13.8,7.3c4.5,1.7,9.9,2.9,14.7,3.3c4.6,0.4,10,0.2,14.6-0.7c4.4-0.8,9.4-2.4,13.5-4.3 c3.9-1.9,8.2-4.6,11.5-7.5c3.2-2.7,6.4-6.4,8.8-9.9c2.3-3.4,4.4-7.6,5.7-11.4c1.2-3.7,2.1-8.1,2.3-12c0.2-3.7-0.1-8.1-0.9-11.8 c-0.8-3.5-2.2-7.5-3.8-10.7c-1.6-3.1-3.9-6.3-6.2-8.9c-2.2-2.4-5.2-4.9-8-6.6c-2.7-1.7-6-3.2-9.1-4c-2.9-0.8-6.3-1.4-9.3-1.4 c-2.9,0-6.2,0.4-8.9,1.1c-2.6,0.7-5.5,1.9-7.9,3.3c-2.2,1.3-4.5,3.2-6.3,5c-1.7,1.8-3.3,4-4.4,6.2c-1.1,2-2,4.5-2.4,6.7 c-0.4,2.1-0.6,4.5-0.4,6.7c0.2,2,0.6,4.2,1.3,6.1c0.6,1.7,1.7,3.6,2.8,5.1c1,1.3,2.4,2.7,3.8,3.7c1.3,0.9,2.8,1.8,4.3,2.3 c1.3,0.5,2.9,0.8,4.4,0.8c1.3,0,2.7-0.1,4-0.5c1.1-0.3,2.3-0.9,3.2-1.6c0.8-0.6,1.7-1.4,2.2-2.3c0.5-0.7,0.9-1.7,1.2-2.6 c0.2-0.8,0.2-1.7,0.1-2.5c-0.1-0.7-0.4-1.4-0.8-2c-0.4-0.5-0.9-1-1.5-1.3C285,263.7,284.3,263.6,283.7,263.6L283.7,263.6z" />
4900
5143
  </svg>
@@ -4921,7 +5164,7 @@ var LuteWallet = class extends BaseWallet {
4921
5164
  }
4922
5165
  static defaultMetadata = {
4923
5166
  name: "Lute",
4924
- icon: ICON7
5167
+ icon: ICON8
4925
5168
  };
4926
5169
  async initializeClient() {
4927
5170
  this.logger.info("Initializing client...");
@@ -4988,7 +5231,7 @@ var LuteWallet = class extends BaseWallet {
4988
5231
  const txnsToSign = [];
4989
5232
  txnGroup.forEach((txn, index) => {
4990
5233
  const isIndexMatch = !indexesToSign || indexesToSign.includes(index);
4991
- const signer = algosdk6.encodeAddress(txn.from.publicKey);
5234
+ const signer = algosdk7.encodeAddress(txn.from.publicKey);
4992
5235
  const canSignTxn = this.addresses.includes(signer);
4993
5236
  const txnString = byteArrayToBase64(txn.toByte());
4994
5237
  if (isIndexMatch && canSignTxn) {
@@ -5002,11 +5245,11 @@ var LuteWallet = class extends BaseWallet {
5002
5245
  processEncodedTxns(txnGroup, indexesToSign) {
5003
5246
  const txnsToSign = [];
5004
5247
  txnGroup.forEach((txnBuffer, index) => {
5005
- const txnDecodeObj = algosdk6.decodeObj(txnBuffer);
5248
+ const txnDecodeObj = algosdk7.decodeObj(txnBuffer);
5006
5249
  const isSigned = isSignedTxn(txnDecodeObj);
5007
- const txn = isSigned ? algosdk6.decodeSignedTransaction(txnBuffer).txn : algosdk6.decodeUnsignedTransaction(txnBuffer);
5250
+ const txn = isSigned ? algosdk7.decodeSignedTransaction(txnBuffer).txn : algosdk7.decodeUnsignedTransaction(txnBuffer);
5008
5251
  const isIndexMatch = !indexesToSign || indexesToSign.includes(index);
5009
- const signer = algosdk6.encodeAddress(txn.from.publicKey);
5252
+ const signer = algosdk7.encodeAddress(txn.from.publicKey);
5010
5253
  const canSignTxn = !isSigned && this.addresses.includes(signer);
5011
5254
  const txnString = byteArrayToBase64(txn.toByte());
5012
5255
  if (isIndexMatch && canSignTxn) {
@@ -5045,8 +5288,8 @@ var LuteWallet = class extends BaseWallet {
5045
5288
  };
5046
5289
 
5047
5290
  // src/wallets/magic.ts
5048
- import algosdk7 from "algosdk";
5049
- var ICON8 = `data:image/svg+xml;base64,${btoa(`
5291
+ import algosdk8 from "algosdk";
5292
+ var ICON9 = `data:image/svg+xml;base64,${btoa(`
5050
5293
  <svg viewBox="0 0 47 47" xmlns="http://www.w3.org/2000/svg">
5051
5294
  <path fill="#6851FF" d="M 23.960861 1.80769 C 25.835077 4.103153 27.902216 6.23489 30.137539 8.178169 C 28.647968 13.009323 27.846092 18.142094 27.846092 23.462154 C 27.846092 28.782307 28.648062 33.915169 30.13763 38.746368 C 27.902216 40.689724 25.835077 42.821476 23.960861 45.116985 C 22.086554 42.821476 20.019415 40.689632 17.783998 38.746368 C 19.273476 33.915169 20.075445 28.7824 20.075445 23.462337 C 20.075445 18.142277 19.273476 13.009506 17.783998 8.178318 C 20.019415 6.235001 22.086554 4.10321 23.960861 1.80769 Z M 13.511427 35.406403 C 11.145139 33.747814 8.633816 32.282063 6.000269 31.031937 C 6.730776 28.637476 7.123754 26.095783 7.123754 23.462429 C 7.123754 20.828892 6.730762 18.287201 6.000235 15.892738 C 8.633816 14.642616 11.145175 13.176861 13.511501 11.518276 C 14.416311 15.352554 14.895074 19.351414 14.895074 23.462154 C 14.895074 27.572985 14.416283 31.571938 13.511427 35.406403 Z M 33.027046 23.462337 C 33.027046 27.572985 33.505753 31.571846 34.410553 35.406124 C 36.776859 33.747631 39.288094 32.281876 41.921539 31.031845 C 41.191017 28.637384 40.798061 26.095692 40.798061 23.462246 C 40.798061 20.8288 41.191017 18.287201 41.921539 15.89283 C 39.288094 14.642708 36.776768 13.177048 34.410553 11.518555 C 33.505753 15.352831 33.027046 19.351692 33.027046 23.462337 Z" />
5052
5295
  </svg>
@@ -5074,7 +5317,7 @@ var MagicAuth = class extends BaseWallet {
5074
5317
  }
5075
5318
  static defaultMetadata = {
5076
5319
  name: "Magic",
5077
- icon: ICON8
5320
+ icon: ICON9
5078
5321
  };
5079
5322
  async initializeClient() {
5080
5323
  this.logger.info("Initializing client...");
@@ -5192,7 +5435,7 @@ var MagicAuth = class extends BaseWallet {
5192
5435
  const txnsToSign = [];
5193
5436
  txnGroup.forEach((txn, index) => {
5194
5437
  const isIndexMatch = !indexesToSign || indexesToSign.includes(index);
5195
- const signer = algosdk7.encodeAddress(txn.from.publicKey);
5438
+ const signer = algosdk8.encodeAddress(txn.from.publicKey);
5196
5439
  const canSignTxn = this.addresses.includes(signer);
5197
5440
  const txnString = byteArrayToBase64(txn.toByte());
5198
5441
  if (isIndexMatch && canSignTxn) {
@@ -5206,11 +5449,11 @@ var MagicAuth = class extends BaseWallet {
5206
5449
  processEncodedTxns(txnGroup, indexesToSign) {
5207
5450
  const txnsToSign = [];
5208
5451
  txnGroup.forEach((txnBuffer, index) => {
5209
- const txnDecodeObj = algosdk7.decodeObj(txnBuffer);
5452
+ const txnDecodeObj = algosdk8.decodeObj(txnBuffer);
5210
5453
  const isSigned = isSignedTxn(txnDecodeObj);
5211
- const txn = isSigned ? algosdk7.decodeSignedTransaction(txnBuffer).txn : algosdk7.decodeUnsignedTransaction(txnBuffer);
5454
+ const txn = isSigned ? algosdk8.decodeSignedTransaction(txnBuffer).txn : algosdk8.decodeUnsignedTransaction(txnBuffer);
5212
5455
  const isIndexMatch = !indexesToSign || indexesToSign.includes(index);
5213
- const signer = algosdk7.encodeAddress(txn.from.publicKey);
5456
+ const signer = algosdk8.encodeAddress(txn.from.publicKey);
5214
5457
  const canSignTxn = !isSigned && this.addresses.includes(signer);
5215
5458
  const txnString = byteArrayToBase64(txn.toByte());
5216
5459
  if (isIndexMatch && canSignTxn) {
@@ -5254,9 +5497,9 @@ var MagicAuth = class extends BaseWallet {
5254
5497
  };
5255
5498
 
5256
5499
  // src/wallets/mnemonic.ts
5257
- import algosdk8 from "algosdk";
5500
+ import algosdk9 from "algosdk";
5258
5501
  var LOCAL_STORAGE_MNEMONIC_KEY = `${LOCAL_STORAGE_KEY}_mnemonic`;
5259
- var ICON9 = `data:image/svg+xml;base64,${btoa(`
5502
+ var ICON10 = `data:image/svg+xml;base64,${btoa(`
5260
5503
  <svg viewBox="0 0 400 400" xmlns="http://www.w3.org/2000/svg">
5261
5504
  <rect fill="#525252" width="400" height="400" />
5262
5505
  <path fill="#FFFFFF" d="M309.2,309.3H275l-22.2-82.7l-47.9,82.7h-38.3l73.9-128l-11.9-44.5l-99.6,172.6H90.8L217.1,90.6 h33.5l14.7,54.3h34.6l-23.6,41L309.2,309.3z" />
@@ -5286,7 +5529,7 @@ var MnemonicWallet = class extends BaseWallet {
5286
5529
  }
5287
5530
  static defaultMetadata = {
5288
5531
  name: "Mnemonic",
5289
- icon: ICON9
5532
+ icon: ICON10
5290
5533
  };
5291
5534
  loadMnemonicFromStorage() {
5292
5535
  return StorageAdapter.getItem(LOCAL_STORAGE_MNEMONIC_KEY);
@@ -5322,7 +5565,7 @@ var MnemonicWallet = class extends BaseWallet {
5322
5565
  this.saveMnemonicToStorage(mnemonic);
5323
5566
  }
5324
5567
  }
5325
- const account = algosdk8.mnemonicToSecretKey(mnemonic);
5568
+ const account = algosdk9.mnemonicToSecretKey(mnemonic);
5326
5569
  this.account = account;
5327
5570
  return account;
5328
5571
  }
@@ -5366,7 +5609,7 @@ var MnemonicWallet = class extends BaseWallet {
5366
5609
  const txnsToSign = [];
5367
5610
  txnGroup.forEach((txn, index) => {
5368
5611
  const isIndexMatch = !indexesToSign || indexesToSign.includes(index);
5369
- const signer = algosdk8.encodeAddress(txn.from.publicKey);
5612
+ const signer = algosdk9.encodeAddress(txn.from.publicKey);
5370
5613
  const canSignTxn = signer === this.account.addr;
5371
5614
  if (isIndexMatch && canSignTxn) {
5372
5615
  txnsToSign.push(txn);
@@ -5377,11 +5620,11 @@ var MnemonicWallet = class extends BaseWallet {
5377
5620
  processEncodedTxns(txnGroup, indexesToSign) {
5378
5621
  const txnsToSign = [];
5379
5622
  txnGroup.forEach((txnBuffer, index) => {
5380
- const txnDecodeObj = algosdk8.decodeObj(txnBuffer);
5623
+ const txnDecodeObj = algosdk9.decodeObj(txnBuffer);
5381
5624
  const isSigned = isSignedTxn(txnDecodeObj);
5382
- const txn = isSigned ? algosdk8.decodeSignedTransaction(txnBuffer).txn : algosdk8.decodeUnsignedTransaction(txnBuffer);
5625
+ const txn = isSigned ? algosdk9.decodeSignedTransaction(txnBuffer).txn : algosdk9.decodeUnsignedTransaction(txnBuffer);
5383
5626
  const isIndexMatch = !indexesToSign || indexesToSign.includes(index);
5384
- const signer = algosdk8.encodeAddress(txn.from.publicKey);
5627
+ const signer = algosdk9.encodeAddress(txn.from.publicKey);
5385
5628
  const canSignTxn = !isSigned && signer === this.account.addr;
5386
5629
  if (isIndexMatch && canSignTxn) {
5387
5630
  txnsToSign.push(txn);
@@ -5412,8 +5655,8 @@ var MnemonicWallet = class extends BaseWallet {
5412
5655
  };
5413
5656
 
5414
5657
  // src/wallets/pera.ts
5415
- import algosdk9 from "algosdk";
5416
- var ICON10 = `data:image/svg+xml;base64,${btoa(`
5658
+ import algosdk10 from "algosdk";
5659
+ var ICON11 = `data:image/svg+xml;base64,${btoa(`
5417
5660
  <svg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg">
5418
5661
  <rect fill="#FFEE55" width="200" height="200" />
5419
5662
  <path fill="#1C1C1C" d="M106.1,64.3c2.2,9.1,1.5,17-1.7,17.8c-3.1,0.8-7.4-6-9.6-15c-2.2-9.1-1.5-17,1.7-17.8 C99.6,48.5,103.9,55.2,106.1,64.3z" />
@@ -5442,7 +5685,7 @@ var PeraWallet = class extends BaseWallet {
5442
5685
  }
5443
5686
  static defaultMetadata = {
5444
5687
  name: "Pera",
5445
- icon: ICON10
5688
+ icon: ICON11
5446
5689
  };
5447
5690
  async initializeClient() {
5448
5691
  this.logger.info("Initializing client...");
@@ -5548,7 +5791,7 @@ var PeraWallet = class extends BaseWallet {
5548
5791
  const txnsToSign = [];
5549
5792
  txnGroup.forEach((txn, index) => {
5550
5793
  const isIndexMatch = !indexesToSign || indexesToSign.includes(index);
5551
- const signer = algosdk9.encodeAddress(txn.from.publicKey);
5794
+ const signer = algosdk10.encodeAddress(txn.from.publicKey);
5552
5795
  const canSignTxn = this.addresses.includes(signer);
5553
5796
  if (isIndexMatch && canSignTxn) {
5554
5797
  txnsToSign.push({ txn });
@@ -5561,11 +5804,11 @@ var PeraWallet = class extends BaseWallet {
5561
5804
  processEncodedTxns(txnGroup, indexesToSign) {
5562
5805
  const txnsToSign = [];
5563
5806
  txnGroup.forEach((txnBuffer, index) => {
5564
- const txnDecodeObj = algosdk9.decodeObj(txnBuffer);
5807
+ const txnDecodeObj = algosdk10.decodeObj(txnBuffer);
5565
5808
  const isSigned = isSignedTxn(txnDecodeObj);
5566
- const txn = isSigned ? algosdk9.decodeSignedTransaction(txnBuffer).txn : algosdk9.decodeUnsignedTransaction(txnBuffer);
5809
+ const txn = isSigned ? algosdk10.decodeSignedTransaction(txnBuffer).txn : algosdk10.decodeUnsignedTransaction(txnBuffer);
5567
5810
  const isIndexMatch = !indexesToSign || indexesToSign.includes(index);
5568
- const signer = algosdk9.encodeAddress(txn.from.publicKey);
5811
+ const signer = algosdk10.encodeAddress(txn.from.publicKey);
5569
5812
  const canSignTxn = !isSigned && this.addresses.includes(signer);
5570
5813
  if (isIndexMatch && canSignTxn) {
5571
5814
  txnsToSign.push({ txn });
@@ -5611,8 +5854,8 @@ var PeraWallet = class extends BaseWallet {
5611
5854
  };
5612
5855
 
5613
5856
  // src/wallets/pera2.ts
5614
- import algosdk10 from "algosdk";
5615
- var ICON11 = `data:image/svg+xml;base64,${btoa(`
5857
+ import algosdk11 from "algosdk";
5858
+ var ICON12 = `data:image/svg+xml;base64,${btoa(`
5616
5859
  <svg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg">
5617
5860
  <rect fill="#FFEE55" width="200" height="200" />
5618
5861
  <path fill="#1C1C1C" d="M106.1,64.3c2.2,9.1,1.5,17-1.7,17.8c-3.1,0.8-7.4-6-9.6-15c-2.2-9.1-1.5-17,1.7-17.8 C99.6,48.5,103.9,55.2,106.1,64.3z" />
@@ -5645,7 +5888,7 @@ var PeraWallet2 = class extends BaseWallet {
5645
5888
  }
5646
5889
  static defaultMetadata = {
5647
5890
  name: "Pera",
5648
- icon: ICON11
5891
+ icon: ICON12
5649
5892
  };
5650
5893
  async initializeClient() {
5651
5894
  this.logger.info("Initializing client...");
@@ -5729,7 +5972,7 @@ var PeraWallet2 = class extends BaseWallet {
5729
5972
  const txnsToSign = [];
5730
5973
  txnGroup.forEach((txn, index) => {
5731
5974
  const isIndexMatch = !indexesToSign || indexesToSign.includes(index);
5732
- const signer = algosdk10.encodeAddress(txn.from.publicKey);
5975
+ const signer = algosdk11.encodeAddress(txn.from.publicKey);
5733
5976
  const canSignTxn = this.addresses.includes(signer);
5734
5977
  if (isIndexMatch && canSignTxn) {
5735
5978
  txnsToSign.push({ txn });
@@ -5742,11 +5985,11 @@ var PeraWallet2 = class extends BaseWallet {
5742
5985
  processEncodedTxns(txnGroup, indexesToSign) {
5743
5986
  const txnsToSign = [];
5744
5987
  txnGroup.forEach((txnBuffer, index) => {
5745
- const txnDecodeObj = algosdk10.decodeObj(txnBuffer);
5988
+ const txnDecodeObj = algosdk11.decodeObj(txnBuffer);
5746
5989
  const isSigned = isSignedTxn(txnDecodeObj);
5747
- const txn = isSigned ? algosdk10.decodeSignedTransaction(txnBuffer).txn : algosdk10.decodeUnsignedTransaction(txnBuffer);
5990
+ const txn = isSigned ? algosdk11.decodeSignedTransaction(txnBuffer).txn : algosdk11.decodeUnsignedTransaction(txnBuffer);
5748
5991
  const isIndexMatch = !indexesToSign || indexesToSign.includes(index);
5749
- const signer = algosdk10.encodeAddress(txn.from.publicKey);
5992
+ const signer = algosdk11.encodeAddress(txn.from.publicKey);
5750
5993
  const canSignTxn = !isSigned && this.addresses.includes(signer);
5751
5994
  if (isIndexMatch && canSignTxn) {
5752
5995
  txnsToSign.push({ txn });
@@ -5894,242 +6137,6 @@ function deepMerge(target, source) {
5894
6137
  return target;
5895
6138
  }
5896
6139
 
5897
- // src/wallets/custom.ts
5898
- var ICON12 = `data:image/svg+xml;base64,${btoa(`
5899
- <svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
5900
- <rect width="24" height="24" fill="#525252" />
5901
- </svg>
5902
- `)}`;
5903
- var CustomWallet = class extends BaseWallet {
5904
- provider;
5905
- store;
5906
- constructor({
5907
- id,
5908
- store,
5909
- subscribe,
5910
- getAlgodClient,
5911
- options,
5912
- metadata = {}
5913
- }) {
5914
- super({ id, metadata, getAlgodClient, store, subscribe });
5915
- if (!options?.provider) {
5916
- this.logger.error("Missing required option: provider");
5917
- throw new Error("Missing required option: provider");
5918
- }
5919
- this.provider = options.provider;
5920
- this.store = store;
5921
- }
5922
- static defaultMetadata = {
5923
- name: "Custom",
5924
- icon: ICON12
5925
- };
5926
- connect = async (args) => {
5927
- this.logger.info("Connecting...");
5928
- try {
5929
- if (!this.provider.connect) {
5930
- this.logger.error("Method not supported: connect");
5931
- throw new Error("Method not supported: connect");
5932
- }
5933
- const walletAccounts = await this.provider.connect(args);
5934
- if (walletAccounts.length === 0) {
5935
- this.logger.error("No accounts found!");
5936
- throw new Error("No accounts found!");
5937
- }
5938
- const activeAccount = walletAccounts[0];
5939
- const walletState = {
5940
- accounts: walletAccounts,
5941
- activeAccount
5942
- };
5943
- addWallet(this.store, {
5944
- walletId: this.id,
5945
- wallet: walletState
5946
- });
5947
- this.logger.info("\u2705 Connected.", walletState);
5948
- return walletAccounts;
5949
- } catch (error) {
5950
- this.logger.error("Error connecting:", error.message || error);
5951
- throw error;
5952
- }
5953
- };
5954
- disconnect = async () => {
5955
- this.logger.info("Disconnecting...");
5956
- this.onDisconnect();
5957
- await this.provider.disconnect?.();
5958
- };
5959
- resumeSession = async () => {
5960
- try {
5961
- const state = this.store.state;
5962
- const walletState = state.wallets[this.id];
5963
- if (!walletState) {
5964
- this.logger.info("No session to resume");
5965
- return;
5966
- }
5967
- this.logger.info("Resuming session...");
5968
- const result = await this.provider.resumeSession?.();
5969
- if (Array.isArray(result)) {
5970
- const walletAccounts = result;
5971
- if (walletAccounts.length === 0) {
5972
- this.logger.error("No accounts found!");
5973
- throw new Error("No accounts found!");
5974
- }
5975
- const match = compareAccounts(walletAccounts, walletState.accounts);
5976
- if (!match) {
5977
- this.logger.warn("Session accounts mismatch, updating accounts", {
5978
- prev: walletState.accounts,
5979
- current: walletAccounts
5980
- });
5981
- setAccounts(this.store, {
5982
- walletId: this.id,
5983
- accounts: walletAccounts
5984
- });
5985
- }
5986
- }
5987
- this.logger.info("Session resumed.");
5988
- } catch (error) {
5989
- this.logger.error("Error resuming session:", error.message);
5990
- throw error;
5991
- }
5992
- };
5993
- signTransactions = async (txnGroup, indexesToSign) => {
5994
- if (!this.provider.signTransactions) {
5995
- this.logger.error("Method not supported: signTransactions");
5996
- throw new Error("Method not supported: signTransactions");
5997
- }
5998
- this.logger.debug("Signing transactions...", { txnGroup, indexesToSign });
5999
- return await this.provider.signTransactions(txnGroup, indexesToSign);
6000
- };
6001
- transactionSigner = async (txnGroup, indexesToSign) => {
6002
- if (!this.provider.transactionSigner) {
6003
- this.logger.error("Method not supported: transactionSigner");
6004
- throw new Error("Method not supported: transactionSigner");
6005
- }
6006
- this.logger.debug("Transaction signer called...", { txnGroup, indexesToSign });
6007
- return await this.provider.transactionSigner(txnGroup, indexesToSign);
6008
- };
6009
- };
6010
-
6011
- // src/store.ts
6012
- var defaultState = {
6013
- wallets: {},
6014
- activeWallet: null,
6015
- activeNetwork: "testnet" /* TESTNET */,
6016
- algodClient: new algosdk11.Algodv2("", "https://testnet-api.4160.nodely.dev/")
6017
- };
6018
- var LOCAL_STORAGE_KEY = "@txnlab/use-wallet:v3";
6019
- function addWallet(store, { walletId, wallet }) {
6020
- store.setState((state) => {
6021
- const updatedWallets = {
6022
- ...state.wallets,
6023
- [walletId]: {
6024
- accounts: wallet.accounts.map((account) => ({ ...account })),
6025
- activeAccount: wallet.activeAccount ? { ...wallet.activeAccount } : null
6026
- }
6027
- };
6028
- return {
6029
- ...state,
6030
- wallets: updatedWallets,
6031
- activeWallet: walletId
6032
- };
6033
- });
6034
- }
6035
- function removeWallet(store, { walletId }) {
6036
- store.setState((state) => {
6037
- const updatedWallets = { ...state.wallets };
6038
- delete updatedWallets[walletId];
6039
- return {
6040
- ...state,
6041
- wallets: updatedWallets,
6042
- activeWallet: state.activeWallet === walletId ? null : state.activeWallet
6043
- };
6044
- });
6045
- }
6046
- function setActiveWallet(store, { walletId }) {
6047
- store.setState((state) => ({
6048
- ...state,
6049
- activeWallet: walletId
6050
- }));
6051
- }
6052
- function setActiveAccount(store, { walletId, address }) {
6053
- store.setState((state) => {
6054
- const wallet = state.wallets[walletId];
6055
- if (!wallet) {
6056
- logger.warn(`Wallet with id "${walletId}" not found`);
6057
- return state;
6058
- }
6059
- const newActiveAccount = wallet.accounts.find((a2) => a2.address === address);
6060
- if (!newActiveAccount) {
6061
- logger.warn(`Account with address ${address} not found in wallet "${walletId}"`);
6062
- return state;
6063
- }
6064
- const updatedWallet = {
6065
- ...wallet,
6066
- accounts: wallet.accounts.map((account) => ({ ...account })),
6067
- activeAccount: { ...newActiveAccount }
6068
- };
6069
- const updatedWallets = {
6070
- ...state.wallets,
6071
- [walletId]: updatedWallet
6072
- };
6073
- return {
6074
- ...state,
6075
- wallets: updatedWallets
6076
- };
6077
- });
6078
- }
6079
- function setAccounts(store, { walletId, accounts }) {
6080
- store.setState((state) => {
6081
- const wallet = state.wallets[walletId];
6082
- if (!wallet) {
6083
- logger.warn(`Wallet with id "${walletId}" not found`);
6084
- return state;
6085
- }
6086
- const newAccounts = accounts.map((account) => ({ ...account }));
6087
- const isActiveAccountConnected = newAccounts.some(
6088
- (account) => account.address === wallet.activeAccount?.address
6089
- );
6090
- const newActiveAccount = isActiveAccountConnected ? { ...wallet.activeAccount } : newAccounts[0] || null;
6091
- const updatedWallet = {
6092
- ...wallet,
6093
- accounts: newAccounts,
6094
- activeAccount: newActiveAccount
6095
- };
6096
- const updatedWallets = {
6097
- ...state.wallets,
6098
- [walletId]: updatedWallet
6099
- };
6100
- return {
6101
- ...state,
6102
- wallets: updatedWallets
6103
- };
6104
- });
6105
- }
6106
- function setActiveNetwork(store, { networkId, algodClient }) {
6107
- store.setState((state) => ({
6108
- ...state,
6109
- activeNetwork: networkId,
6110
- algodClient
6111
- }));
6112
- }
6113
- function isValidWalletId(walletId) {
6114
- return Object.values(WalletId).includes(walletId);
6115
- }
6116
- function isValidWalletAccount(account) {
6117
- return typeof account === "object" && account !== null && typeof account.name === "string" && typeof account.address === "string";
6118
- }
6119
- function isValidWalletState(wallet) {
6120
- return typeof wallet === "object" && wallet !== null && Array.isArray(wallet.accounts) && wallet.accounts.every(isValidWalletAccount) && (wallet.activeAccount === null || isValidWalletAccount(wallet.activeAccount));
6121
- }
6122
- function isValidState(state) {
6123
- if (!state || typeof state !== "object") return false;
6124
- if (typeof state.wallets !== "object") return false;
6125
- for (const [walletId, wallet] of Object.entries(state.wallets)) {
6126
- if (!isValidWalletId(walletId) || !isValidWalletState(wallet)) return false;
6127
- }
6128
- if (state.activeWallet !== null && !isValidWalletId(state.activeWallet)) return false;
6129
- if (!isValidNetworkId(state.activeNetwork)) return false;
6130
- return true;
6131
- }
6132
-
6133
6140
  // src/manager.ts
6134
6141
  var WalletManager = class {
6135
6142
  _clients = /* @__PURE__ */ new Map();
@@ -6367,7 +6374,7 @@ export {
6367
6374
  CustomWallet,
6368
6375
  DeflyWallet,
6369
6376
  ExodusWallet,
6370
- ICON5 as ICON,
6377
+ ICON6 as ICON,
6371
6378
  KIBISIS_AVM_WEB_PROVIDER_ID,
6372
6379
  KibisisWallet,
6373
6380
  KmdWallet,