@sodax/wallet-sdk-core 1.3.1-beta → 1.4.1-beta

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.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as viem from 'viem';
2
2
  import { Chain, PublicClient, WalletClient, Transport, Account, Hash as Hash$1, Address } from 'viem';
3
- import { ChainId, IEvmWalletProvider, EvmRawTransaction, EvmRawTransactionReceipt, ISuiWalletProvider, SuiTransaction, SuiExecutionResult, SuiPaginatedCoins, IIconWalletProvider, IcxCallTransaction, IconTransactionResult, IInjectiveWalletProvider, JsonObject, InjectiveRawTransaction, InjectiveEoaAddress, InjectiveCoin, InjectiveExecuteResponse, ISolanaWalletProvider, SolanaRpcResponseAndContext, SolanaSignatureResult, TransactionSignature, SolanaRawTransactionInstruction, SolanaSerializedTransaction, SolanaBase58PublicKey, Hex as Hex$1, XDR, IStellarWalletProvider, StellarRawTransactionReceipt, AddressType, IBitcoinWalletProvider, INearWalletProvider, CallContractParams, NearRawTransaction } from '@sodax/types';
3
+ import { ChainId, IEvmWalletProvider, EvmRawTransaction, EvmRawTransactionReceipt, ISuiWalletProvider, SuiTransaction, SuiExecutionResult, SuiPaginatedCoins, IIconWalletProvider, IcxCallTransaction, IconTransactionResult, IInjectiveWalletProvider, JsonObject, InjectiveRawTransaction, InjectiveEoaAddress, InjectiveCoin, InjectiveExecuteResponse, ISolanaWalletProvider, SolanaRpcResponseAndContext, SolanaSignatureResult, TransactionSignature, SolanaRawTransactionInstruction, SolanaSerializedTransaction, SolanaBase58PublicKey, Hex as Hex$1, XDR, IStellarWalletProvider, StellarRawTransactionReceipt, IStacksWalletProvider, StacksTransactionParams, AddressType, IBitcoinWalletProvider, INearWalletProvider, CallContractParams, NearRawTransaction } from '@sodax/types';
4
4
  import { SuiClient } from '@mysten/sui/client';
5
5
  import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
6
6
  import { Transaction } from '@mysten/sui/transactions';
@@ -13,6 +13,8 @@ import { ChainId as ChainId$1, EvmChainId } from '@injectivelabs/ts-types';
13
13
  import { PublicKey, Connection, Commitment, RpcResponseAndContext, TokenAmount } from '@solana/web3.js';
14
14
  import { SignerWalletAdapterProps } from '@solana/wallet-adapter-base';
15
15
  import { Keypair } from '@stellar/stellar-sdk';
16
+ import { ClarityValue } from '@stacks/transactions';
17
+ import { StacksProvider } from '@stacks/connect';
16
18
  import * as bitcoin from 'bitcoinjs-lib';
17
19
  import { ECPairInterface } from 'ecpair';
18
20
  import { Account as Account$1, JsonRpcProvider } from 'near-api-js';
@@ -345,6 +347,30 @@ declare class StellarWalletProvider implements IStellarWalletProvider {
345
347
  waitForTransactionReceipt(txHash: string): Promise<StellarRawTransactionReceipt>;
346
348
  }
347
349
 
350
+ type PrivateKeyStacksWalletConfig = {
351
+ privateKey: string;
352
+ endpoint?: string;
353
+ };
354
+ type BrowserExtensionStacksWalletConfig = {
355
+ address: string;
356
+ endpoint?: string;
357
+ provider?: StacksProvider;
358
+ };
359
+ type StacksWalletConfig = PrivateKeyStacksWalletConfig | BrowserExtensionStacksWalletConfig;
360
+ declare function isPrivateKeyStacksWalletConfig(config: StacksWalletConfig): config is PrivateKeyStacksWalletConfig;
361
+ declare function isBrowserExtensionStacksWalletConfig(config: StacksWalletConfig): config is BrowserExtensionStacksWalletConfig;
362
+ declare class StacksWalletProvider implements IStacksWalletProvider {
363
+ private readonly network;
364
+ private readonly wallet;
365
+ constructor(config: StacksWalletConfig);
366
+ sendTransaction(txParams: StacksTransactionParams): Promise<string>;
367
+ private sendTransactionWithPrivateKey;
368
+ private sendTransactionWithAdapter;
369
+ readContract(txParams: StacksTransactionParams): Promise<ClarityValue>;
370
+ getWalletAddress(): Promise<string>;
371
+ getBalance(address: string): Promise<bigint>;
372
+ }
373
+
348
374
  type BitcoinNetwork = 'TESTNET' | 'MAINNET';
