@sodax/wallet-sdk-core 1.3.0-beta → 1.3.1-beta-rc2

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, 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, 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 * as bitcoin from 'bitcoinjs-lib';
17
+ import { ECPairInterface } from 'ecpair';
16
18
  import { Account as Account$1, JsonRpcProvider } from 'near-api-js';
17
19
  import { NearConnector } from '@hot-labs/near-connect';
18
20
 
@@ -243,7 +245,7 @@ type PrivateKeySolanaWalletConfig = {
243
245
  };
244
246
  type BrowserExtensionSolanaWalletConfig = {
245
247
  wallet: WalletContextState;
246
- connection: Connection;
248
+ endpoint: string;
247
249
  };
248
250
  type SolanaWalletConfig = PrivateKeySolanaWalletConfig | BrowserExtensionSolanaWalletConfig;
249
251
  declare class SolanaWalletProvider implements ISolanaWalletProvider {
@@ -343,6 +345,54 @@ declare class StellarWalletProvider implements IStellarWalletProvider {
343
345
  waitForTransactionReceipt(txHash: string): Promise<StellarRawTransactionReceipt>;
344
346
  }
345
347
 
348
+ type BitcoinNetwork = 'TESTNET' | 'MAINNET';
349
+ interface BitcoinWalletsKit {
350
+ getAccounts(): Promise<string[]>;
351
+ signPsbt(psbtHex: string): Promise<{
352
+ psbtHex: string;
353
+ }>;
354
+ signMessage(message: string): Promise<string>;
355
+ signEcdsaMessage(message: string): Promise<string>;
356
+ signBip322Message(message: string): Promise<string>;
357
+ getPublicKey(): Promise<string>;
358
+ sendBitcoin?(toAddress: string, satoshis: number): Promise<string>;
359
+ }
360
+ type PrivateKeyBitcoinWalletConfig = {
361
+ type: 'PRIVATE_KEY';
362
+ privateKey: Hex$1;
363
+ network: BitcoinNetwork;
364
+ addressType?: AddressType;
365
+ };
366
+ type BrowserExtensionBitcoinWalletConfig = {
367
+ type: 'BROWSER_EXTENSION';
368
+ walletsKit: BitcoinWalletsKit;
369
+ network: BitcoinNetwork;
370
+ };
371
+ type BitcoinWalletConfig = PrivateKeyBitcoinWalletConfig | BrowserExtensionBitcoinWalletConfig;
372
+ declare class BitcoinWalletError extends Error {
373
+ constructor(message: string);
374
+ }
375
+ declare class BitcoinWalletProvider implements IBitcoinWalletProvider {
376
+ private readonly wallet;
377
+ private readonly network;
378
+ constructor(config: BitcoinWalletConfig);
379
+ getWalletAddress(): Promise<string>;
380
+ getPublicKey(): Promise<string>;
381
+ getAddressType(address: string): Promise<AddressType>;
382
+ /**
383
+ * Sign PSBT and return fully signed transaction hex
384
+ */
385
+ signTransaction(psbtBase64: string, finalize?: boolean): Promise<string>;
386
+ /**
387
+ * Sign arbitrary message using ECDSA
388
+ * Used for withdrawals
389
+ */
390
+ signEcdsaMessage(message: string): Promise<string>;
391
+ signBip322Message(message: string): Promise<string>;
392
+ getPayment(keyPair: ECPairInterface, addressType: AddressType): bitcoin.Payment;
393
+ sendBitcoin(toAddress: string, satoshis: bigint): Promise<string>;
394
+ }
395
+
346
396
  /**
347
397
  * Near Wallet Configuration Types
348
398
  */
@@ -375,4 +425,4 @@ declare class NearWalletProvider implements INearWalletProvider {
375
425
  signAndSubmitTxn(transaction: NearRawTransaction): Promise<string>;
376
426
  }
377
427
 
378
- export { BigNumberToBigInt, 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 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 };
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 };
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, 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, 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 * as bitcoin from 'bitcoinjs-lib';
17
+ import { ECPairInterface } from 'ecpair';
16
18
  import { Account as Account$1, JsonRpcProvider } from 'near-api-js';
