@stableops/wallet-sdk 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,184 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ https://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction, and
10
+ distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by the copyright
13
+ owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all other entities
16
+ that control, are controlled by, or are under common control with that entity.
17
+ For the purposes of this definition, "control" means (i) the power, direct or
18
+ indirect, to cause the direction or management of such entity, whether by
19
+ contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
20
+ outstanding shares, or (iii) beneficial ownership of such entity.
21
+
22
+ "You" (or "Your") shall mean an individual or Legal Entity exercising
23
+ permissions granted by this License.
24
+
25
+ "Source" form shall mean the preferred form for making modifications, including
26
+ but not limited to software source code, documentation source, and configuration
27
+ files.
28
+
29
+ "Object" form shall mean any form resulting from mechanical transformation or
30
+ translation of a Source form, including but not limited to compiled object code,
31
+ generated documentation, and conversions to other media types.
32
+
33
+ "Work" shall mean the work of authorship, whether in Source or Object form,
34
+ made available under the License, as indicated by a copyright notice that is
35
+ included in or attached to the work (an example is provided in the Appendix
36
+ below).
37
+
38
+ "Derivative Works" shall mean any work, whether in Source or Object form, that
39
+ is based on (or derived from) the Work and for which the editorial revisions,
40
+ annotations, elaborations, or other modifications represent, as a whole, an
41
+ original work of authorship. For the purposes of this License, Derivative Works
42
+ shall not include works that remain separable from, or merely link (or bind by
43
+ name) to the interfaces of, the Work and Derivative Works thereof.
44
+
45
+ "Contribution" shall mean any work of authorship, including the original
46
+ version of the Work and any modifications or additions to that Work or
47
+ Derivative Works thereof, that is intentionally submitted to Licensor for
48
+ inclusion in the Work by the copyright owner or by an individual or Legal Entity
49
+ authorized to submit on behalf of the copyright owner. For the purposes of this
50
+ definition, "submitted" means any form of electronic, verbal, or written
51
+ communication sent to the Licensor or its representatives, including but not
52
+ limited to communication on electronic mailing lists, source code control
53
+ systems, and issue tracking systems that are managed by, or on behalf of, the
54
+ Licensor for the purpose of discussing and improving the Work, but excluding
55
+ communication that is conspicuously marked or otherwise designated in writing by
56
+ the copyright owner as "Not a Contribution."
57
+
58
+ "Contributor" shall mean Licensor and any individual or Legal Entity on behalf
59
+ of whom a Contribution has been received by Licensor and subsequently
60
+ incorporated within the Work.
61
+
62
+ 2. Grant of Copyright License. Subject to the terms and conditions of this
63
+ License, each Contributor hereby grants to You a perpetual, worldwide,
64
+ non-exclusive, no-charge, royalty-free, irrevocable copyright license to
65
+ reproduce, prepare Derivative Works of, publicly display, publicly perform,
66
+ sublicense, and distribute the Work and such Derivative Works in Source or
67
+ Object form.
68
+
69
+ 3. Grant of Patent License. Subject to the terms and conditions of this
70
+ License, each Contributor hereby grants to You a perpetual, worldwide,
71
+ non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this
72
+ section) patent license to make, have made, use, offer to sell, sell, import,
73
+ and otherwise transfer the Work, where such license applies only to those patent
74
+ claims licensable by such Contributor that are necessarily infringed by their
75
+ Contribution(s) alone or by combination of their Contribution(s) with the Work
76
+ to which such Contribution(s) was submitted. If You institute patent litigation
77
+ against any entity (including a cross-claim or counterclaim in a lawsuit)
78
+ alleging that the Work or a Contribution incorporated within the Work
79
+ constitutes direct or contributory patent infringement, then any patent licenses
80
+ granted to You under this License for that Work shall terminate as of the date
81
+ such litigation is filed.
82
+
83
+ 4. Redistribution. You may reproduce and distribute copies of the Work or
84
+ Derivative Works thereof in any medium, with or without modifications, and in
85
+ Source or Object form, provided that You meet the following conditions:
86
+
87
+ (a) You must give any other recipients of the Work or Derivative Works a copy of
88
+ this License; and
89
+
90
+ (b) You must cause any modified files to carry prominent notices stating that
91
+ You changed the files; and
92
+
93
+ (c) You must retain, in the Source form of any Derivative Works that You
94
+ distribute, all copyright, patent, trademark, and attribution notices from the
95
+ Source form of the Work, excluding those notices that do not pertain to any part
96
+ of the Derivative Works; and
97
+
98
+ (d) If the Work includes a "NOTICE" text file as part of its distribution, then
99
+ any Derivative Works that You distribute must include a readable copy of the
100
+ attribution notices contained within such NOTICE file, excluding those notices
101
+ that do not pertain to any part of the Derivative Works, in at least one of the
102
+ following places: within a NOTICE text file distributed as part of the
103
+ Derivative Works; within the Source form or documentation, if provided along
104
+ with the Derivative Works; or, within a display generated by the Derivative
105
+ Works, if and wherever such third-party notices normally appear. The contents of
106
+ the NOTICE file are for informational purposes only and do not modify the
107
+ License. You may add Your own attribution notices within Derivative Works that
108
+ You distribute, alongside or as an addendum to the NOTICE text from the Work,
109
+ provided that such additional attribution notices cannot be construed as
110
+ modifying the License.
111
+
112
+ You may add Your own copyright statement to Your modifications and may provide
113
+ additional or different license terms and conditions for use, reproduction, or
114
+ distribution of Your modifications, or for any such Derivative Works as a whole,
115
+ provided Your use, reproduction, and distribution of the Work otherwise complies
116
+ with the conditions stated in this License.
117
+
118
+ 5. Submission of Contributions. Unless You explicitly state otherwise, any
119
+ Contribution intentionally submitted for inclusion in the Work by You to the
120
+ Licensor shall be under the terms and conditions of this License, without any
121
+ additional terms or conditions. Notwithstanding the above, nothing herein shall
122
+ supersede or modify the terms of any separate license agreement you may have
123
+ executed with Licensor regarding such Contributions.
124
+
125
+ 6. Trademarks. This License does not grant permission to use the trade names,
126
+ trademarks, service marks, or product names of the Licensor, except as required
127
+ for reasonable and customary use in describing the origin of the Work and
128
+ reproducing the content of the NOTICE file.
129
+
130
+ 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in
131
+ writing, Licensor provides the Work (and each Contributor provides its
132
+ Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
133
+ KIND, either express or implied, including, without limitation, any warranties
134
+ or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
135
+ PARTICULAR PURPOSE. You are solely responsible for determining the
136
+ appropriateness of using or redistributing the Work and assume any risks
137
+ associated with Your exercise of permissions under this License.
138
+
139
+ 8. Limitation of Liability. In no event and under no legal theory, whether in
140
+ tort (including negligence), contract, or otherwise, unless required by
141
+ applicable law (such as deliberate and grossly negligent acts) or agreed to in
142
+ writing, shall any Contributor be liable to You for damages, including any
143
+ direct, indirect, special, incidental, or consequential damages of any
144
+ character arising as a result of this License or out of the use or inability to
145
+ use the Work (including but not limited to damages for loss of goodwill, work
146
+ stoppage, computer failure or malfunction, or any and all other commercial
147
+ damages or losses), even if such Contributor has been advised of the
148
+ possibility of such damages.
149
+
150
+ 9. Accepting Warranty or Additional Liability. While redistributing the Work or
151
+ Derivative Works thereof, You may choose to offer, and charge a fee for,
152
+ acceptance of support, warranty, indemnity, or other liability obligations
153
+ and/or rights consistent with this License. However, in accepting such
154
+ obligations, You may act only on Your own behalf and on Your sole
155
+ responsibility, not on behalf of any other Contributor, and only if You agree
156
+ to indemnify, defend, and hold each Contributor harmless for any liability
157
+ incurred by, or claims asserted against, such Contributor by reason of your
158
+ accepting any such warranty or additional liability.
159
+
160
+ END OF TERMS AND CONDITIONS
161
+
162
+ APPENDIX: How to apply the Apache License to your work.
163
+
164
+ To apply the Apache License to your work, attach the following boilerplate
165
+ notice, with the fields enclosed by brackets "[]" replaced with your own
166
+ identifying information. (Don't include the brackets!) The text should be
167
+ enclosed in the appropriate comment syntax for the file format. We also
168
+ recommend that a file or class name and description of purpose be included on
169
+ the same "printed page" as the copyright notice for easier identification
170
+ within third-party archives.
171
+
172
+ Copyright [yyyy] [name of copyright owner]
173
+
174
+ Licensed under the Apache License, Version 2.0 (the "License");
175
+ you may not use this file except in compliance with the License.
176
+ You may obtain a copy of the License at
177
+
178
+ https://www.apache.org/licenses/LICENSE-2.0
179
+
180
+ Unless required by applicable law or agreed to in writing, software
181
+ distributed under the License is distributed on an "AS IS" BASIS,
182
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
183
+ See the License for the specific language governing permissions and
184
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,148 @@
1
+ # StableOps Wallet SDK
2
+
3
+ Official TypeScript wallet helper for StableOps checkout flows.
4
+
5
+ [中文文档](./README.zh-CN.md)
6
+
7
+ StableOps Wallet SDK helps browser applications send on-chain stablecoin
8
+ payments from mainstream self-custody wallets to the chain-specific payment
9
+ instructions returned by StableOps. StableOps still owns payment order
10
+ creation, idempotency, address allocation, chain scanning, confirmation
11
+ tracking, and webhook delivery. The wallet helper is responsible only for
12
+ selecting a payable instruction and asking the user's wallet to sign and
13
+ broadcast the transfer.
14
+
15
+ This SDK is intended for browser applications that already receive a payment
16
+ order from a trusted backend and need to complete the on-chain payment step.
17
+
18
+ ## Documentation
19
+
20
+ For complete guides, API references, wallet integration examples, and payment
21
+ flow details, see the official documentation:
22
+
23
+ - English docs: https://stableops.dev/en/docs
24
+ - Chinese docs: https://stableops.dev/zh/docs
25
+
26
+ ## Features
27
+
28
+ - Browser-first helper for StableOps payment instructions.
29
+ - EVM wallet support via EIP-1193 providers.
30
+ - TRON wallet support via TronLink / TronWeb providers.
31
+ - Solana wallet support via wallet adapters.
32
+ - Automatic candidate selection from available injected wallets.
33
+ - Chain-specific token transfer helpers for ERC-20, TRC-20, and SPL tokens.
34
+ - Self-contained public types with no StableOps workspace dependencies.
35
+ - Dual CJS and ESM builds with generated TypeScript declarations.
36
+
37
+ ## Requirements
38
+
39
+ - A browser environment.
40
+ - A payment order created by your backend.
41
+ - An injected or supplied wallet provider.
42
+
43
+ Do not expose `STABLEOPS_API_KEY` in the browser. Create payment orders on your
44
+ server and send only the order id, amount, and `paymentInstructions` to the
45
+ frontend.
46
+
47
+ ## Installation
48
+
49
+ ```bash
50
+ pnpm add @stableops/wallet-sdk
51
+ ```
52
+
53
+ ```bash
54
+ npm install @stableops/wallet-sdk
55
+ ```
56
+
57
+ ```bash
58
+ yarn add @stableops/wallet-sdk
59
+ ```
60
+
61
+ ## Quick Start
62
+
63
+ Use the order returned by your backend and let the SDK choose a compatible
64
+ wallet provider from the browser.
65
+
66
+ ```ts
67
+ import {
68
+ getInjectedWalletProviders,
69
+ sendOrderWalletPayment,
70
+ } from '@stableops/wallet-sdk'
71
+
72
+ const sent = await sendOrderWalletPayment({
73
+ order,
74
+ providers: getInjectedWalletProviders(),
75
+ })
76
+
77
+ console.log(sent.txHash)
78
+ ```
79
+
80
+ This is the highest-level path. It selects a payable instruction from the
81
+ order's candidate list and sends the on-chain transfer through the first
82
+ matching provider.
83
+
84
+ ## Manual Selection
85
+
86
+ If you want to control which chain the user pays on, select the instruction and
87
+ provider yourself, then call the lower-level sender.
88
+
89
+ ```ts
90
+ import {
91
+ getInjectedWalletProviders,
92
+ selectWalletPaymentInstruction,
93
+ sendWalletPayment,
94
+ } from '@stableops/wallet-sdk'
95
+
96
+ const { instruction, provider } = selectWalletPaymentInstruction(
97
+ order.paymentInstructions,
98
+ getInjectedWalletProviders(),
99
+ )
100
+
101
+ const sent = await sendWalletPayment({
102
+ provider,
103
+ amount: order.amount,
104
+ instruction,
105
+ })
106
+
107
+ console.log(sent)
108
+ ```
109
+
110
+ ## Supported Wallet Flows
111
+
112
+ The SDK currently supports:
113
+
114
+ - EVM networks through EIP-1193 wallets such as MetaMask and compatible providers.
115
+ - TRON through TronLink / TronWeb providers.
116
+ - Solana through wallet adapters that support `signAndSendTransaction` or `signTransaction`.
117
+
118
+ The transfer flow is chain-aware:
119
+
120
+ - EVM: switches or adds the network when needed, then sends an ERC-20 `transfer`.
121
+ - TRON: builds, signs, and broadcasts a TRC-20 `transfer`.
122
+ - Solana: creates the associated token account idempotently and sends an SPL Token `TransferChecked`.
123
+
124
+ ## Supported Chains and Assets
125
+
126
+ This SDK supports:
127
+
128
+ - Chains: Ethereum, Base, Arbitrum, Polygon, TRON, Solana, and supported testnets.
129
+ - Assets: USDC and USDT.
130
+
131
+ See the official docs for the latest supported chains, assets, and environment
132
+ guidance:
133
+
134
+ - https://stableops.dev/en/docs
135
+ - https://stableops.dev/zh/docs
136
+
137
+ ## Common Usage Notes
138
+
139
+ - Create the payment order on your backend with `@stableops/api-sdk`.
140
+ - Pass only `amount` and `paymentInstructions` to the browser.
141
+ - Use the browser wallet to send the transfer to the order-specific address.
142
+ - Let StableOps confirm the transfer and dispatch webhook updates back to your server.
143
+
144
+ For a full end-to-end flow, see the official quickstart and wallet SDK docs.
145
+
146
+ ## License
147
+
148
+ This SDK is licensed under `Apache-2.0`. See [LICENSE](./LICENSE).
@@ -0,0 +1,133 @@
1
+ # StableOps Wallet SDK
2
+
3
+ StableOps 官方浏览器钱包支付辅助 SDK。
4
+
5
+ [View English README](./README.md)
6
+
7
+ StableOps Wallet SDK 用于浏览器侧从主流自托管钱包发起链上稳定币支付,并把资金转到 StableOps 返回的链上 `paymentInstructions`。StableOps 仍然负责 Payment Order 创建、幂等、地址分配、链上扫描、确认数推进和 Webhook 投递;这个钱包 SDK 只负责选择可支付的指令,并请求用户的钱包签名和广播转账。
8
+
9
+ 这个 SDK 适合已经从可信后端拿到支付订单,并且需要在前端完成链上付款步骤的浏览器应用。
10
+
11
+ ## 官方文档
12
+
13
+ 完整接入指南、API Reference、钱包集成示例和支付流程说明,请查看官方文档:
14
+
15
+ - 中文文档:https://stableops.dev/zh/docs
16
+ - English docs:https://stableops.dev/en/docs
17
+
18
+ ## 功能
19
+
20
+ - 面向浏览器的 StableOps 支付指令发送助手。
21
+ - 通过 EIP-1193 provider 支持 EVM 钱包。
22
+ - 通过 TronLink / TronWeb provider 支持 TRON 钱包。
23
+ - 通过 wallet adapter 支持 Solana 钱包。
24
+ - 可从浏览器当前可用的钱包中自动选择候选支付指令。
25
+ - 内置 ERC-20、TRC-20、SPL Token 的链上转账辅助逻辑。
26
+ - Public types 已内联,不依赖 StableOps 内部 workspace 包。
27
+ - 同时输出 CJS、ESM 和 TypeScript 类型声明。
28
+
29
+ ## 环境要求
30
+
31
+ - 浏览器运行环境。
32
+ - 由后端创建好的 Payment Order。
33
+ - 浏览器注入的钱包 provider,或你主动传入的钱包 provider。
34
+
35
+ 不要把 `STABLEOPS_API_KEY` 暴露到浏览器。Payment Order 必须在服务端创建,前端只接收订单 id、金额和 `paymentInstructions`。
36
+
37
+ ## 安装
38
+
39
+ ```bash
40
+ pnpm add @stableops/wallet-sdk
41
+ ```
42
+
43
+ ```bash
44
+ npm install @stableops/wallet-sdk
45
+ ```
46
+
47
+ ```bash
48
+ yarn add @stableops/wallet-sdk
49
+ ```
50
+
51
+ ## 快速开始
52
+
53
+ 使用后端返回的订单,并让 SDK 从浏览器里自动选择兼容的钱包 provider:
54
+
55
+ ```ts
56
+ import {
57
+ getInjectedWalletProviders,
58
+ sendOrderWalletPayment,
59
+ } from '@stableops/wallet-sdk'
60
+
61
+ const sent = await sendOrderWalletPayment({
62
+ order,
63
+ providers: getInjectedWalletProviders(),
64
+ })
65
+
66
+ console.log(sent.txHash)
67
+ ```
68
+
69
+ 这是最高层的调用方式。它会从订单候选链列表里选择一条当前浏览器可支付的指令,并通过匹配的钱包发起链上转账。
70
+
71
+ ## 手动选择支付链
72
+
73
+ 如果你希望自己控制用户用哪条链支付,可以先选择指令和 provider,再调用底层发送方法:
74
+
75
+ ```ts
76
+ import {
77
+ getInjectedWalletProviders,
78
+ selectWalletPaymentInstruction,
79
+ sendWalletPayment,
80
+ } from '@stableops/wallet-sdk'
81
+
82
+ const { instruction, provider } = selectWalletPaymentInstruction(
83
+ order.paymentInstructions,
84
+ getInjectedWalletProviders(),
85
+ )
86
+
87
+ const sent = await sendWalletPayment({
88
+ provider,
89
+ amount: order.amount,
90
+ instruction,
91
+ })
92
+
93
+ console.log(sent)
94
+ ```
95
+
96
+ ## 支持的钱包流程
97
+
98
+ 当前支持:
99
+
100
+ - EVM 网络:通过 EIP-1193 钱包,例如 MetaMask 及兼容 provider。
101
+ - TRON:通过 TronLink / TronWeb provider。
102
+ - Solana:通过支持 `signAndSendTransaction` 或 `signTransaction` 的 wallet adapter。
103
+
104
+ 不同链的发送逻辑如下:
105
+
106
+ - EVM:必要时自动切链或加链,然后发送 ERC-20 `transfer`。
107
+ - TRON:构造、签名并广播 TRC-20 `transfer`。
108
+ - Solana:幂等创建 Associated Token Account,并发送 SPL Token `TransferChecked`。
109
+
110
+ ## 支持的链和资产
111
+
112
+ 当前 SDK 支持:
113
+
114
+ - 链:Ethereum、Base、Arbitrum、Polygon、TRON、Solana 以及支持的测试网。
115
+ - 资产:USDC 和 USDT。
116
+
117
+ 最新支持范围和环境配置请参考官方文档:
118
+
119
+ - https://stableops.dev/zh/docs
120
+ - https://stableops.dev/en/docs
121
+
122
+ ## 常见使用方式
123
+
124
+ - 后端使用 `@stableops/api-sdk` 创建 Payment Order。
125
+ - 前端只接收 `amount` 和 `paymentInstructions`。
126
+ - 前端使用浏览器钱包把资金打到订单专属收款地址。
127
+ - StableOps 负责后续链上确认和 Webhook 回调到你的服务端。
128
+
129
+ 完整的端到端流程请参考官方 Quickstart 和 Wallet SDK 文档。
130
+
131
+ ## License
132
+
133
+ 本 SDK 使用 `Apache-2.0` 许可证。详见 [LICENSE](./LICENSE)。
@@ -0,0 +1,131 @@
1
+ import { Transaction, Connection } from '@solana/web3.js';
2
+
3
+ type ChainId = 'ethereum' | 'base' | 'base-sepolia' | 'arbitrum' | 'polygon' | 'tron' | 'solana' | 'ethereum-sepolia' | 'arbitrum-sepolia' | 'polygon-amoy' | 'solana-devnet' | 'tron-nile';
4
+ type Asset = 'USDC' | 'USDT';
5
+ type EvmWalletChainId = Exclude<ChainId, 'tron' | 'solana' | 'tron-nile' | 'solana-devnet'>;
6
+ type Eip1193Provider = {
7
+ request<T = unknown>(args: {
8
+ method: string;
9
+ params?: unknown[] | Record<string, unknown>;
10
+ }): Promise<T>;
11
+ };
12
+ type TronWalletProvider = TronWebLike | {
13
+ tronWeb?: TronWebLike;
14
+ tronLink?: {
15
+ request: <T = unknown>(args: {
16
+ method: string;
17
+ params?: unknown;
18
+ }) => Promise<T>;
19
+ };
20
+ request?<T = unknown>(args: {
21
+ method: string;
22
+ params?: unknown;
23
+ }): Promise<T>;
24
+ };
25
+ type SolanaWalletProvider = {
26
+ publicKey?: SolanaPublicKeyLike | string | null;
27
+ connect?(): Promise<{
28
+ publicKey?: SolanaPublicKeyLike | string | null;
29
+ } | void>;
30
+ signAndSendTransaction?(transaction: Transaction): Promise<string | {
31
+ signature?: string;
32
+ }>;
33
+ signTransaction?(transaction: Transaction): Promise<Transaction>;
34
+ };
35
+ type WalletProvider = Eip1193Provider | TronWalletProvider | SolanaWalletProvider;
36
+ type TronWebLike = {
37
+ defaultAddress?: {
38
+ base58?: string;
39
+ };
40
+ transactionBuilder: {
41
+ triggerSmartContract(contractAddress: string, functionSelector: string, options: Record<string, unknown>, parameters: Array<{
42
+ type: string;
43
+ value: string | bigint;
44
+ }>, issuerAddress?: string): Promise<{
45
+ transaction?: unknown;
46
+ result?: {
47
+ result?: boolean;
48
+ message?: string;
49
+ };
50
+ }>;
51
+ };
52
+ trx: {
53
+ sign(transaction: unknown): Promise<unknown>;
54
+ sendRawTransaction(transaction: unknown): Promise<{
55
+ txid?: string;
56
+ transaction?: {
57
+ txID?: string;
58
+ };
59
+ result?: boolean;
60
+ }>;
61
+ };
62
+ };
63
+ type SolanaPublicKeyLike = {
64
+ toBase58(): string;
65
+ };
66
+ type WalletPaymentInstruction = {
67
+ chain: ChainId;
68
+ asset: Asset;
69
+ address: string;
70
+ };
71
+ type WalletPaymentOrder = {
72
+ amount: string;
73
+ paymentInstructions: WalletPaymentInstruction[];
74
+ };
75
+ type EvmWalletChainConfig = {
76
+ chainId: EvmWalletChainId;
77
+ eip155ChainId: number;
78
+ chainName: string;
79
+ nativeCurrency: {
80
+ name: string;
81
+ symbol: string;
82
+ decimals: number;
83
+ };
84
+ rpcUrls: string[];
85
+ blockExplorerUrls?: string[];
86
+ };
87
+ type SendWalletPaymentInput = {
88
+ provider: WalletProvider;
89
+ instruction: WalletPaymentInstruction | null;
90
+ amount: string;
91
+ fromAddress?: string;
92
+ chainConfigs?: Partial<Record<EvmWalletChainId, EvmWalletChainConfig>>;
93
+ solanaRpcUrl?: string;
94
+ solanaConnection?: Pick<Connection, 'getLatestBlockhash' | 'sendRawTransaction'>;
95
+ };
96
+ type WalletProviderByChain = Partial<Record<ChainId, WalletProvider | undefined>>;
97
+ type SendOrderWalletPaymentInput = Omit<SendWalletPaymentInput, 'provider' | 'instruction' | 'amount'> & {
98
+ order: WalletPaymentOrder;
99
+ providers: WalletProviderByChain;
100
+ preferredChains?: ChainId[];
101
+ };
102
+ type SentWalletPayment = {
103
+ txHash: string;
104
+ chain: ChainId;
105
+ asset: Asset;
106
+ fromAddress: string;
107
+ toAddress: string;
108
+ tokenContract: string;
109
+ amount: string;
110
+ amountUnits: string;
111
+ };
112
+ declare class StableOpsWalletError extends Error {
113
+ readonly code: string;
114
+ readonly details?: unknown | undefined;
115
+ constructor(message: string, code: string, details?: unknown | undefined);
116
+ }
117
+ declare const EvmWalletChainConfigs: Readonly<Record<EvmWalletChainId, EvmWalletChainConfig>>;
118
+ declare function getInjectedEthereumProvider(): Eip1193Provider | undefined;
119
+ declare function getInjectedTronProvider(): TronWalletProvider | undefined;
120
+ declare function getInjectedSolanaProvider(): SolanaWalletProvider | undefined;
121
+ declare function getInjectedWalletProviders(): WalletProviderByChain;
122
+ declare function selectWalletPaymentInstruction(instructions: readonly WalletPaymentInstruction[], providers: WalletProviderByChain, preferredChains?: readonly ChainId[]): {
123
+ instruction: WalletPaymentInstruction;
124
+ provider: WalletProvider;
125
+ };
126
+ declare function sendOrderWalletPayment(input: SendOrderWalletPaymentInput): Promise<SentWalletPayment>;
127
+ declare function sendWalletPayment(input: SendWalletPaymentInput): Promise<SentWalletPayment>;
128
+ declare function encodeErc20Transfer(toAddress: string, amountUnits: bigint): string;
129
+ declare function parseTokenAmount(amount: string, decimals: number): bigint;
130
+
131
+ export { type Asset, type ChainId, type Eip1193Provider, type EvmWalletChainConfig, EvmWalletChainConfigs, type SendOrderWalletPaymentInput, type SendWalletPaymentInput, type SentWalletPayment, type SolanaWalletProvider, StableOpsWalletError, type TronWalletProvider, type WalletPaymentInstruction, type WalletPaymentOrder, type WalletProvider, type WalletProviderByChain, encodeErc20Transfer, getInjectedEthereumProvider, getInjectedSolanaProvider, getInjectedTronProvider, getInjectedWalletProviders, parseTokenAmount, selectWalletPaymentInstruction, sendOrderWalletPayment, sendWalletPayment };