349
375
  interface BitcoinWalletsKit {
350
376
  getAccounts(): Promise<string[]>;
@@ -420,9 +446,8 @@ declare class NearWalletProvider implements INearWalletProvider {
420
446
  private readonly wallet?;
421
447
  constructor(config: NearWalletConfig);
422
448
  getWalletAddress(): Promise<string>;
423
- getWalletAddressBytes(): Promise<Hex$1>;
424
449
  getRawTransaction(params: CallContractParams): Promise<NearRawTransaction>;
425
450
  signAndSubmitTxn(transaction: NearRawTransaction): Promise<string>;
426
451
  }
427
452
 
428
- export { BigNumberToBigInt, type BitcoinNetwork, type BitcoinWalletConfig, BitcoinWalletError, BitcoinWalletProvider, type BitcoinWalletsKit, type BrowserExtensionBitcoinWalletConfig, type BrowserExtensionEvmWalletConfig, type BrowserExtensionIconWalletConfig, type BrowserExtensionInjectiveWalletConfig, type BrowserExtensionNearWalletConfig, type BrowserExtensionSolanaWalletConfig, type BrowserExtensionStellarWalletConfig, type BrowserExtensionSuiWallet, type BrowserExtensionSuiWalletConfig, type EvmWalletConfig, EvmWalletProvider, type HanaWalletRequestEvent, type HanaWalletResponseEvent, type Hash, type Hex, type IconAddress, type IconBrowserExtensionWallet, type IconEoaAddress, type IconJsonRpcVersion, type IconPkWallet, type IconWallet, type IconWalletConfig, IconWalletProvider, type InjectiveWallet, type InjectiveWalletConfig, InjectiveWalletProvider, type JsonRpcPayloadResponse, type NearWalletConfig, NearWalletProvider, type PkSuiWallet, type PrivateKeyBitcoinWalletConfig, type PrivateKeyEvmWalletConfig, type PrivateKeyIconWalletConfig, type PrivateKeyNearWalletConfig, type PrivateKeySolanaWalletConfig, type PrivateKeyStellarWalletConfig, type PrivateKeySuiWalletConfig, type RelayRequestDetail, type RelayRequestSigning, type ResponseAddressType, type ResponseSigningType, type SecretInjectiveWalletConfig, type SolanaWalletConfig, SolanaWalletProvider, type StellarAddress, type StellarBrowserExtensionWallet, type StellarNetwork, type StellarPkWallet, type StellarWallet, type StellarWalletConfig, StellarWalletError, StellarWalletProvider, type SuiWallet, type SuiWalletConfig, SuiWalletProvider, getEvmViemChain, hyper, isBrowserExtensionEvmWalletConfig, isBrowserExtensionIconWalletConfig, isBrowserExtensionInjectiveWalletConfig, isBrowserExtensionNearWalletConfig, isBrowserExtensionStellarWalletConfig, isBrowserExtensionSuiWallet, isIconAddress, isIconBrowserExtensionWallet, isIconEoaAddress, isIconPkWallet, isJsonRpcPayloadResponse, isPkSuiWallet, isPrivateKeyEvmWalletConfig, isPrivateKeyIconWalletConfig, isPrivateKeyNearWalletConfig, isPrivateKeyStellarWalletConfig, isResponseAddressType, isResponseSigningType, isSecretInjectiveWalletConfig, isStellarBrowserExtensionWallet, isStellarPkWallet, isSuiWallet, isValidStellarNetwork, isValidStellarPrivateKey, requestAddress, requestJsonRpc, requestSigning };
453
+ export { BigNumberToBigInt, type BitcoinNetwork, type BitcoinWalletConfig, BitcoinWalletError, BitcoinWalletProvider, type BitcoinWalletsKit, type BrowserExtensionBitcoinWalletConfig, type BrowserExtensionEvmWalletConfig, type BrowserExtensionIconWalletConfig, type BrowserExtensionInjectiveWalletConfig, type BrowserExtensionNearWalletConfig, type BrowserExtensionSolanaWalletConfig, type BrowserExtensionStacksWalletConfig, type BrowserExtensionStellarWalletConfig, type BrowserExtensionSuiWallet, type BrowserExtensionSuiWalletConfig, type EvmWalletConfig, EvmWalletProvider, type HanaWalletRequestEvent, type HanaWalletResponseEvent, type Hash, type Hex, type IconAddress, type IconBrowserExtensionWallet, type IconEoaAddress, type IconJsonRpcVersion, type IconPkWallet, type IconWallet, type IconWalletConfig, IconWalletProvider, type InjectiveWallet, type InjectiveWalletConfig, InjectiveWalletProvider, type JsonRpcPayloadResponse, type NearWalletConfig, NearWalletProvider, type PkSuiWallet, type PrivateKeyBitcoinWalletConfig, type PrivateKeyEvmWalletConfig, type PrivateKeyIconWalletConfig, type PrivateKeyNearWalletConfig, type PrivateKeySolanaWalletConfig, type PrivateKeyStacksWalletConfig, type PrivateKeyStellarWalletConfig, type PrivateKeySuiWalletConfig, type RelayRequestDetail, type RelayRequestSigning, type ResponseAddressType, type ResponseSigningType, type SecretInjectiveWalletConfig, type SolanaWalletConfig, SolanaWalletProvider, type StacksWalletConfig, StacksWalletProvider, type StellarAddress, type StellarBrowserExtensionWallet, type StellarNetwork, type StellarPkWallet, type StellarWallet, type StellarWalletConfig, StellarWalletError, StellarWalletProvider, type SuiWallet, type SuiWalletConfig, SuiWalletProvider, getEvmViemChain, hyper, isBrowserExtensionEvmWalletConfig, isBrowserExtensionIconWalletConfig, isBrowserExtensionInjectiveWalletConfig, isBrowserExtensionNearWalletConfig, isBrowserExtensionStacksWalletConfig, isBrowserExtensionStellarWalletConfig, isBrowserExtensionSuiWallet, isIconAddress, isIconBrowserExtensionWallet, isIconEoaAddress, isIconPkWallet, isJsonRpcPayloadResponse, isPkSuiWallet, isPrivateKeyEvmWalletConfig, isPrivateKeyIconWalletConfig, isPrivateKeyNearWalletConfig, isPrivateKeyStacksWalletConfig, isPrivateKeyStellarWalletConfig, isResponseAddressType, isResponseSigningType, isSecretInjectiveWalletConfig, isStellarBrowserExtensionWallet, isStellarPkWallet, isSuiWallet, isValidStellarNetwork, isValidStellarPrivateKey, requestAddress, requestJsonRpc, requestSigning };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as viem from 'viem';
2
2
  import { Chain, PublicClient, WalletClient, Transport, Account, Hash as Hash$1, Address } from 'viem';
3
- import { ChainId, IEvmWalletProvider, EvmRawTransaction, EvmRawTransactionReceipt, ISuiWalletProvider, SuiTransaction, SuiExecutionResult, SuiPaginatedCoins, IIconWalletProvider, IcxCallTransaction, IconTransactionResult, IInjectiveWalletProvider, JsonObject, InjectiveRawTransaction, InjectiveEoaAddress, InjectiveCoin, InjectiveExecuteResponse, ISolanaWalletProvider, SolanaRpcResponseAndContext, SolanaSignatureResult, TransactionSignature, SolanaRawTransactionInstruction, SolanaSerializedTransaction, SolanaBase58PublicKey, Hex as Hex$1, XDR, IStellarWalletProvider, StellarRawTransactionReceipt, AddressType, IBitcoinWalletProvider, INearWalletProvider, CallContractParams, NearRawTransaction } from '@sodax/types';
3
+ import { ChainId, IEvmWalletProvider, EvmRawTransaction, EvmRawTransactionReceipt, ISuiWalletProvider, SuiTransaction, SuiExecutionResult, SuiPaginatedCoins, IIconWalletProvider, IcxCallTransaction, IconTransactionResult, IInjectiveWalletProvider, JsonObject, InjectiveRawTransaction, InjectiveEoaAddress, InjectiveCoin, InjectiveExecuteResponse, ISolanaWalletProvider, SolanaRpcResponseAndContext, SolanaSignatureResult, TransactionSignature, SolanaRawTransactionInstruction, SolanaSerializedTransaction, SolanaBase58PublicKey, Hex as Hex$1, XDR, IStellarWalletProvider, StellarRawTransactionReceipt, IStacksWalletProvider, StacksTransactionParams, AddressType, IBitcoinWalletProvider, INearWalletProvider, CallContractParams, NearRawTransaction } from '@sodax/types';
4
4
  import { SuiClient } from '@mysten/sui/client';
5
5
  import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
6
6
  import { Transaction } from '@mysten/sui/transactions';
@@ -13,6 +13,8 @@ import { ChainId as ChainId$1, EvmChainId } from '@injectivelabs/ts-types';
13
13
  import { PublicKey, Connection, Commitment, RpcResponseAndContext, TokenAmount } from '@solana/web3.js';
14
14
  import { SignerWalletAdapterProps } from '@solana/wallet-adapter-base';
15
15
  import { Keypair } from '@stellar/stellar-sdk';
16
+ import { ClarityValue } from '@stacks/transactions';
17
+ import { StacksProvider } from '@stacks/connect';
16
18
  import * as bitcoin from 'bitcoinjs-lib';
17
19
  import { ECPairInterface } from 'ecpair';
18
20
  import { Account as Account$1, JsonRpcProvider } from 'near-api-js';
@@ -345,6 +347,30 @@ declare class StellarWalletProvider implements IStellarWalletProvider {
345
347
  waitForTransactionReceipt(txHash: string): Promise<StellarRawTransactionReceipt>;
346
348
  }
347
349
 
350
+ type PrivateKeyStacksWalletConfig = {
351
+ privateKey: string;
352
+ endpoint?: string;
353
+ };
354
+ type BrowserExtensionStacksWalletConfig = {
355
+ address: string;
356
+ endpoint?: string;
357
+ provider?: StacksProvider;
358
+ };
359
+ type StacksWalletConfig = PrivateKeyStacksWalletConfig | BrowserExtensionStacksWalletConfig;
360
+ declare function isPrivateKeyStacksWalletConfig(config: StacksWalletConfig): config is PrivateKeyStacksWalletConfig;
361
+ declare function isBrowserExtensionStacksWalletConfig(config: StacksWalletConfig): config is BrowserExtensionStacksWalletConfig;
362
+ declare class StacksWalletProvider implements IStacksWalletProvider {
363
+ private readonly network;
364
+ private readonly wallet;
365
+ constructor(config: StacksWalletConfig);
366
+ sendTransaction(txParams: StacksTransactionParams): Promise<string>;
367
+ private sendTransactionWithPrivateKey;
368
+ private sendTransactionWithAdapter;
369
+ readContract(txParams: StacksTransactionParams): Promise<ClarityValue>;
370
+ getWalletAddress(): Promise<string>;
371
+ getBalance(address: string): Promise<bigint>;
372
+ }
373
+
348
374
  type BitcoinNetwork = 'TESTNET' | 'MAINNET';
349
375
  interface BitcoinWalletsKit {
350
376
  getAccounts(): Promise<string[]>;
@@ -420,9 +446,8 @@ declare class NearWalletProvider implements INearWalletProvider {
420
446
  private readonly wallet?;
421
447
  constructor(config: NearWalletConfig);
422
448
  getWalletAddress(): Promise<string>;
423
- getWalletAddressBytes(): Promise<Hex$1>;
424
449
  getRawTransaction(params: CallContractParams): Promise<NearRawTransaction>;
425
450
  signAndSubmitTxn(transaction: NearRawTransaction): Promise<string>;
426
451
  }
427
452
 
428
- export { BigNumberToBigInt, type BitcoinNetwork, type BitcoinWalletConfig, BitcoinWalletError, BitcoinWalletProvider, type BitcoinWalletsKit, type BrowserExtensionBitcoinWalletConfig, type BrowserExtensionEvmWalletConfig, type BrowserExtensionIconWalletConfig, type BrowserExtensionInjectiveWalletConfig, type BrowserExtensionNearWalletConfig, type BrowserExtensionSolanaWalletConfig, type BrowserExtensionStellarWalletConfig, type BrowserExtensionSuiWallet, type BrowserExtensionSuiWalletConfig, type EvmWalletConfig, EvmWalletProvider, type HanaWalletRequestEvent, type HanaWalletResponseEvent, type Hash, type Hex, type IconAddress, type IconBrowserExtensionWallet, type IconEoaAddress, type IconJsonRpcVersion, type IconPkWallet, type IconWallet, type IconWalletConfig, IconWalletProvider, type InjectiveWallet, type InjectiveWalletConfig, InjectiveWalletProvider, type JsonRpcPayloadResponse, type NearWalletConfig, NearWalletProvider, type PkSuiWallet, type PrivateKeyBitcoinWalletConfig, type PrivateKeyEvmWalletConfig, type PrivateKeyIconWalletConfig, type PrivateKeyNearWalletConfig, type PrivateKeySolanaWalletConfig, type PrivateKeyStellarWalletConfig, type PrivateKeySuiWalletConfig, type RelayRequestDetail, type RelayRequestSigning, type ResponseAddressType, type ResponseSigningType, type SecretInjectiveWalletConfig, type SolanaWalletConfig, SolanaWalletProvider, type StellarAddress, type StellarBrowserExtensionWallet, type StellarNetwork, type StellarPkWallet, type StellarWallet, type StellarWalletConfig, StellarWalletError, StellarWalletProvider, type SuiWallet, type SuiWalletConfig, SuiWalletProvider, getEvmViemChain, hyper, isBrowserExtensionEvmWalletConfig, isBrowserExtensionIconWalletConfig, isBrowserExtensionInjectiveWalletConfig, isBrowserExtensionNearWalletConfig, isBrowserExtensionStellarWalletConfig, isBrowserExtensionSuiWallet, isIconAddress, isIconBrowserExtensionWallet, isIconEoaAddress, isIconPkWallet, isJsonRpcPayloadResponse, isPkSuiWallet, isPrivateKeyEvmWalletConfig, isPrivateKeyIconWalletConfig, isPrivateKeyNearWalletConfig, isPrivateKeyStellarWalletConfig, isResponseAddressType, isResponseSigningType, isSecretInjectiveWalletConfig, isStellarBrowserExtensionWallet, isStellarPkWallet, isSuiWallet, isValidStellarNetwork, isValidStellarPrivateKey, requestAddress, requestJsonRpc, requestSigning };
453
+ export { BigNumberToBigInt, type BitcoinNetwork, type BitcoinWalletConfig, BitcoinWalletError, BitcoinWalletProvider, type BitcoinWalletsKit, type BrowserExtensionBitcoinWalletConfig, type BrowserExtensionEvmWalletConfig, type BrowserExtensionIconWalletConfig, type BrowserExtensionInjectiveWalletConfig, type BrowserExtensionNearWalletConfig, type BrowserExtensionSolanaWalletConfig, type BrowserExtensionStacksWalletConfig, type BrowserExtensionStellarWalletConfig, type BrowserExtensionSuiWallet, type BrowserExtensionSuiWalletConfig, type EvmWalletConfig, EvmWalletProvider, type HanaWalletRequestEvent, type HanaWalletResponseEvent, type Hash, type Hex, type IconAddress, type IconBrowserExtensionWallet, type IconEoaAddress, type IconJsonRpcVersion, type IconPkWallet, type IconWallet, type IconWalletConfig, IconWalletProvider, type InjectiveWallet, type InjectiveWalletConfig, InjectiveWalletProvider, type JsonRpcPayloadResponse, type NearWalletConfig, NearWalletProvider, type PkSuiWallet, type PrivateKeyBitcoinWalletConfig, type PrivateKeyEvmWalletConfig, type PrivateKeyIconWalletConfig, type PrivateKeyNearWalletConfig, type PrivateKeySolanaWalletConfig, type PrivateKeyStacksWalletConfig, type PrivateKeyStellarWalletConfig, type PrivateKeySuiWalletConfig, type RelayRequestDetail, type RelayRequestSigning, type ResponseAddressType, type ResponseSigningType, type SecretInjectiveWalletConfig, type SolanaWalletConfig, SolanaWalletProvider, type StacksWalletConfig, StacksWalletProvider, type StellarAddress, type StellarBrowserExtensionWallet, type StellarNetwork, type StellarPkWallet, type StellarWallet, type StellarWalletConfig, StellarWalletError, StellarWalletProvider, type SuiWallet, type SuiWalletConfig, SuiWalletProvider, getEvmViemChain, hyper, isBrowserExtensionEvmWalletConfig, isBrowserExtensionIconWalletConfig, isBrowserExtensionInjectiveWalletConfig, isBrowserExtensionNearWalletConfig, isBrowserExtensionStacksWalletConfig, isBrowserExtensionStellarWalletConfig, isBrowserExtensionSuiWallet, isIconAddress, isIconBrowserExtensionWallet, isIconEoaAddress, isIconPkWallet, isJsonRpcPayloadResponse, isPkSuiWallet, isPrivateKeyEvmWalletConfig, isPrivateKeyIconWalletConfig, isPrivateKeyNearWalletConfig, isPrivateKeyStacksWalletConfig, isPrivateKeyStellarWalletConfig, isResponseAddressType, isResponseSigningType, isSecretInjectiveWalletConfig, isStellarBrowserExtensionWallet, isStellarPkWallet, isSuiWallet, isValidStellarNetwork, isValidStellarPrivateKey, requestAddress, requestJsonRpc, requestSigning };
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { privateKeyToAccount } from 'viem/accounts';
2
- import { defineChain, createWalletClient, http, createPublicClient, keccak256, toHex } from 'viem';
2
+ import { defineChain, createWalletClient, http, createPublicClient, keccak256 } from 'viem';
3
3
  import { lightlinkPhoenix, kaia, redbellyMainnet, mainnet, polygon, bsc, optimism, base, arbitrum, avalanche, sonic } from 'viem/chains';
4
4
  import { SuiClient } from '@mysten/sui/client';
5
5
  import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
@@ -9,6 +9,9 @@ import { PrivateKey, MsgBroadcasterWithPk, MsgExecuteContract, createTransaction
9
9
  import { getAssociatedTokenAddress } from '@solana/spl-token';
10
10
  import { Keypair, Connection, TransactionMessage, VersionedTransaction, PublicKey, TransactionInstruction } from '@solana/web3.js';
11
11
  import { Networks, Keypair as Keypair$1, Horizon, Transaction } from '@stellar/stellar-sdk';
12
+ import { networkFrom } from '@stacks/network';
13
+ import { makeContractCall, broadcastTransaction, fetchCallReadOnlyFunction, getAddressFromPrivateKey, PostConditionMode } from '@stacks/transactions';
14
+ import { request } from '@stacks/connect';
12
15
  import * as bitcoin from 'bitcoinjs-lib';
13
16
  import * as ecc from '@bitcoinerlab/secp256k1';
14
17
  import { ECPairFactory } from 'ecpair';
@@ -37,6 +40,7 @@ var ETHEREUM_MAINNET_CHAIN_ID = "ethereum";
37
40
  var BITCOIN_MAINNET_CHAIN_ID = "bitcoin";
38
41
  var REDBELLY_MAINNET_CHAIN_ID = "redbelly";
39
42
  var KAIA_MAINNET_CHAIN_ID = "0x2019.kaia";
43
+ var STACKS_MAINNET_CHAIN_ID = "stacks";
40
44
  var baseChainInfo = {
41
45
  [SONIC_MAINNET_CHAIN_ID]: {
42
46
  name: "Sonic",
@@ -151,6 +155,12 @@ var baseChainInfo = {
151
155
  id: KAIA_MAINNET_CHAIN_ID,
152
156
  type: "EVM",
153
157
  chainId: 8217
158
+ },
159
+ [STACKS_MAINNET_CHAIN_ID]: {
160
+ name: "Stacks",
161
+ id: STACKS_MAINNET_CHAIN_ID,
162
+ type: "STACKS",
163
+ chainId: "stacks"
154
164
  }
155
165
  };
156
166
  var SodaTokens = {
@@ -307,6 +317,13 @@ var SodaTokens = {
307
317
  decimals: 18,
308
318
  address: "0xD7d41b5f803b6A40F8A6eAa34E459A4564e39891",
309
319
  xChainId: SONIC_MAINNET_CHAIN_ID
320
+ },
321
+ sodaSTX: {
322
+ symbol: "sodaSTX",
323
+ name: "Soda STX",
324
+ decimals: 18,
325
+ address: "0x1Fbe5229e9d189F26bEE77E5bFa24309FdA90483",
326
+ xChainId: SONIC_MAINNET_CHAIN_ID
310
327
  }
311
328
  };
312
329
  var SodaTokensAsHubAssets = Object.values(SodaTokens).reduce((acc, token) => {
@@ -386,7 +403,6 @@ var spokeChainConfig = {
386
403
  assetManager: "AnCCJjheynmGqPp6Vgat9DTirGKD4CtQzP8cwTYV8qKH",
387
404
  connection: "GxS8i6D9qQjbSeniD487CnomUxU2pXt6V8P96T6MkUXB",
388
405
  rateLimit: "2Vyy3A3Teju2EMCkdnappEeWqBXyAaF5V2WsrU4hDtsk",
389
- testToken: "3Q2HS3png7fLaYerqCun3zw8rnBZo2Ksvdg6RHTyM4Ns",
390
406
  xTokenManager: ""
391
407
  },
392
408
  chain: baseChainInfo[SOLANA_MAINNET_CHAIN_ID],
@@ -967,7 +983,6 @@ var spokeChainConfig = {
967
983
  assetManager: "inj1dg6tm62uup53wn2kn97caeqfwt0sukx3qjk8rw",
968
984
  connection: "inj1eexvfglsptxwfj9hft96xcnsdrvr7d7dalcm8w",
969
985
  rateLimit: "inj1x8p2h56edcdrm9tzx7a7zkwe0l334klgrxpqyk",
970
- testToken: "",
971
986
  xTokenManager: ""
972
987
  },
973
988
  chain: baseChainInfo[INJECTIVE_MAINNET_CHAIN_ID],
@@ -1059,8 +1074,7 @@ var spokeChainConfig = {
1059
1074
  connection: "CDFQDDPUPAM3XPGORHDOEFRNLMKOH3N3X6XTXNLSXJQXIU3RVCM3OPEP",
1060
1075
  assetManager: "CCGF33A4CO6D3BXFEKPXVCFCZBK76I3AQOZK6KIKRPAWAZR3632WHCJ3",
1061
1076
  xTokenManager: "",
1062
- rateLimit: "CB6G3ULISTTBPXUN3BI6ADHQGWJEN7BPQINHL45TCB6TDFM5QWU24HAY",
1063
- testToken: ""
1077
+ rateLimit: "CB6G3ULISTTBPXUN3BI6ADHQGWJEN7BPQINHL45TCB6TDFM5QWU24HAY"
1064
1078
  },
1065
1079
  trustlineConfigs: [
1066
1080
  {
@@ -1128,8 +1142,7 @@ var spokeChainConfig = {
1128
1142
  assetManagerConfigId: "0xcb7346339340b7f8dea40fcafb70721dc2fcfa7e8626a89fd954d46c1f928b61",
1129
1143
  originalAssetManager: "0xa17a409164d1676db71b411ab50813ba2c7dd547d2df538c699049566f1ff922::asset_manager::0xcb7346339340b7f8dea40fcafb70721dc2fcfa7e8626a89fd954d46c1f928b61",
1130
1144
  xTokenManager: "",
1131
- rateLimit: "",
1132
- testToken: ""
1145
+ rateLimit: ""
1133
1146
  },
1134
1147
  supportedTokens: {
1135
1148
  SUI: {
@@ -1557,6 +1570,55 @@ var spokeChainConfig = {
1557
1570
  xChainId: REDBELLY_MAINNET_CHAIN_ID
1558
1571
  }
1559
1572
  }
1573
+ },
1574
+ [STACKS_MAINNET_CHAIN_ID]: {
1575
+ addresses: {
1576
+ assetManager: "SP3031RGK734636C8KGW2Y76TEQBTVX59Q472EQH0.asset-manager-state",
1577
+ connection: "SP3031RGK734636C8KGW2Y76TEQBTVX59Q472EQH0.connection-v3",
1578
+ rateLimit: "SP3031RGK734636C8KGW2Y76TEQBTVX59Q472EQH0.rate-limit-state",
1579
+ xTokenManager: ""
1580
+ },
1581
+ chain: baseChainInfo[STACKS_MAINNET_CHAIN_ID],
1582
+ nativeToken: "ST000000000000000000002AMW42H.nativetoken",
1583
+ bnUSD: "SP3031RGK734636C8KGW2Y76TEQBTVX59Q472EQH0.bnusd",
1584
+ supportedTokens: {
1585
+ STX: {
1586
+ symbol: "STX",
1587
+ name: "Stacks",
1588
+ decimals: 6,
1589
+ address: "ST000000000000000000002AMW42H.nativetoken",
1590
+ xChainId: STACKS_MAINNET_CHAIN_ID
1591
+ },
1592
+ bnUSD: {
1593
+ symbol: "bnUSD",
1594
+ name: "bnUSD",
1595
+ decimals: 6,
1596
+ address: "SP3031RGK734636C8KGW2Y76TEQBTVX59Q472EQH0.bnusd",
1597
+ xChainId: STACKS_MAINNET_CHAIN_ID
1598
+ },
1599
+ SODA: {
1600
+ symbol: "SODA",
1601
+ name: "SODAX",
1602
+ decimals: 6,
1603
+ address: "SP3031RGK734636C8KGW2Y76TEQBTVX59Q472EQH0.soda",
1604
+ xChainId: STACKS_MAINNET_CHAIN_ID
1605
+ },
1606
+ sBTC: {
1607
+ symbol: "sBTC",
1608
+ name: "sBTC",
1609
+ decimals: 8,
1610
+ address: "SM3VDXK3WZZSA84XXFKAFAF15NNZX32CTSG82JFQ4.sbtc-token",
1611
+ xChainId: STACKS_MAINNET_CHAIN_ID
1612
+ },
1613
+ USDC: {
1614
+ symbol: "USDC",
1615
+ name: "USD Coin",
1616
+ decimals: 6,
1617
+ address: "SP120SBRBQJ00MCWS7TM5R8WJNTTKD5K0HFRC2CNE.usdcx",
1618
+ xChainId: STACKS_MAINNET_CHAIN_ID
1619
+ }
1620
+ },
1621
+ rpcUrl: "https://api.mainnet.hiro.so"
1560
1622
  }
1561
1623
  };
1562
1624
  ({
@@ -1983,7 +2045,35 @@ var spokeChainConfig = {
1983
2045
  [spokeChainConfig[REDBELLY_MAINNET_CHAIN_ID].supportedTokens.rPOL.address]: {
1984
2046
  vault: SodaTokens.sodaPOL.address
1985
2047
  }
2048
+ },
2049
+ [STACKS_MAINNET_CHAIN_ID]: {
2050
+ [spokeChainConfig[STACKS_MAINNET_CHAIN_ID].nativeToken]: {
2051
+ vault: SodaTokens.sodaSTX.address
2052
+ },
2053
+ [spokeChainConfig[STACKS_MAINNET_CHAIN_ID].bnUSD]: {
2054
+ vault: SodaTokens.bnUSD.address
2055
+ },
2056
+ [spokeChainConfig[STACKS_MAINNET_CHAIN_ID].supportedTokens.SODA.address]: {
2057
+ vault: SodaTokens.sodaSODA.address
2058
+ },
2059
+ [spokeChainConfig[STACKS_MAINNET_CHAIN_ID].supportedTokens.sBTC.address]: {
2060
+ vault: SodaTokens.sodaBTC.address
2061
+ },
2062
+ [spokeChainConfig[STACKS_MAINNET_CHAIN_ID].supportedTokens.USDC.address]: {
2063
+ vault: SodaTokens.sodaUSDC.address
2064
+ }
1986
2065
  }});
2066
+ ({
2067
+ [SONIC_MAINNET_CHAIN_ID]: [
2068
+ spokeChainConfig[SONIC_MAINNET_CHAIN_ID].supportedTokens.S,
2069
+ spokeChainConfig[SONIC_MAINNET_CHAIN_ID].supportedTokens.WETH,
2070
+ spokeChainConfig[SONIC_MAINNET_CHAIN_ID].supportedTokens.USDC,
2071
+ spokeChainConfig[SONIC_MAINNET_CHAIN_ID].supportedTokens.USDT,
2072
+ spokeChainConfig[SONIC_MAINNET_CHAIN_ID].supportedTokens.wS,
2073
+ spokeChainConfig[SONIC_MAINNET_CHAIN_ID].supportedTokens.SODA,
2074
+ spokeChainConfig[SONIC_MAINNET_CHAIN_ID].supportedTokens.bnUSD,
2075
+ ...Object.values(SodaTokens)
2076
+ ]});
1987
2077
  var moneyMarketConfig = {
1988
2078
  [SONIC_MAINNET_CHAIN_ID]: {
1989
2079
  lendingPool: "0x553434896D39F867761859D0FE7189d2Af70514E",
@@ -2759,6 +2849,104 @@ var StellarWalletProvider = class {
2759
2849
  );
2760
2850
  }
2761
2851
  };
2852
+ function isPrivateKeyStacksWalletConfig(config) {
2853
+ return "privateKey" in config;
2854
+ }
2855
+ function isBrowserExtensionStacksWalletConfig(config) {
2856
+ return "address" in config;
2857
+ }
2858
+ function isStacksPkWallet(wallet) {
2859
+ return wallet.type === "PRIVATE_KEY";
2860
+ }
2861
+ function toPostConditionModeName(mode) {
2862
+ if (mode === void 0) return void 0;
2863
+ return mode === PostConditionMode.Allow ? "allow" : "deny";
2864
+ }
2865
+ var StacksWalletProvider = class {
2866
+ network;
2867
+ wallet;
2868
+ constructor(config) {
2869
+ const mainnet2 = networkFrom("mainnet");
2870
+ this.network = config.endpoint ? { ...mainnet2, client: { ...mainnet2.client, baseUrl: config.endpoint } } : mainnet2;
2871
+ if (isPrivateKeyStacksWalletConfig(config)) {
2872
+ this.wallet = { type: "PRIVATE_KEY", privateKey: config.privateKey };
2873
+ } else if (isBrowserExtensionStacksWalletConfig(config)) {
2874
+ this.wallet = { type: "BROWSER_EXTENSION", address: config.address, provider: config.provider };
2875
+ } else {
2876
+ throw new Error("Invalid Stacks wallet configuration");
2877
+ }
2878
+ }
2879
+ async sendTransaction(txParams) {
2880
+ if (isStacksPkWallet(this.wallet)) {
2881
+ return this.sendTransactionWithPrivateKey(txParams);
2882
+ }
2883
+ return this.sendTransactionWithAdapter(txParams);
2884
+ }
2885
+ async sendTransactionWithPrivateKey(txParams) {
2886
+ const transaction = await makeContractCall({
2887
+ contractAddress: txParams.contractAddress,
2888
+ contractName: txParams.contractName,
2889
+ functionName: txParams.functionName,
2890
+ functionArgs: txParams.functionArgs,
2891
+ senderKey: this.wallet.privateKey,
2892
+ network: this.network,
2893
+ postConditionMode: txParams.postConditionMode,
2894
+ postConditions: txParams.postConditions
2895
+ });
2896
+ const result = await broadcastTransaction({
2897
+ network: this.network,
2898
+ transaction
2899
+ });
2900
+ return result.txid;
2901
+ }
2902
+ async sendTransactionWithAdapter(txParams) {
2903
+ const browserWallet = this.wallet;
2904
+ const contract = `${txParams.contractAddress}.${txParams.contractName}`;
2905
+ const params = {
2906
+ contract,
2907
+ functionName: txParams.functionName,
2908
+ functionArgs: txParams.functionArgs,
2909
+ network: "mainnet",
2910
+ postConditions: txParams.postConditions,
2911
+ postConditionMode: toPostConditionModeName(txParams.postConditionMode)
2912
+ };
2913
+ const result = browserWallet.provider ? await request({ provider: browserWallet.provider }, "stx_callContract", params) : await request("stx_callContract", params);
2914
+ if (!result.txid) {
2915
+ throw new Error("Transaction failed: no txid returned");
2916
+ }
2917
+ return result.txid;
2918
+ }
2919
+ async readContract(txParams) {
2920
+ return fetchCallReadOnlyFunction({
2921
+ contractAddress: txParams.contractAddress,
2922
+ contractName: txParams.contractName,
2923
+ functionName: txParams.functionName,
2924
+ functionArgs: txParams.functionArgs,
2925
+ network: this.network,
2926
+ senderAddress: await this.getWalletAddress()
2927
+ });
2928
+ }
2929
+ async getWalletAddress() {
2930
+ if (isStacksPkWallet(this.wallet)) {
2931
+ return getAddressFromPrivateKey(this.wallet.privateKey, this.network);
2932
+ }
2933
+ return this.wallet.address;
2934
+ }
2935
+ async getBalance(address) {
2936
+ const url = `${this.network.client.baseUrl}/extended/v1/address/${address}/balances`;
2937
+ try {
2938
+ const response = await fetch(url);
2939
+ if (!response.ok) {
2940
+ throw new Error(`Error fetching data: ${response.statusText}`);
2941
+ }
2942
+ const data = await response.json();
2943
+ return BigInt(data.stx.balance);
2944
+ } catch (error) {
2945
+ console.error("Error fetching STX balance:", error);
2946
+ return 0n;
2947
+ }
2948
+ }
2949
+ };
2762
2950
  bitcoin.initEccLib(ecc);
2763
2951
  var ECPair = ECPairFactory(ecc);
2764
2952
  var BitcoinWalletError = class extends Error {
@@ -9434,8 +9622,8 @@ var JsonRpcProvider = class {
9434
9622
  * Gets a light client execution proof for verifying execution outcomes
9435
9623
  * @see [https://github.com/nearprotocol/NEPs/blob/master/specs/ChainSpec/LightClient.md#light-client-proof](https://github.com/nearprotocol/NEPs/blob/master/specs/ChainSpec/LightClient.md#light-client-proof)
9436
9624
  */
9437
- async lightClientProof(request) {
9438
- return await this.sendJsonRpc("EXPERIMENTAL_light_client_proof", request);
9625
+ async lightClientProof(request2) {
9626
+ return await this.sendJsonRpc("EXPERIMENTAL_light_client_proof", request2);
9439
9627
  }
9440
9628
  /**
9441
9629
  * Returns the next light client block as far in the future as possible from the last known hash
@@ -9444,8 +9632,8 @@ var JsonRpcProvider = class {
9444
9632
  *
9445
9633
  * @see [https://github.com/near/NEPs/blob/master/specs/ChainSpec/LightClient.md#light-client-block](https://github.com/near/NEPs/blob/master/specs/ChainSpec/LightClient.md#light-client-block)
9446
9634
  */
9447
- async nextLightClientBlock(request) {
9448
- return await this.sendJsonRpc("next_light_client_block", request);
9635
+ async nextLightClientBlock(request2) {
9636
+ return await this.sendJsonRpc("next_light_client_block", request2);
9449
9637
  }
9450
9638
  /**
9451
9639
  * Gets access key changes for a given array of accountIds
@@ -9531,13 +9719,13 @@ var JsonRpcProvider = class {
9531
9719
  * @param params Parameters to the method
9532
9720
  */
9533
9721
  async sendJsonRpc(method, params) {
9534
- const request = {
9722
+ const request2 = {
9535
9723
  method,
9536
9724
  params,
9537
9725
  id: String(_nextId++),
9538
9726
  jsonrpc: "2.0"
9539
9727
  };
9540
- const response = await fetchJsonRpc(this.connection.url, request, this.connection.headers || {}, retryConfig(this.options.retries, this.options.backoff, this.options.wait));
9728
+ const response = await fetchJsonRpc(this.connection.url, request2, this.connection.headers || {}, retryConfig(this.options.retries, this.options.backoff, this.options.wait));
9541
9729
  if ("error" in response && typeof response.error !== "undefined") {
9542
9730
  throw parseRpcError(response.error);
9543
9731
  }
@@ -10440,6 +10628,8 @@ var Account = class {
10440
10628
  return token.transfer({ from: this, receiverId, amount });
10441
10629
  }
10442
10630
  };
10631
+
10632
+ // src/wallet-providers/NearWalletProvider.ts
10443
10633
  function isPrivateKeyNearWalletConfig(config) {
10444
10634
  return "rpcUrl" in config && "accountId" in config && "privateKey" in config;
10445
10635
  }
@@ -10478,10 +10668,6 @@ var NearWalletProvider = class {
10478
10668
  }
10479
10669
  throw new Error("Wallet not initialized");
10480
10670
  }
10481
- async getWalletAddressBytes() {
10482
- const address = await this.getWalletAddress();
10483
- return toHex(Buffer.from(address, "utf-8"));
10484
- }
10485
10671
  async getRawTransaction(params) {
10486
10672
  const signerId = await this.getWalletAddress();
10487
10673
  return {
@@ -10550,6 +10736,6 @@ var NearWalletProvider = class {
10550
10736
  (*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
10551
10737
  */
10552
10738
 
10553
- export { BigNumberToBigInt, BitcoinWalletError, BitcoinWalletProvider, EvmWalletProvider, IconWalletProvider, InjectiveWalletProvider, NearWalletProvider, SolanaWalletProvider, StellarWalletError, StellarWalletProvider, SuiWalletProvider, getEvmViemChain, hyper, isBrowserExtensionEvmWalletConfig, isBrowserExtensionIconWalletConfig, isBrowserExtensionInjectiveWalletConfig, isBrowserExtensionNearWalletConfig, isBrowserExtensionStellarWalletConfig, isBrowserExtensionSuiWallet, isIconAddress, isIconBrowserExtensionWallet, isIconEoaAddress, isIconPkWallet, isJsonRpcPayloadResponse, isPkSuiWallet, isPrivateKeyEvmWalletConfig, isPrivateKeyIconWalletConfig, isPrivateKeyNearWalletConfig, isPrivateKeyStellarWalletConfig, isResponseAddressType, isResponseSigningType, isSecretInjectiveWalletConfig, isStellarBrowserExtensionWallet, isStellarPkWallet, isSuiWallet, isValidStellarNetwork, isValidStellarPrivateKey, requestAddress, requestJsonRpc, requestSigning };
10739
+ export { BigNumberToBigInt, BitcoinWalletError, BitcoinWalletProvider, EvmWalletProvider, IconWalletProvider, InjectiveWalletProvider, NearWalletProvider, SolanaWalletProvider, StacksWalletProvider, StellarWalletError, StellarWalletProvider, SuiWalletProvider, getEvmViemChain, hyper, isBrowserExtensionEvmWalletConfig, isBrowserExtensionIconWalletConfig, isBrowserExtensionInjectiveWalletConfig, isBrowserExtensionNearWalletConfig, isBrowserExtensionStacksWalletConfig, isBrowserExtensionStellarWalletConfig, isBrowserExtensionSuiWallet, isIconAddress, isIconBrowserExtensionWallet, isIconEoaAddress, isIconPkWallet, isJsonRpcPayloadResponse, isPkSuiWallet, isPrivateKeyEvmWalletConfig, isPrivateKeyIconWalletConfig, isPrivateKeyNearWalletConfig, isPrivateKeyStacksWalletConfig, isPrivateKeyStellarWalletConfig, isResponseAddressType, isResponseSigningType, isSecretInjectiveWalletConfig, isStellarBrowserExtensionWallet, isStellarPkWallet, isSuiWallet, isValidStellarNetwork, isValidStellarPrivateKey, requestAddress, requestJsonRpc, requestSigning };
10554
10740
  //# sourceMappingURL=index.mjs.map
10555
10741
  //# sourceMappingURL=index.mjs.map