17
19
  import { NearConnector } from '@hot-labs/near-connect';
18
20
 
@@ -243,7 +245,7 @@ type PrivateKeySolanaWalletConfig = {
243
245
  };
244
246
  type BrowserExtensionSolanaWalletConfig = {
245
247
  wallet: WalletContextState;
246
- connection: Connection;
248
+ endpoint: string;
247
249
  };
248
250
  type SolanaWalletConfig = PrivateKeySolanaWalletConfig | BrowserExtensionSolanaWalletConfig;
249
251
  declare class SolanaWalletProvider implements ISolanaWalletProvider {
@@ -343,6 +345,54 @@ declare class StellarWalletProvider implements IStellarWalletProvider {
343
345
  waitForTransactionReceipt(txHash: string): Promise<StellarRawTransactionReceipt>;
344
346
  }
345
347
 
348
+ type BitcoinNetwork = 'TESTNET' | 'MAINNET';
349
+ interface BitcoinWalletsKit {
350
+ getAccounts(): Promise<string[]>;
351
+ signPsbt(psbtHex: string): Promise<{
352
+ psbtHex: string;
353
+ }>;
354
+ signMessage(message: string): Promise<string>;
355
+ signEcdsaMessage(message: string): Promise<string>;
356
+ signBip322Message(message: string): Promise<string>;
357
+ getPublicKey(): Promise<string>;
358
+ sendBitcoin?(toAddress: string, satoshis: number): Promise<string>;
359
+ }
360
+ type PrivateKeyBitcoinWalletConfig = {
361
+ type: 'PRIVATE_KEY';
362
+ privateKey: Hex$1;
363
+ network: BitcoinNetwork;
364
+ addressType?: AddressType;
365
+ };
366
+ type BrowserExtensionBitcoinWalletConfig = {
367
+ type: 'BROWSER_EXTENSION';
368
+ walletsKit: BitcoinWalletsKit;
369
+ network: BitcoinNetwork;
370
+ };
371
+ type BitcoinWalletConfig = PrivateKeyBitcoinWalletConfig | BrowserExtensionBitcoinWalletConfig;
372
+ declare class BitcoinWalletError extends Error {
373
+ constructor(message: string);
374
+ }
375
+ declare class BitcoinWalletProvider implements IBitcoinWalletProvider {
376
+ private readonly wallet;
377
+ private readonly network;
378
+ constructor(config: BitcoinWalletConfig);
379
+ getWalletAddress(): Promise<string>;
380
+ getPublicKey(): Promise<string>;
381
+ getAddressType(address: string): Promise<AddressType>;
382
+ /**
383
+ * Sign PSBT and return fully signed transaction hex
384
+ */
385
+ signTransaction(psbtBase64: string, finalize?: boolean): Promise<string>;
386
+ /**
387
+ * Sign arbitrary message using ECDSA
388
+ * Used for withdrawals
389
+ */
390
+ signEcdsaMessage(message: string): Promise<string>;
391
+ signBip322Message(message: string): Promise<string>;
392
+ getPayment(keyPair: ECPairInterface, addressType: AddressType): bitcoin.Payment;
393
+ sendBitcoin(toAddress: string, satoshis: bigint): Promise<string>;
394
+ }
395
+
346
396
  /**
347
397
  * Near Wallet Configuration Types
348
398
  */
@@ -375,4 +425,4 @@ declare class NearWalletProvider implements INearWalletProvider {
375
425
  signAndSubmitTxn(transaction: NearRawTransaction): Promise<string>;
376
426
  }
377
427
 
378
- export { BigNumberToBigInt, 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 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 };
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 };