@sodax/wallet-sdk-core 2.0.0-rc.2 → 2.0.0-rc.21
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/README.md +1 -2
- package/dist/index.cjs +530 -30
- package/dist/index.d.cts +63 -10
- package/dist/index.d.ts +63 -10
- package/dist/index.mjs +524 -24
- package/package.json +21 -15
- package/ai-exported/AGENTS.md +0 -139
- package/ai-exported/integration/README.md +0 -108
- package/ai-exported/integration/ai-rules.md +0 -141
- package/ai-exported/integration/architecture.md +0 -212
- package/ai-exported/integration/features/README.md +0 -22
- package/ai-exported/integration/features/bitcoin.md +0 -103
- package/ai-exported/integration/features/evm.md +0 -102
- package/ai-exported/integration/features/icon.md +0 -88
- package/ai-exported/integration/features/injective.md +0 -92
- package/ai-exported/integration/features/near.md +0 -92
- package/ai-exported/integration/features/solana.md +0 -104
- package/ai-exported/integration/features/stacks.md +0 -91
- package/ai-exported/integration/features/stellar.md +0 -95
- package/ai-exported/integration/features/sui.md +0 -96
- package/ai-exported/integration/quickstart.md +0 -259
- package/ai-exported/integration/recipes/README.md +0 -15
- package/ai-exported/integration/recipes/bridge-to-sdk.md +0 -145
- package/ai-exported/integration/recipes/defaults-and-overrides.md +0 -159
- package/ai-exported/integration/recipes/library-exports.md +0 -129
- package/ai-exported/integration/recipes/setup-browser-extension.md +0 -137
- package/ai-exported/integration/recipes/setup-private-key.md +0 -115
- package/ai-exported/integration/recipes/sign-and-broadcast.md +0 -201
- package/ai-exported/integration/recipes/testing.md +0 -163
- package/ai-exported/integration/reference/README.md +0 -13
- package/ai-exported/integration/reference/chain-support.md +0 -65
- package/ai-exported/integration/reference/glossary.md +0 -28
- package/ai-exported/integration/reference/interfaces.md +0 -131
- package/ai-exported/integration/reference/provider-classes.md +0 -54
- package/ai-exported/integration/reference/public-api.md +0 -128
- package/ai-exported/migration/README.md +0 -84
- package/ai-exported/migration/ai-rules.md +0 -139
- package/ai-exported/migration/breaking-changes/README.md +0 -14
- package/ai-exported/migration/breaking-changes/base-wallet-provider.md +0 -52
- package/ai-exported/migration/breaking-changes/defaults-config.md +0 -57
- package/ai-exported/migration/breaking-changes/folder-layout.md +0 -99
- package/ai-exported/migration/breaking-changes/library-exports.md +0 -58
- package/ai-exported/migration/checklist.md +0 -62
- package/ai-exported/migration/recipes/README.md +0 -12
- package/ai-exported/migration/recipes/adopt-defaults.md +0 -84
- package/ai-exported/migration/recipes/adopt-library-exports.md +0 -99
- package/ai-exported/migration/reference/README.md +0 -12
- package/ai-exported/migration/reference/added-fields.md +0 -71
- package/ai-exported/migration/reference/deleted-exports.md +0 -35
- package/ai-exported/migration/reference/renamed-symbols.md +0 -31
- package/ai-exported/migration/reference/return-shapes.md +0 -23
- package/dist/index.cjs.map +0 -1
- package/dist/index.mjs.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { EvmRawTransaction, EvmChainKey, IEvmWalletProvider, EvmRawTransactionReceipt, ISuiWalletProvider, SuiTransaction, SuiExecutionResult, SuiPaginatedCoins, IIconWalletProvider, IcxCallTransaction, IconTransactionResult, InjectiveCoin, IInjectiveWalletProvider, JsonObject, InjectiveRawTransaction, InjectiveEoaAddress, InjectiveExecuteResponse, ISolanaWalletProvider, SolanaRpcResponseAndContext, SolanaSignatureResult, TransactionSignature, SolanaRawTransactionInstruction, SolanaSerializedTransaction, SolanaBase58PublicKey, XDR, Hex as Hex$1, IStellarWalletProvider, StellarRawTransactionReceipt, IStacksWalletProvider, StacksTransactionParams, INearWalletProvider, CallContractParams, NearRawTransaction, BtcAddressType, IBitcoinWalletProvider } from '@sodax/types';
|
|
1
|
+
import { EvmRawTransaction, EvmChainKey, IEvmWalletProvider, EvmRawTransactionReceipt, ISuiWalletProvider, SuiTransaction, SuiExecutionResult, SuiPaginatedCoins, IIconWalletProvider, IcxCallTransaction, IconTransactionResult, InjectiveCoin, IInjectiveWalletProvider, JsonObject, InjectiveRawTransaction, InjectiveEoaAddress, InjectiveExecuteResponse, ISolanaWalletProvider, SolanaRpcResponseAndContext, SolanaSignatureResult, TransactionSignature, SolanaRawTransaction, SolanaRawTransactionInstruction, SolanaSerializedTransaction, SolanaBase58PublicKey, XDR, Hex as Hex$1, IStellarWalletProvider, StellarRawTransaction, StellarRawTransactionReceipt, IStacksWalletProvider, StacksTransactionParams, StacksRawTransaction, INearWalletProvider, CallContractParams, NearRawTransaction, BtcAddressType, IBitcoinWalletProvider } from '@sodax/types';
|
|
2
2
|
import * as viem from 'viem';
|
|
3
|
-
import {
|
|
3
|
+
import { WalletClient, Transport, Chain, Account, PublicClient, PublicClientConfig, WalletClientConfig, HttpTransportConfig, SendTransactionParameters, WaitForTransactionReceiptParameters, Address, Hash as Hash$1 } from 'viem';
|
|
4
4
|
export { Account, Address, Chain, HttpTransportConfig, PublicClient, PublicClientConfig, SendTransactionParameters, TransactionReceipt, Transport, WaitForTransactionReceiptParameters, WalletClient, WalletClientConfig } from 'viem';
|
|
5
|
-
import {
|
|
5
|
+
import { SuiClient, SuiTransactionBlockResponseOptions } from '@mysten/sui/client';
|
|
6
6
|
export { SuiTransactionBlockResponseOptions } from '@mysten/sui/client';
|
|
7
7
|
import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
|
|
8
8
|
import { WalletWithFeatures, SuiWalletFeatures, WalletAccount } from '@mysten/wallet-standard';
|
|
@@ -17,22 +17,21 @@ import { ChainId, EvmChainId } from '@injectivelabs/ts-types';
|
|
|
17
17
|
export { ChainId, EvmChainId } from '@injectivelabs/ts-types';
|
|
18
18
|
import { MsgBroadcaster } from '@injectivelabs/wallet-core';
|
|
19
19
|
export { MsgBroadcaster } from '@injectivelabs/wallet-core';
|
|
20
|
-
import { PublicKey, Commitment, ConnectionConfig, SendOptions, Connection, RpcResponseAndContext, TokenAmount } from '@solana/web3.js';
|
|
20
|
+
import { PublicKey, Commitment, ConnectionConfig, SendOptions, Connection, VersionedTransaction, RpcResponseAndContext, TokenAmount } from '@solana/web3.js';
|
|
21
21
|
export { Commitment, ConnectionConfig, SendOptions } from '@solana/web3.js';
|
|
22
22
|
import { SignerWalletAdapterProps } from '@solana/wallet-adapter-base';
|
|
23
23
|
import { Keypair } from '@stellar/stellar-sdk';
|
|
24
24
|
export { Networks } from '@stellar/stellar-sdk';
|
|
25
|
-
import { PostConditionMode, ClarityValue } from '@stacks/
|
|
26
|
-
export { ClarityValue, PostConditionMode, PostConditionModeName } from '@stacks/
|
|
27
|
-
import { StacksProvider } from '@stacks/connect';
|
|
28
|
-
export { StacksProvider } from '@stacks/connect';
|
|
25
|
+
import { PostConditionMode, ClarityValue } from '@sodax/libs/stacks/core';
|
|
26
|
+
export { ClarityValue, PostConditionMode, PostConditionModeName, StacksNetwork } from '@sodax/libs/stacks/core';
|
|
27
|
+
import { StacksProvider } from '@sodax/libs/stacks/connect';
|
|
28
|
+
export { StacksProvider } from '@sodax/libs/stacks/connect';
|
|
29
29
|
import { NearConnector } from '@hot-labs/near-connect';
|
|
30
30
|
export { NearConnector } from '@hot-labs/near-connect';
|
|
31
31
|
import { Account as Account$1, JsonRpcProvider } from 'near-api-js';
|
|
32
32
|
export { KeyPairString } from 'near-api-js';
|
|
33
33
|
import { ECPairInterface } from 'ecpair';
|
|
34
34
|
import * as bitcoin from 'bitcoinjs-lib';
|
|
35
|
-
export { StacksNetwork } from '@stacks/network';
|
|
36
35
|
export { Network as BitcoinJsNetwork } from 'bitcoinjs-lib/src/networks.js';
|
|
37
36
|
|
|
38
37
|
/**
|
|
@@ -163,7 +162,7 @@ declare function isBrowserExtensionEvmWalletConfig(config: EvmWalletConfig): con
|
|
|
163
162
|
* injected by the dApp's wallet adapter (e.g. wagmi). Transport/client defaults are ignored
|
|
164
163
|
* in this mode.
|
|
165
164
|
*
|
|
166
|
-
* All
|
|
165
|
+
* All 13 supported EVM chains are covered via {@link getEvmViemChain}; HyperEVM is defined
|
|
167
166
|
* locally as {@link hyper} because it is absent from `viem/chains`.
|
|
168
167
|
*/
|
|
169
168
|
declare class EvmWalletProvider extends BaseWalletProvider<EvmWalletDefaults> implements IEvmWalletProvider {
|
|
@@ -411,6 +410,8 @@ declare function isSecretInjectiveWalletConfig(config: InjectiveWalletConfig): c
|
|
|
411
410
|
declare class InjectiveWalletProvider extends BaseWalletProvider<InjectiveWalletDefaults> implements IInjectiveWalletProvider {
|
|
412
411
|
readonly chainType: "INJECTIVE";
|
|
413
412
|
wallet: InjectiveWallet;
|
|
413
|
+
/** Network endpoints used to broadcast a signed `TxRaw` via {@link sendTransaction}. */
|
|
414
|
+
private readonly endpoints;
|
|
414
415
|
constructor(config: InjectiveWalletConfig);
|
|
415
416
|
/**
|
|
416
417
|
* Builds a signed-but-unbroadcast Injective transaction for a CosmWasm contract call.
|
|
@@ -429,6 +430,27 @@ declare class InjectiveWalletProvider extends BaseWalletProvider<InjectiveWallet
|
|
|
429
430
|
getWalletAddress(): Promise<InjectiveEoaAddress>;
|
|
430
431
|
getWalletPubKey(): Promise<string>;
|
|
431
432
|
execute(senderAddress: string, contractAddress: string, msg: JsonObject, funds?: InjectiveCoin[], options?: InjectiveWalletDefaults): Promise<InjectiveExecuteResponse>;
|
|
433
|
+
/**
|
|
434
|
+
* Broadcasts an already-signed, proto-encoded Cosmos `TxRaw` via the configured gRPC endpoint.
|
|
435
|
+
* @param signedTxRaw - The signed transaction, encoded with `TxRaw.encode(...).finish()`.
|
|
436
|
+
* @returns The transaction hash.
|
|
437
|
+
* @throws {Error} if the node rejects the transaction (non-zero result code).
|
|
438
|
+
*/
|
|
439
|
+
sendTransaction(signedTxRaw: Uint8Array): Promise<string>;
|
|
440
|
+
/**
|
|
441
|
+
* Signs and broadcasts an unsigned `InjectiveRawTransaction` (e.g. from the Swaps API).
|
|
442
|
+
*
|
|
443
|
+
* - **PK (secret) mode**: signs the exact unsigned `SignDoc` (`bodyBytes`/`authInfoBytes`) and
|
|
444
|
+
* broadcasts it as-is, preserving the precise fee/account the Swaps API built.
|
|
445
|
+
* - **Browser mode (Keplr/Leap/Metamask)**: an EVM wallet can't sign a raw Cosmos `SignDoc`, so we
|
|
446
|
+
* recover the messages from `bodyBytes` and broadcast them through the fee-delegation path (same as
|
|
447
|
+
* {@link execute}). The broadcaster builds the wallet-appropriate sign payload (DIRECT for Cosmos
|
|
448
|
+
* wallets, EIP-712 for Metamask). Trade-off: the broadcaster recomputes gas/fee rather than using
|
|
449
|
+
* the exact fee in the raw tx; the on-chain effect (the execute message) is unchanged.
|
|
450
|
+
*
|
|
451
|
+
* @returns The transaction hash.
|
|
452
|
+
*/
|
|
453
|
+
signAndSendTransaction(tx: InjectiveRawTransaction): Promise<string>;
|
|
432
454
|
}
|
|
433
455
|
|
|
434
456
|
interface WalletContextState {
|
|
@@ -468,12 +490,17 @@ declare class SolanaWalletProvider extends BaseWalletProvider<SolanaWalletDefaul
|
|
|
468
490
|
constructor(walletConfig: SolanaWalletConfig);
|
|
469
491
|
waitForConfirmation(signature: string, commitment?: Commitment): Promise<SolanaRpcResponseAndContext<SolanaSignatureResult>>;
|
|
470
492
|
sendTransaction(rawTransaction: Uint8Array | Array<number>, options?: SendOptions): Promise<TransactionSignature>;
|
|
493
|
+
signAndSendTransaction(params: SolanaRawTransaction): Promise<TransactionSignature>;
|
|
471
494
|
sendTransactionWithConfirmation(rawTransaction: Uint8Array | Array<number>, optionsOrCommitment?: Commitment | {
|
|
472
495
|
send?: SendOptions;
|
|
473
496
|
commitment?: Commitment;
|
|
474
497
|
}): Promise<TransactionSignature>;
|
|
475
498
|
buildV0Txn(rawInstructions: SolanaRawTransactionInstruction[]): Promise<SolanaSerializedTransaction>;
|
|
476
499
|
private buildV0TxnWithAdapter;
|
|
500
|
+
signTransaction(transaction: VersionedTransaction): Promise<VersionedTransaction>;
|
|
501
|
+
signAndSerializeTransaction(transaction: VersionedTransaction): Promise<SolanaSerializedTransaction>;
|
|
502
|
+
signTransactionWithAdapter(transaction: VersionedTransaction): Promise<VersionedTransaction>;
|
|
503
|
+
signTransactionWithKeypair(transaction: VersionedTransaction): Promise<VersionedTransaction>;
|
|
477
504
|
private buildV0TxnWithKeypair;
|
|
478
505
|
getWalletBase58PublicKey(): SolanaBase58PublicKey;
|
|
479
506
|
getWalletAddress(): Promise<string>;
|
|
@@ -509,7 +536,10 @@ type PrivateKeyStellarWalletConfig = {
|
|
|
509
536
|
type: 'PRIVATE_KEY';
|
|
510
537
|
privateKey: Hex$1;
|
|
511
538
|
network: StellarNetwork;
|
|
539
|
+
/** Horizon server URL. Defaults per network. */
|
|
512
540
|
rpcUrl?: string;
|
|
541
|
+
/** Soroban RPC server URL used to broadcast transactions. Defaults per network. */
|
|
542
|
+
sorobanRpcUrl?: string;
|
|
513
543
|
defaults?: StellarWalletDefaults;
|
|
514
544
|
};
|
|
515
545
|
/** Configuration for constructing a `StellarWalletProvider` backed by a browser-extension wallet. */
|
|
@@ -517,7 +547,10 @@ type BrowserExtensionStellarWalletConfig = {
|
|
|
517
547
|
type: 'BROWSER_EXTENSION';
|
|
518
548
|
walletsKit: StellarWalletsKit;
|
|
519
549
|
network: StellarNetwork;
|
|
550
|
+
/** Horizon server URL. Defaults per network. */
|
|
520
551
|
rpcUrl?: string;
|
|
552
|
+
/** Soroban RPC server URL used to broadcast transactions. Defaults per network. */
|
|
553
|
+
sorobanRpcUrl?: string;
|
|
521
554
|
defaults?: StellarWalletDefaults;
|
|
522
555
|
};
|
|
523
556
|
type StellarWalletConfig = PrivateKeyStellarWalletConfig | BrowserExtensionStellarWalletConfig;
|
|
@@ -553,6 +586,7 @@ declare class StellarWalletProvider extends BaseWalletProvider<StellarWalletDefa
|
|
|
553
586
|
readonly chainType: "STELLAR";
|
|
554
587
|
private readonly wallet;
|
|
555
588
|
private readonly server;
|
|
589
|
+
private readonly sorobanServer;
|
|
556
590
|
private readonly networkPassphrase;
|
|
557
591
|
constructor(config: StellarWalletConfig);
|
|
558
592
|
getWalletAddress(): Promise<string>;
|
|
@@ -561,6 +595,18 @@ declare class StellarWalletProvider extends BaseWalletProvider<StellarWalletDefa
|
|
|
561
595
|
* @throws {StellarWalletError} with code `SIGN_TX_ERROR` if signing fails.
|
|
562
596
|
*/
|
|
563
597
|
signTransaction(tx: XDR): Promise<XDR>;
|
|
598
|
+
/**
|
|
599
|
+
* Broadcasts an already-signed XDR transaction via the Soroban RPC server.
|
|
600
|
+
* @returns The transaction hash.
|
|
601
|
+
* @throws {StellarWalletError} with code `SEND_TX_ERROR` if submission fails or the RPC returns an error status.
|
|
602
|
+
*/
|
|
603
|
+
sendTransaction(signedTx: XDR): Promise<string>;
|
|
604
|
+
/**
|
|
605
|
+
* Signs and broadcasts an unsigned `StellarRawTransaction` (e.g. from the Swaps API).
|
|
606
|
+
* @returns The transaction hash.
|
|
607
|
+
* @throws {StellarWalletError} with code `SIGN_TX_ERROR` if signing fails, or `SEND_TX_ERROR` if broadcasting fails.
|
|
608
|
+
*/
|
|
609
|
+
signAndSendTransaction(params: StellarRawTransaction): Promise<string>;
|
|
564
610
|
/**
|
|
565
611
|
* Polls the Horizon server until the transaction is confirmed or the timeout is reached.
|
|
566
612
|
* @throws {StellarWalletError} with code `TX_RECEIPT_TIMEOUT` if the transaction is not found within `pollTimeout` ms.
|
|
@@ -608,6 +654,13 @@ declare class StacksWalletProvider extends BaseWalletProvider<StacksWalletDefaul
|
|
|
608
654
|
private readonly wallet;
|
|
609
655
|
constructor(config: StacksWalletConfig);
|
|
610
656
|
sendTransaction(txParams: StacksTransactionParams, options?: Pick<StacksWalletDefaults, 'postConditionMode'>): Promise<string>;
|
|
657
|
+
/**
|
|
658
|
+
* Signs and broadcasts an unsigned `StacksRawTransaction` (e.g. from the Swaps API). The raw tx's
|
|
659
|
+
* `payload` is the hex-serialized contract-call payload; this deserializes it back into the
|
|
660
|
+
* contract-call params and routes through `sendTransaction` (which signs + broadcasts in both
|
|
661
|
+
* private-key and browser-extension modes). Returns the transaction id.
|
|
662
|
+
*/
|
|
663
|
+
signAndSendTransaction(params: StacksRawTransaction): Promise<string>;
|
|
611
664
|
private sendTransactionWithPrivateKey;
|
|
612
665
|
private sendTransactionWithAdapter;
|
|
613
666
|
readContract(txParams: StacksTransactionParams): Promise<ClarityValue>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { EvmRawTransaction, EvmChainKey, IEvmWalletProvider, EvmRawTransactionReceipt, ISuiWalletProvider, SuiTransaction, SuiExecutionResult, SuiPaginatedCoins, IIconWalletProvider, IcxCallTransaction, IconTransactionResult, InjectiveCoin, IInjectiveWalletProvider, JsonObject, InjectiveRawTransaction, InjectiveEoaAddress, InjectiveExecuteResponse, ISolanaWalletProvider, SolanaRpcResponseAndContext, SolanaSignatureResult, TransactionSignature, SolanaRawTransactionInstruction, SolanaSerializedTransaction, SolanaBase58PublicKey, XDR, Hex as Hex$1, IStellarWalletProvider, StellarRawTransactionReceipt, IStacksWalletProvider, StacksTransactionParams, INearWalletProvider, CallContractParams, NearRawTransaction, BtcAddressType, IBitcoinWalletProvider } from '@sodax/types';
|
|
1
|
+
import { EvmRawTransaction, EvmChainKey, IEvmWalletProvider, EvmRawTransactionReceipt, ISuiWalletProvider, SuiTransaction, SuiExecutionResult, SuiPaginatedCoins, IIconWalletProvider, IcxCallTransaction, IconTransactionResult, InjectiveCoin, IInjectiveWalletProvider, JsonObject, InjectiveRawTransaction, InjectiveEoaAddress, InjectiveExecuteResponse, ISolanaWalletProvider, SolanaRpcResponseAndContext, SolanaSignatureResult, TransactionSignature, SolanaRawTransaction, SolanaRawTransactionInstruction, SolanaSerializedTransaction, SolanaBase58PublicKey, XDR, Hex as Hex$1, IStellarWalletProvider, StellarRawTransaction, StellarRawTransactionReceipt, IStacksWalletProvider, StacksTransactionParams, StacksRawTransaction, INearWalletProvider, CallContractParams, NearRawTransaction, BtcAddressType, IBitcoinWalletProvider } from '@sodax/types';
|
|
2
2
|
import * as viem from 'viem';
|
|
3
|
-
import {
|
|
3
|
+
import { WalletClient, Transport, Chain, Account, PublicClient, PublicClientConfig, WalletClientConfig, HttpTransportConfig, SendTransactionParameters, WaitForTransactionReceiptParameters, Address, Hash as Hash$1 } from 'viem';
|
|
4
4
|
export { Account, Address, Chain, HttpTransportConfig, PublicClient, PublicClientConfig, SendTransactionParameters, TransactionReceipt, Transport, WaitForTransactionReceiptParameters, WalletClient, WalletClientConfig } from 'viem';
|
|
5
|
-
import {
|
|
5
|
+
import { SuiClient, SuiTransactionBlockResponseOptions } from '@mysten/sui/client';
|
|
6
6
|
export { SuiTransactionBlockResponseOptions } from '@mysten/sui/client';
|
|
7
7
|
import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
|
|
8
8
|
import { WalletWithFeatures, SuiWalletFeatures, WalletAccount } from '@mysten/wallet-standard';
|
|
@@ -17,22 +17,21 @@ import { ChainId, EvmChainId } from '@injectivelabs/ts-types';
|
|
|
17
17
|
export { ChainId, EvmChainId } from '@injectivelabs/ts-types';
|
|
18
18
|
import { MsgBroadcaster } from '@injectivelabs/wallet-core';
|
|
19
19
|
export { MsgBroadcaster } from '@injectivelabs/wallet-core';
|
|
20
|
-
import { PublicKey, Commitment, ConnectionConfig, SendOptions, Connection, RpcResponseAndContext, TokenAmount } from '@solana/web3.js';
|
|
20
|
+
import { PublicKey, Commitment, ConnectionConfig, SendOptions, Connection, VersionedTransaction, RpcResponseAndContext, TokenAmount } from '@solana/web3.js';
|
|
21
21
|
export { Commitment, ConnectionConfig, SendOptions } from '@solana/web3.js';
|
|
22
22
|
import { SignerWalletAdapterProps } from '@solana/wallet-adapter-base';
|
|
23
23
|
import { Keypair } from '@stellar/stellar-sdk';
|
|
24
24
|
export { Networks } from '@stellar/stellar-sdk';
|
|
25
|
-
import { PostConditionMode, ClarityValue } from '@stacks/
|
|
26
|
-
export { ClarityValue, PostConditionMode, PostConditionModeName } from '@stacks/
|
|
27
|
-
import { StacksProvider } from '@stacks/connect';
|
|
28
|
-
export { StacksProvider } from '@stacks/connect';
|
|
25
|
+
import { PostConditionMode, ClarityValue } from '@sodax/libs/stacks/core';
|
|
26
|
+
export { ClarityValue, PostConditionMode, PostConditionModeName, StacksNetwork } from '@sodax/libs/stacks/core';
|
|
27
|
+
import { StacksProvider } from '@sodax/libs/stacks/connect';
|
|
28
|
+
export { StacksProvider } from '@sodax/libs/stacks/connect';
|
|
29
29
|
import { NearConnector } from '@hot-labs/near-connect';
|
|
30
30
|
export { NearConnector } from '@hot-labs/near-connect';
|
|
31
31
|
import { Account as Account$1, JsonRpcProvider } from 'near-api-js';
|
|
32
32
|
export { KeyPairString } from 'near-api-js';
|
|
33
33
|
import { ECPairInterface } from 'ecpair';
|
|
34
34
|
import * as bitcoin from 'bitcoinjs-lib';
|
|
35
|
-
export { StacksNetwork } from '@stacks/network';
|
|
36
35
|
export { Network as BitcoinJsNetwork } from 'bitcoinjs-lib/src/networks.js';
|
|
37
36
|
|
|
38
37
|
/**
|
|
@@ -163,7 +162,7 @@ declare function isBrowserExtensionEvmWalletConfig(config: EvmWalletConfig): con
|
|
|
163
162
|
* injected by the dApp's wallet adapter (e.g. wagmi). Transport/client defaults are ignored
|
|
164
163
|
* in this mode.
|
|
165
164
|
*
|
|
166
|
-
* All
|
|
165
|
+
* All 13 supported EVM chains are covered via {@link getEvmViemChain}; HyperEVM is defined
|
|
167
166
|
* locally as {@link hyper} because it is absent from `viem/chains`.
|
|
168
167
|
*/
|
|
169
168
|
declare class EvmWalletProvider extends BaseWalletProvider<EvmWalletDefaults> implements IEvmWalletProvider {
|
|
@@ -411,6 +410,8 @@ declare function isSecretInjectiveWalletConfig(config: InjectiveWalletConfig): c
|
|
|
411
410
|
declare class InjectiveWalletProvider extends BaseWalletProvider<InjectiveWalletDefaults> implements IInjectiveWalletProvider {
|
|
412
411
|
readonly chainType: "INJECTIVE";
|
|
413
412
|
wallet: InjectiveWallet;
|
|
413
|
+
/** Network endpoints used to broadcast a signed `TxRaw` via {@link sendTransaction}. */
|
|
414
|
+
private readonly endpoints;
|
|
414
415
|
constructor(config: InjectiveWalletConfig);
|
|
415
416
|
/**
|
|
416
417
|
* Builds a signed-but-unbroadcast Injective transaction for a CosmWasm contract call.
|
|
@@ -429,6 +430,27 @@ declare class InjectiveWalletProvider extends BaseWalletProvider<InjectiveWallet
|
|
|
429
430
|
getWalletAddress(): Promise<InjectiveEoaAddress>;
|
|
430
431
|
getWalletPubKey(): Promise<string>;
|
|
431
432
|
execute(senderAddress: string, contractAddress: string, msg: JsonObject, funds?: InjectiveCoin[], options?: InjectiveWalletDefaults): Promise<InjectiveExecuteResponse>;
|
|
433
|
+
/**
|
|
434
|
+
* Broadcasts an already-signed, proto-encoded Cosmos `TxRaw` via the configured gRPC endpoint.
|
|
435
|
+
* @param signedTxRaw - The signed transaction, encoded with `TxRaw.encode(...).finish()`.
|
|
436
|
+
* @returns The transaction hash.
|
|
437
|
+
* @throws {Error} if the node rejects the transaction (non-zero result code).
|
|
438
|
+
*/
|
|
439
|
+
sendTransaction(signedTxRaw: Uint8Array): Promise<string>;
|
|
440
|
+
/**
|
|
441
|
+
* Signs and broadcasts an unsigned `InjectiveRawTransaction` (e.g. from the Swaps API).
|
|
442
|
+
*
|
|
443
|
+
* - **PK (secret) mode**: signs the exact unsigned `SignDoc` (`bodyBytes`/`authInfoBytes`) and
|
|
444
|
+
* broadcasts it as-is, preserving the precise fee/account the Swaps API built.
|
|
445
|
+
* - **Browser mode (Keplr/Leap/Metamask)**: an EVM wallet can't sign a raw Cosmos `SignDoc`, so we
|
|
446
|
+
* recover the messages from `bodyBytes` and broadcast them through the fee-delegation path (same as
|
|
447
|
+
* {@link execute}). The broadcaster builds the wallet-appropriate sign payload (DIRECT for Cosmos
|
|
448
|
+
* wallets, EIP-712 for Metamask). Trade-off: the broadcaster recomputes gas/fee rather than using
|
|
449
|
+
* the exact fee in the raw tx; the on-chain effect (the execute message) is unchanged.
|
|
450
|
+
*
|
|
451
|
+
* @returns The transaction hash.
|
|
452
|
+
*/
|
|
453
|
+
signAndSendTransaction(tx: InjectiveRawTransaction): Promise<string>;
|
|
432
454
|
}
|
|
433
455
|
|
|
434
456
|
interface WalletContextState {
|
|
@@ -468,12 +490,17 @@ declare class SolanaWalletProvider extends BaseWalletProvider<SolanaWalletDefaul
|
|
|
468
490
|
constructor(walletConfig: SolanaWalletConfig);
|
|
469
491
|
waitForConfirmation(signature: string, commitment?: Commitment): Promise<SolanaRpcResponseAndContext<SolanaSignatureResult>>;
|
|
470
492
|
sendTransaction(rawTransaction: Uint8Array | Array<number>, options?: SendOptions): Promise<TransactionSignature>;
|
|
493
|
+
signAndSendTransaction(params: SolanaRawTransaction): Promise<TransactionSignature>;
|
|
471
494
|
sendTransactionWithConfirmation(rawTransaction: Uint8Array | Array<number>, optionsOrCommitment?: Commitment | {
|
|
472
495
|
send?: SendOptions;
|
|
473
496
|
commitment?: Commitment;
|
|
474
497
|
}): Promise<TransactionSignature>;
|
|
475
498
|
buildV0Txn(rawInstructions: SolanaRawTransactionInstruction[]): Promise<SolanaSerializedTransaction>;
|
|
476
499
|
private buildV0TxnWithAdapter;
|
|
500
|
+
signTransaction(transaction: VersionedTransaction): Promise<VersionedTransaction>;
|
|
501
|
+
signAndSerializeTransaction(transaction: VersionedTransaction): Promise<SolanaSerializedTransaction>;
|
|
502
|
+
signTransactionWithAdapter(transaction: VersionedTransaction): Promise<VersionedTransaction>;
|
|
503
|
+
signTransactionWithKeypair(transaction: VersionedTransaction): Promise<VersionedTransaction>;
|
|
477
504
|
private buildV0TxnWithKeypair;
|
|
478
505
|
getWalletBase58PublicKey(): SolanaBase58PublicKey;
|
|
479
506
|
getWalletAddress(): Promise<string>;
|
|
@@ -509,7 +536,10 @@ type PrivateKeyStellarWalletConfig = {
|
|
|
509
536
|
type: 'PRIVATE_KEY';
|
|
510
537
|
privateKey: Hex$1;
|
|
511
538
|
network: StellarNetwork;
|
|
539
|
+
/** Horizon server URL. Defaults per network. */
|
|
512
540
|
rpcUrl?: string;
|
|
541
|
+
/** Soroban RPC server URL used to broadcast transactions. Defaults per network. */
|
|
542
|
+
sorobanRpcUrl?: string;
|
|
513
543
|
defaults?: StellarWalletDefaults;
|
|
514
544
|
};
|
|
515
545
|
/** Configuration for constructing a `StellarWalletProvider` backed by a browser-extension wallet. */
|
|
@@ -517,7 +547,10 @@ type BrowserExtensionStellarWalletConfig = {
|
|
|
517
547
|
type: 'BROWSER_EXTENSION';
|
|
518
548
|
walletsKit: StellarWalletsKit;
|
|
519
549
|
network: StellarNetwork;
|
|
550
|
+
/** Horizon server URL. Defaults per network. */
|
|
520
551
|
rpcUrl?: string;
|
|
552
|
+
/** Soroban RPC server URL used to broadcast transactions. Defaults per network. */
|
|
553
|
+
sorobanRpcUrl?: string;
|
|
521
554
|
defaults?: StellarWalletDefaults;
|
|
522
555
|
};
|
|
523
556
|
type StellarWalletConfig = PrivateKeyStellarWalletConfig | BrowserExtensionStellarWalletConfig;
|
|
@@ -553,6 +586,7 @@ declare class StellarWalletProvider extends BaseWalletProvider<StellarWalletDefa
|
|
|
553
586
|
readonly chainType: "STELLAR";
|
|
554
587
|
private readonly wallet;
|
|
555
588
|
private readonly server;
|
|
589
|
+
private readonly sorobanServer;
|
|
556
590
|
private readonly networkPassphrase;
|
|
557
591
|
constructor(config: StellarWalletConfig);
|
|
558
592
|
getWalletAddress(): Promise<string>;
|
|
@@ -561,6 +595,18 @@ declare class StellarWalletProvider extends BaseWalletProvider<StellarWalletDefa
|
|
|
561
595
|
* @throws {StellarWalletError} with code `SIGN_TX_ERROR` if signing fails.
|
|
562
596
|
*/
|
|
563
597
|
signTransaction(tx: XDR): Promise<XDR>;
|
|
598
|
+
/**
|
|
599
|
+
* Broadcasts an already-signed XDR transaction via the Soroban RPC server.
|
|
600
|
+
* @returns The transaction hash.
|
|
601
|
+
* @throws {StellarWalletError} with code `SEND_TX_ERROR` if submission fails or the RPC returns an error status.
|
|
602
|
+
*/
|
|
603
|
+
sendTransaction(signedTx: XDR): Promise<string>;
|
|
604
|
+
/**
|
|
605
|
+
* Signs and broadcasts an unsigned `StellarRawTransaction` (e.g. from the Swaps API).
|
|
606
|
+
* @returns The transaction hash.
|
|
607
|
+
* @throws {StellarWalletError} with code `SIGN_TX_ERROR` if signing fails, or `SEND_TX_ERROR` if broadcasting fails.
|
|
608
|
+
*/
|
|
609
|
+
signAndSendTransaction(params: StellarRawTransaction): Promise<string>;
|
|
564
610
|
/**
|
|
565
611
|
* Polls the Horizon server until the transaction is confirmed or the timeout is reached.
|
|
566
612
|
* @throws {StellarWalletError} with code `TX_RECEIPT_TIMEOUT` if the transaction is not found within `pollTimeout` ms.
|
|
@@ -608,6 +654,13 @@ declare class StacksWalletProvider extends BaseWalletProvider<StacksWalletDefaul
|
|
|
608
654
|
private readonly wallet;
|
|
609
655
|
constructor(config: StacksWalletConfig);
|
|
610
656
|
sendTransaction(txParams: StacksTransactionParams, options?: Pick<StacksWalletDefaults, 'postConditionMode'>): Promise<string>;
|
|
657
|
+
/**
|
|
658
|
+
* Signs and broadcasts an unsigned `StacksRawTransaction` (e.g. from the Swaps API). The raw tx's
|
|
659
|
+
* `payload` is the hex-serialized contract-call payload; this deserializes it back into the
|
|
660
|
+
* contract-call params and routes through `sendTransaction` (which signs + broadcasts in both
|
|
661
|
+
* private-key and browser-extension modes). Returns the transaction id.
|
|
662
|
+
*/
|
|
663
|
+
signAndSendTransaction(params: StacksRawTransaction): Promise<string>;
|
|
611
664
|
private sendTransactionWithPrivateKey;
|
|
612
665
|
private sendTransactionWithAdapter;
|
|
613
666
|
readContract(txParams: StacksTransactionParams): Promise<ClarityValue>;
|