@ordanetwork/sdk 1.0.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 +21 -0
- package/README.md +315 -0
- package/dist/browser/api/OffRampAPI.d.ts +45 -0
- package/dist/browser/api/OffRampAPI.d.ts.map +1 -0
- package/dist/browser/api/OffRampAPI.js +73 -0
- package/dist/browser/api/OffRampAPI.js.map +1 -0
- package/dist/browser/api/OnRampAPI.d.ts +42 -0
- package/dist/browser/api/OnRampAPI.d.ts.map +1 -0
- package/dist/browser/api/OnRampAPI.js +73 -0
- package/dist/browser/api/OnRampAPI.js.map +1 -0
- package/dist/browser/api/QuoteAPI.d.ts +16 -0
- package/dist/browser/api/QuoteAPI.d.ts.map +1 -0
- package/dist/browser/api/QuoteAPI.js +17 -0
- package/dist/browser/api/QuoteAPI.js.map +1 -0
- package/dist/browser/api/RecipientAPI.d.ts +25 -0
- package/dist/browser/api/RecipientAPI.d.ts.map +1 -0
- package/dist/browser/api/RecipientAPI.js +30 -0
- package/dist/browser/api/RecipientAPI.js.map +1 -0
- package/dist/browser/api/TransactionAPI.d.ts +35 -0
- package/dist/browser/api/TransactionAPI.d.ts.map +1 -0
- package/dist/browser/api/TransactionAPI.js +72 -0
- package/dist/browser/api/TransactionAPI.js.map +1 -0
- package/dist/browser/auth/hmac.d.ts +24 -0
- package/dist/browser/auth/hmac.d.ts.map +1 -0
- package/dist/browser/auth/hmac.js +70 -0
- package/dist/browser/auth/hmac.js.map +1 -0
- package/dist/browser/crypto/factory.d.ts +7 -0
- package/dist/browser/crypto/factory.d.ts.map +1 -0
- package/dist/browser/crypto/factory.js +18 -0
- package/dist/browser/crypto/factory.js.map +1 -0
- package/dist/browser/crypto/node-crypto.d.ts +10 -0
- package/dist/browser/crypto/node-crypto.d.ts.map +1 -0
- package/dist/browser/crypto/node-crypto.js +28 -0
- package/dist/browser/crypto/node-crypto.js.map +1 -0
- package/dist/browser/crypto/types.d.ts +13 -0
- package/dist/browser/crypto/types.d.ts.map +1 -0
- package/dist/browser/crypto/types.js +2 -0
- package/dist/browser/crypto/types.js.map +1 -0
- package/dist/browser/crypto/web-crypto.d.ts +8 -0
- package/dist/browser/crypto/web-crypto.d.ts.map +1 -0
- package/dist/browser/crypto/web-crypto.js +17 -0
- package/dist/browser/crypto/web-crypto.js.map +1 -0
- package/dist/browser/errors/index.d.ts +38 -0
- package/dist/browser/errors/index.d.ts.map +1 -0
- package/dist/browser/errors/index.js +72 -0
- package/dist/browser/errors/index.js.map +1 -0
- package/dist/browser/http/client.d.ts +50 -0
- package/dist/browser/http/client.d.ts.map +1 -0
- package/dist/browser/http/client.js +153 -0
- package/dist/browser/http/client.js.map +1 -0
- package/dist/browser/index.d.ts +59 -0
- package/dist/browser/index.d.ts.map +1 -0
- package/dist/browser/index.js +78 -0
- package/dist/browser/index.js.map +1 -0
- package/dist/browser/smart-wallets/LocalSigner.d.ts +19 -0
- package/dist/browser/smart-wallets/LocalSigner.d.ts.map +1 -0
- package/dist/browser/smart-wallets/LocalSigner.js +57 -0
- package/dist/browser/smart-wallets/LocalSigner.js.map +1 -0
- package/dist/browser/smart-wallets/SmartWalletClient.d.ts +19 -0
- package/dist/browser/smart-wallets/SmartWalletClient.d.ts.map +1 -0
- package/dist/browser/smart-wallets/SmartWalletClient.js +180 -0
- package/dist/browser/smart-wallets/SmartWalletClient.js.map +1 -0
- package/dist/browser/smart-wallets/SmartWalletManager.d.ts +17 -0
- package/dist/browser/smart-wallets/SmartWalletManager.d.ts.map +1 -0
- package/dist/browser/smart-wallets/SmartWalletManager.js +59 -0
- package/dist/browser/smart-wallets/SmartWalletManager.js.map +1 -0
- package/dist/browser/smart-wallets/chains.d.ts +11 -0
- package/dist/browser/smart-wallets/chains.d.ts.map +1 -0
- package/dist/browser/smart-wallets/chains.js +30 -0
- package/dist/browser/smart-wallets/chains.js.map +1 -0
- package/dist/browser/smart-wallets/errors.d.ts +23 -0
- package/dist/browser/smart-wallets/errors.d.ts.map +1 -0
- package/dist/browser/smart-wallets/errors.js +44 -0
- package/dist/browser/smart-wallets/errors.js.map +1 -0
- package/dist/browser/smart-wallets/index.d.ts +11 -0
- package/dist/browser/smart-wallets/index.d.ts.map +1 -0
- package/dist/browser/smart-wallets/index.js +13 -0
- package/dist/browser/smart-wallets/index.js.map +1 -0
- package/dist/browser/smart-wallets/types.d.ts +47 -0
- package/dist/browser/smart-wallets/types.d.ts.map +1 -0
- package/dist/browser/smart-wallets/types.js +2 -0
- package/dist/browser/smart-wallets/types.js.map +1 -0
- package/dist/browser/smart-wallets/utils.d.ts +22 -0
- package/dist/browser/smart-wallets/utils.d.ts.map +1 -0
- package/dist/browser/smart-wallets/utils.js +57 -0
- package/dist/browser/smart-wallets/utils.js.map +1 -0
- package/dist/browser/types/index.d.ts +170 -0
- package/dist/browser/types/index.d.ts.map +1 -0
- package/dist/browser/types/index.js +10 -0
- package/dist/browser/types/index.js.map +1 -0
- package/dist/browser/types/offramp.d.ts +55 -0
- package/dist/browser/types/offramp.d.ts.map +1 -0
- package/dist/browser/types/offramp.js +2 -0
- package/dist/browser/types/offramp.js.map +1 -0
- package/dist/browser/types/onramp.d.ts +54 -0
- package/dist/browser/types/onramp.d.ts.map +1 -0
- package/dist/browser/types/onramp.js +2 -0
- package/dist/browser/types/onramp.js.map +1 -0
- package/dist/cjs/api/OffRampAPI.d.ts +45 -0
- package/dist/cjs/api/OffRampAPI.d.ts.map +1 -0
- package/dist/cjs/api/OffRampAPI.js +77 -0
- package/dist/cjs/api/OffRampAPI.js.map +1 -0
- package/dist/cjs/api/OnRampAPI.d.ts +42 -0
- package/dist/cjs/api/OnRampAPI.d.ts.map +1 -0
- package/dist/cjs/api/OnRampAPI.js +77 -0
- package/dist/cjs/api/OnRampAPI.js.map +1 -0
- package/dist/cjs/api/QuoteAPI.d.ts +16 -0
- package/dist/cjs/api/QuoteAPI.d.ts.map +1 -0
- package/dist/cjs/api/QuoteAPI.js +21 -0
- package/dist/cjs/api/QuoteAPI.js.map +1 -0
- package/dist/cjs/api/RecipientAPI.d.ts +25 -0
- package/dist/cjs/api/RecipientAPI.d.ts.map +1 -0
- package/dist/cjs/api/RecipientAPI.js +34 -0
- package/dist/cjs/api/RecipientAPI.js.map +1 -0
- package/dist/cjs/api/TransactionAPI.d.ts +35 -0
- package/dist/cjs/api/TransactionAPI.d.ts.map +1 -0
- package/dist/cjs/api/TransactionAPI.js +76 -0
- package/dist/cjs/api/TransactionAPI.js.map +1 -0
- package/dist/cjs/auth/hmac.d.ts +24 -0
- package/dist/cjs/auth/hmac.d.ts.map +1 -0
- package/dist/cjs/auth/hmac.js +74 -0
- package/dist/cjs/auth/hmac.js.map +1 -0
- package/dist/cjs/crypto/factory.d.ts +7 -0
- package/dist/cjs/crypto/factory.d.ts.map +1 -0
- package/dist/cjs/crypto/factory.js +21 -0
- package/dist/cjs/crypto/factory.js.map +1 -0
- package/dist/cjs/crypto/node-crypto.d.ts +10 -0
- package/dist/cjs/crypto/node-crypto.d.ts.map +1 -0
- package/dist/cjs/crypto/node-crypto.js +65 -0
- package/dist/cjs/crypto/node-crypto.js.map +1 -0
- package/dist/cjs/crypto/types.d.ts +13 -0
- package/dist/cjs/crypto/types.d.ts.map +1 -0
- package/dist/cjs/crypto/types.js +3 -0
- package/dist/cjs/crypto/types.js.map +1 -0
- package/dist/cjs/crypto/web-crypto.d.ts +8 -0
- package/dist/cjs/crypto/web-crypto.d.ts.map +1 -0
- package/dist/cjs/crypto/web-crypto.js +21 -0
- package/dist/cjs/crypto/web-crypto.js.map +1 -0
- package/dist/cjs/errors/index.d.ts +38 -0
- package/dist/cjs/errors/index.d.ts.map +1 -0
- package/dist/cjs/errors/index.js +85 -0
- package/dist/cjs/errors/index.js.map +1 -0
- package/dist/cjs/http/client.d.ts +50 -0
- package/dist/cjs/http/client.d.ts.map +1 -0
- package/dist/cjs/http/client.js +157 -0
- package/dist/cjs/http/client.js.map +1 -0
- package/dist/cjs/index.d.ts +59 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +112 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/smart-wallets/LocalSigner.d.ts +19 -0
- package/dist/cjs/smart-wallets/LocalSigner.d.ts.map +1 -0
- package/dist/cjs/smart-wallets/LocalSigner.js +61 -0
- package/dist/cjs/smart-wallets/LocalSigner.js.map +1 -0
- package/dist/cjs/smart-wallets/SmartWalletClient.d.ts +19 -0
- package/dist/cjs/smart-wallets/SmartWalletClient.d.ts.map +1 -0
- package/dist/cjs/smart-wallets/SmartWalletClient.js +184 -0
- package/dist/cjs/smart-wallets/SmartWalletClient.js.map +1 -0
- package/dist/cjs/smart-wallets/SmartWalletManager.d.ts +17 -0
- package/dist/cjs/smart-wallets/SmartWalletManager.d.ts.map +1 -0
- package/dist/cjs/smart-wallets/SmartWalletManager.js +63 -0
- package/dist/cjs/smart-wallets/SmartWalletManager.js.map +1 -0
- package/dist/cjs/smart-wallets/chains.d.ts +11 -0
- package/dist/cjs/smart-wallets/chains.d.ts.map +1 -0
- package/dist/cjs/smart-wallets/chains.js +36 -0
- package/dist/cjs/smart-wallets/chains.js.map +1 -0
- package/dist/cjs/smart-wallets/errors.d.ts +23 -0
- package/dist/cjs/smart-wallets/errors.d.ts.map +1 -0
- package/dist/cjs/smart-wallets/errors.js +54 -0
- package/dist/cjs/smart-wallets/errors.js.map +1 -0
- package/dist/cjs/smart-wallets/index.d.ts +11 -0
- package/dist/cjs/smart-wallets/index.d.ts.map +1 -0
- package/dist/cjs/smart-wallets/index.js +36 -0
- package/dist/cjs/smart-wallets/index.js.map +1 -0
- package/dist/cjs/smart-wallets/types.d.ts +47 -0
- package/dist/cjs/smart-wallets/types.d.ts.map +1 -0
- package/dist/cjs/smart-wallets/types.js +3 -0
- package/dist/cjs/smart-wallets/types.js.map +1 -0
- package/dist/cjs/smart-wallets/utils.d.ts +22 -0
- package/dist/cjs/smart-wallets/utils.d.ts.map +1 -0
- package/dist/cjs/smart-wallets/utils.js +64 -0
- package/dist/cjs/smart-wallets/utils.js.map +1 -0
- package/dist/cjs/types/index.d.ts +170 -0
- package/dist/cjs/types/index.d.ts.map +1 -0
- package/dist/cjs/types/index.js +13 -0
- package/dist/cjs/types/index.js.map +1 -0
- package/dist/cjs/types/offramp.d.ts +55 -0
- package/dist/cjs/types/offramp.d.ts.map +1 -0
- package/dist/cjs/types/offramp.js +3 -0
- package/dist/cjs/types/offramp.js.map +1 -0
- package/dist/cjs/types/onramp.d.ts +54 -0
- package/dist/cjs/types/onramp.d.ts.map +1 -0
- package/dist/cjs/types/onramp.js +3 -0
- package/dist/cjs/types/onramp.js.map +1 -0
- package/dist/esm/api/OffRampAPI.d.ts +45 -0
- package/dist/esm/api/OffRampAPI.d.ts.map +1 -0
- package/dist/esm/api/OffRampAPI.js +73 -0
- package/dist/esm/api/OffRampAPI.js.map +1 -0
- package/dist/esm/api/OnRampAPI.d.ts +42 -0
- package/dist/esm/api/OnRampAPI.d.ts.map +1 -0
- package/dist/esm/api/OnRampAPI.js +73 -0
- package/dist/esm/api/OnRampAPI.js.map +1 -0
- package/dist/esm/api/QuoteAPI.d.ts +16 -0
- package/dist/esm/api/QuoteAPI.d.ts.map +1 -0
- package/dist/esm/api/QuoteAPI.js +17 -0
- package/dist/esm/api/QuoteAPI.js.map +1 -0
- package/dist/esm/api/RecipientAPI.d.ts +25 -0
- package/dist/esm/api/RecipientAPI.d.ts.map +1 -0
- package/dist/esm/api/RecipientAPI.js +30 -0
- package/dist/esm/api/RecipientAPI.js.map +1 -0
- package/dist/esm/api/TransactionAPI.d.ts +35 -0
- package/dist/esm/api/TransactionAPI.d.ts.map +1 -0
- package/dist/esm/api/TransactionAPI.js +72 -0
- package/dist/esm/api/TransactionAPI.js.map +1 -0
- package/dist/esm/auth/hmac.d.ts +24 -0
- package/dist/esm/auth/hmac.d.ts.map +1 -0
- package/dist/esm/auth/hmac.js +70 -0
- package/dist/esm/auth/hmac.js.map +1 -0
- package/dist/esm/crypto/factory.d.ts +7 -0
- package/dist/esm/crypto/factory.d.ts.map +1 -0
- package/dist/esm/crypto/factory.js +18 -0
- package/dist/esm/crypto/factory.js.map +1 -0
- package/dist/esm/crypto/node-crypto.d.ts +10 -0
- package/dist/esm/crypto/node-crypto.d.ts.map +1 -0
- package/dist/esm/crypto/node-crypto.js +28 -0
- package/dist/esm/crypto/node-crypto.js.map +1 -0
- package/dist/esm/crypto/types.d.ts +13 -0
- package/dist/esm/crypto/types.d.ts.map +1 -0
- package/dist/esm/crypto/types.js +2 -0
- package/dist/esm/crypto/types.js.map +1 -0
- package/dist/esm/crypto/web-crypto.d.ts +8 -0
- package/dist/esm/crypto/web-crypto.d.ts.map +1 -0
- package/dist/esm/crypto/web-crypto.js +17 -0
- package/dist/esm/crypto/web-crypto.js.map +1 -0
- package/dist/esm/errors/index.d.ts +38 -0
- package/dist/esm/errors/index.d.ts.map +1 -0
- package/dist/esm/errors/index.js +72 -0
- package/dist/esm/errors/index.js.map +1 -0
- package/dist/esm/http/client.d.ts +50 -0
- package/dist/esm/http/client.d.ts.map +1 -0
- package/dist/esm/http/client.js +153 -0
- package/dist/esm/http/client.js.map +1 -0
- package/dist/esm/index.d.ts +59 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +78 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/package.json +1 -0
- package/dist/esm/smart-wallets/LocalSigner.d.ts +19 -0
- package/dist/esm/smart-wallets/LocalSigner.d.ts.map +1 -0
- package/dist/esm/smart-wallets/LocalSigner.js +57 -0
- package/dist/esm/smart-wallets/LocalSigner.js.map +1 -0
- package/dist/esm/smart-wallets/SmartWalletClient.d.ts +19 -0
- package/dist/esm/smart-wallets/SmartWalletClient.d.ts.map +1 -0
- package/dist/esm/smart-wallets/SmartWalletClient.js +180 -0
- package/dist/esm/smart-wallets/SmartWalletClient.js.map +1 -0
- package/dist/esm/smart-wallets/SmartWalletManager.d.ts +17 -0
- package/dist/esm/smart-wallets/SmartWalletManager.d.ts.map +1 -0
- package/dist/esm/smart-wallets/SmartWalletManager.js +59 -0
- package/dist/esm/smart-wallets/SmartWalletManager.js.map +1 -0
- package/dist/esm/smart-wallets/chains.d.ts +11 -0
- package/dist/esm/smart-wallets/chains.d.ts.map +1 -0
- package/dist/esm/smart-wallets/chains.js +30 -0
- package/dist/esm/smart-wallets/chains.js.map +1 -0
- package/dist/esm/smart-wallets/errors.d.ts +23 -0
- package/dist/esm/smart-wallets/errors.d.ts.map +1 -0
- package/dist/esm/smart-wallets/errors.js +44 -0
- package/dist/esm/smart-wallets/errors.js.map +1 -0
- package/dist/esm/smart-wallets/index.d.ts +11 -0
- package/dist/esm/smart-wallets/index.d.ts.map +1 -0
- package/dist/esm/smart-wallets/index.js +13 -0
- package/dist/esm/smart-wallets/index.js.map +1 -0
- package/dist/esm/smart-wallets/types.d.ts +47 -0
- package/dist/esm/smart-wallets/types.d.ts.map +1 -0
- package/dist/esm/smart-wallets/types.js +2 -0
- package/dist/esm/smart-wallets/types.js.map +1 -0
- package/dist/esm/smart-wallets/utils.d.ts +22 -0
- package/dist/esm/smart-wallets/utils.d.ts.map +1 -0
- package/dist/esm/smart-wallets/utils.js +57 -0
- package/dist/esm/smart-wallets/utils.js.map +1 -0
- package/dist/esm/types/index.d.ts +170 -0
- package/dist/esm/types/index.d.ts.map +1 -0
- package/dist/esm/types/index.js +10 -0
- package/dist/esm/types/index.js.map +1 -0
- package/dist/esm/types/offramp.d.ts +55 -0
- package/dist/esm/types/offramp.d.ts.map +1 -0
- package/dist/esm/types/offramp.js +2 -0
- package/dist/esm/types/offramp.js.map +1 -0
- package/dist/esm/types/onramp.d.ts +54 -0
- package/dist/esm/types/onramp.d.ts.map +1 -0
- package/dist/esm/types/onramp.js +2 -0
- package/dist/esm/types/onramp.js.map +1 -0
- package/dist/types/api/OffRampAPI.d.ts +45 -0
- package/dist/types/api/OffRampAPI.d.ts.map +1 -0
- package/dist/types/api/OnRampAPI.d.ts +42 -0
- package/dist/types/api/OnRampAPI.d.ts.map +1 -0
- package/dist/types/api/QuoteAPI.d.ts +16 -0
- package/dist/types/api/QuoteAPI.d.ts.map +1 -0
- package/dist/types/api/RecipientAPI.d.ts +25 -0
- package/dist/types/api/RecipientAPI.d.ts.map +1 -0
- package/dist/types/api/TransactionAPI.d.ts +35 -0
- package/dist/types/api/TransactionAPI.d.ts.map +1 -0
- package/dist/types/auth/hmac.d.ts +24 -0
- package/dist/types/auth/hmac.d.ts.map +1 -0
- package/dist/types/crypto/factory.d.ts +7 -0
- package/dist/types/crypto/factory.d.ts.map +1 -0
- package/dist/types/crypto/node-crypto.d.ts +10 -0
- package/dist/types/crypto/node-crypto.d.ts.map +1 -0
- package/dist/types/crypto/types.d.ts +13 -0
- package/dist/types/crypto/types.d.ts.map +1 -0
- package/dist/types/crypto/web-crypto.d.ts +8 -0
- package/dist/types/crypto/web-crypto.d.ts.map +1 -0
- package/dist/types/errors/index.d.ts +38 -0
- package/dist/types/errors/index.d.ts.map +1 -0
- package/dist/types/http/client.d.ts +50 -0
- package/dist/types/http/client.d.ts.map +1 -0
- package/dist/types/index.d.ts +59 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/smart-wallets/LocalSigner.d.ts +19 -0
- package/dist/types/smart-wallets/LocalSigner.d.ts.map +1 -0
- package/dist/types/smart-wallets/SmartWalletClient.d.ts +19 -0
- package/dist/types/smart-wallets/SmartWalletClient.d.ts.map +1 -0
- package/dist/types/smart-wallets/SmartWalletManager.d.ts +17 -0
- package/dist/types/smart-wallets/SmartWalletManager.d.ts.map +1 -0
- package/dist/types/smart-wallets/chains.d.ts +11 -0
- package/dist/types/smart-wallets/chains.d.ts.map +1 -0
- package/dist/types/smart-wallets/errors.d.ts +23 -0
- package/dist/types/smart-wallets/errors.d.ts.map +1 -0
- package/dist/types/smart-wallets/index.d.ts +11 -0
- package/dist/types/smart-wallets/index.d.ts.map +1 -0
- package/dist/types/smart-wallets/types.d.ts +47 -0
- package/dist/types/smart-wallets/types.d.ts.map +1 -0
- package/dist/types/smart-wallets/utils.d.ts +22 -0
- package/dist/types/smart-wallets/utils.d.ts.map +1 -0
- package/dist/types/types/index.d.ts +170 -0
- package/dist/types/types/index.d.ts.map +1 -0
- package/dist/types/types/offramp.d.ts +55 -0
- package/dist/types/types/offramp.d.ts.map +1 -0
- package/dist/types/types/onramp.d.ts +54 -0
- package/dist/types/types/onramp.d.ts.map +1 -0
- package/package.json +99 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 orda
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
# orda TypeScript SDK
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@ordanetwork/sdk)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
[](https://nodejs.org)
|
|
6
|
+
|
|
7
|
+
Universal TypeScript SDK for cross-chain cryptocurrency payments with smart wallet support. Works seamlessly in both Node.js (18+) and browser environments.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @ordanetwork/sdk
|
|
13
|
+
# or
|
|
14
|
+
yarn add @ordaordanetwork/sdk
|
|
15
|
+
# or
|
|
16
|
+
pnpm add @ordaordanetwork/sdk
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Requirements
|
|
20
|
+
|
|
21
|
+
- **Node.js**: Version 18.0.0 or higher (for native fetch API support)
|
|
22
|
+
- **TypeScript**: Version 5.0.0 or higher (if using TypeScript)
|
|
23
|
+
- **viem**: Required peer dependency for blockchain interactions
|
|
24
|
+
|
|
25
|
+
## Features
|
|
26
|
+
|
|
27
|
+
- 🌐 **Universal Compatibility**: Works in both browser and Node.js environments
|
|
28
|
+
- 🔐 **HMAC Authentication**: Secure API authentication with Web Crypto API
|
|
29
|
+
- 🚀 **Zero Dependencies**: Pure TypeScript implementation, no runtime dependencies
|
|
30
|
+
- 📦 **Tree-shakeable**: Optimized for minimal bundle size
|
|
31
|
+
- 🔄 **Async/Await**: Modern promise-based API
|
|
32
|
+
- 💱 **Multi-chain Support**: Cross-chain transfers, off-ramp, and on-ramp operations
|
|
33
|
+
- 🔑 **Smart Wallets**: Integrated Alchemy Account Kit support for UserOperations
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
## Quick Start
|
|
37
|
+
|
|
38
|
+
```typescript
|
|
39
|
+
import { OrdaSDK } from '@ordanetwork/sdk';
|
|
40
|
+
|
|
41
|
+
const orda = new OrdaSDK({
|
|
42
|
+
clientId: 'your-client-id',
|
|
43
|
+
clientSecret: 'your-client-secret'
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
// Create a recipient
|
|
47
|
+
const recipient = await orda.recipients.create({
|
|
48
|
+
name: 'Test Recipient',
|
|
49
|
+
cryptoSettlementDetails: {
|
|
50
|
+
toChain: '8453'
|
|
51
|
+
toToken: '0x4200000000000000000000000000000000000006'
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
// Request a quote
|
|
56
|
+
const quote = await orda.quote.request({
|
|
57
|
+
fromChain: '1', // Ethereum
|
|
58
|
+
fromToken: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
|
|
59
|
+
fromAddress: '0xYourAddress',
|
|
60
|
+
intent: {
|
|
61
|
+
method: 'usd',
|
|
62
|
+
value: '100'
|
|
63
|
+
},
|
|
64
|
+
recipientId: recipient.recipientId
|
|
65
|
+
});
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Module Formats
|
|
69
|
+
|
|
70
|
+
The SDK supports multiple module formats for maximum compatibility:
|
|
71
|
+
|
|
72
|
+
### CommonJS (Node.js)
|
|
73
|
+
```javascript
|
|
74
|
+
const { OrdaSDK } = require('@ordanetwork/sdk');
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### ES Modules (Modern JavaScript)
|
|
78
|
+
```javascript
|
|
79
|
+
import { OrdaSDK } from '@ordanetwork/sdk';
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Browser (via CDN)
|
|
83
|
+
```html
|
|
84
|
+
<script src="https://unpkg.com/@ordanetwork/sdk/dist/browser/index.js"></script>
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Browser Security
|
|
88
|
+
|
|
89
|
+
⚠️ **CRITICAL SECURITY WARNING** ⚠️
|
|
90
|
+
|
|
91
|
+
**Never expose your API credentials in browser code!** Your `clientId` and `clientSecret` will be visible to anyone who inspects the browser's JavaScript.
|
|
92
|
+
|
|
93
|
+
### ❌ Insecure (DO NOT DO THIS)
|
|
94
|
+
```javascript
|
|
95
|
+
// This exposes your credentials to everyone!
|
|
96
|
+
const orda = new OrdaSDK({
|
|
97
|
+
clientId: 'your-client-id', // VISIBLE IN BROWSER!
|
|
98
|
+
clientSecret: 'your-client-secret' // VISIBLE IN BROWSER!
|
|
99
|
+
});
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### ✅ Secure (Recommended Approach)
|
|
103
|
+
|
|
104
|
+
Implement a backend proxy that handles API authentication:
|
|
105
|
+
|
|
106
|
+
**Backend (Node.js Express example):**
|
|
107
|
+
```javascript
|
|
108
|
+
// server.js - Keep credentials secure on the server
|
|
109
|
+
const express = require('express');
|
|
110
|
+
const { OrdaSDK } = require('@ordanetwork/sdk');
|
|
111
|
+
|
|
112
|
+
const app = express();
|
|
113
|
+
const orda = new OrdaSDK({
|
|
114
|
+
clientId: process.env.ORDA_CLIENT_ID,
|
|
115
|
+
clientSecret: process.env.ORDA_CLIENT_SECRET
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
app.post('/api/orda/quote', async (req, res) => {
|
|
119
|
+
try {
|
|
120
|
+
// Authenticate the user first!
|
|
121
|
+
const userId = authenticateUser(req);
|
|
122
|
+
|
|
123
|
+
// Then proxy the request to orda
|
|
124
|
+
const quote = await orda.quote.request(req.body);
|
|
125
|
+
res.json(quote);
|
|
126
|
+
} catch (error) {
|
|
127
|
+
res.status(500).json({ error: error.message });
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
**Frontend (Browser):**
|
|
133
|
+
```javascript
|
|
134
|
+
// Safe - credentials stay on your server
|
|
135
|
+
const response = await fetch('/api/orda/quote', {
|
|
136
|
+
method: 'POST',
|
|
137
|
+
headers: {
|
|
138
|
+
'Authorization': `Bearer ${userToken}`,
|
|
139
|
+
'Content-Type': 'application/json'
|
|
140
|
+
},
|
|
141
|
+
body: JSON.stringify(quoteRequest)
|
|
142
|
+
});
|
|
143
|
+
const quote = await response.json();
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## API Documentation
|
|
147
|
+
|
|
148
|
+
### Initialize SDK
|
|
149
|
+
|
|
150
|
+
```typescript
|
|
151
|
+
const orda = new OrdaSDK({
|
|
152
|
+
clientId: 'your-client-id',
|
|
153
|
+
clientSecret: 'your-client-secret',
|
|
154
|
+
debug: true
|
|
155
|
+
});
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### Recipients API
|
|
159
|
+
|
|
160
|
+
```typescript
|
|
161
|
+
// Create recipient
|
|
162
|
+
await orda.recipients.create({
|
|
163
|
+
name: string,
|
|
164
|
+
cryptoSettlementDetails?: CryptoSettlementDetails,
|
|
165
|
+
fiatSettlementDetails?: FiatSettlementDetails,
|
|
166
|
+
kycInformation?: KYCInformation
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
// Update recipient
|
|
170
|
+
await orda.recipients.updateSettlement({
|
|
171
|
+
recipientId: string,
|
|
172
|
+
cryptoSettlementDetails?: CryptoSettlementDetails,
|
|
173
|
+
fiatSettlementDetails?: FiatSettlementDetails,
|
|
174
|
+
kycInformation?: KYCInformation
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
// Deactivate recipient
|
|
178
|
+
await orda.recipients.deactivate({
|
|
179
|
+
recipientId: string
|
|
180
|
+
});
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### Quote API
|
|
184
|
+
|
|
185
|
+
```typescript
|
|
186
|
+
// Request quote
|
|
187
|
+
await orda.quote.request({
|
|
188
|
+
fromChain: string,
|
|
189
|
+
fromToken: string,
|
|
190
|
+
fromAddress: string,
|
|
191
|
+
intent: {
|
|
192
|
+
method: 'usd' | 'fromAmount' | 'toAmount',
|
|
193
|
+
value: string
|
|
194
|
+
},
|
|
195
|
+
recipientId?: string,
|
|
196
|
+
timeout?: number
|
|
197
|
+
});
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### Transaction API
|
|
201
|
+
|
|
202
|
+
```typescript
|
|
203
|
+
// Get transaction status
|
|
204
|
+
await orda.transactions.getStatus({
|
|
205
|
+
transactionId?: string,
|
|
206
|
+
sourceHash?: string,
|
|
207
|
+
destinationHash?: string
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
// Get successful transactions
|
|
211
|
+
await orda.transactions.getSuccessfulTransactions();
|
|
212
|
+
|
|
213
|
+
// Wait for transaction completion with polling
|
|
214
|
+
await orda.transactions.waitForCompletion(transactionId, {
|
|
215
|
+
intervalMs: 5000,
|
|
216
|
+
timeoutMs: 600000,
|
|
217
|
+
onStatusUpdate: (status) => console.log(status)
|
|
218
|
+
});
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
### Off-Ramp API (Crypto to Fiat)
|
|
222
|
+
|
|
223
|
+
```typescript
|
|
224
|
+
// Request off-ramp quote
|
|
225
|
+
await orda.offRamp.requestQuote({
|
|
226
|
+
fromChain: string,
|
|
227
|
+
fromToken: string,
|
|
228
|
+
fromAddress: string,
|
|
229
|
+
intent: Intent,
|
|
230
|
+
recipientId?: string,
|
|
231
|
+
kycInformation?: KYCInformation,
|
|
232
|
+
fiatSettlementDetails?: FiatSettlementDetails
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
// Get off-ramp status
|
|
236
|
+
await orda.offRamp.getStatus(transactionId);
|
|
237
|
+
|
|
238
|
+
// Wait for completion
|
|
239
|
+
await orda.offRamp.waitForCompletion(transactionId, options);
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### On-Ramp API (Fiat to Crypto)
|
|
243
|
+
|
|
244
|
+
```typescript
|
|
245
|
+
// Request on-ramp quote
|
|
246
|
+
await orda.onRamp.requestQuote({
|
|
247
|
+
fromCurrency: string,
|
|
248
|
+
intent: Intent,
|
|
249
|
+
recipientId: string
|
|
250
|
+
});
|
|
251
|
+
|
|
252
|
+
// Get on-ramp status
|
|
253
|
+
await orda.onRamp.getStatus(transactionId);
|
|
254
|
+
|
|
255
|
+
// Wait for completion
|
|
256
|
+
await orda.onRamp.waitForCompletion(transactionId, options);
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
#
|
|
260
|
+
|
|
261
|
+
## Browser Usage
|
|
262
|
+
|
|
263
|
+
```html
|
|
264
|
+
<script src="https://unpkg.com/@ordanetwork/sdk/dist/browser/index.js"></script>
|
|
265
|
+
<script>
|
|
266
|
+
const orda = new OrdaSDK.OrdaSDK({
|
|
267
|
+
clientId: 'your-client-id',
|
|
268
|
+
clientSecret: 'your-client-secret'
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
// Use the SDK
|
|
272
|
+
orda.recipients.create({...}).then(console.log);
|
|
273
|
+
</script>
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
## Security Considerations
|
|
277
|
+
|
|
278
|
+
⚠️ **Important**: Never expose your API credentials in client-side code for production applications. Use a backend proxy to keep your credentials secure.
|
|
279
|
+
|
|
280
|
+
### Recommended Architecture
|
|
281
|
+
|
|
282
|
+
```
|
|
283
|
+
Browser → Your Backend Proxy → orda API
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
## TypeScript Support
|
|
287
|
+
|
|
288
|
+
The SDK is written in TypeScript and provides full type definitions out of the box.
|
|
289
|
+
|
|
290
|
+
```typescript
|
|
291
|
+
import {
|
|
292
|
+
OrdaSDK,
|
|
293
|
+
QuoteRequestParams,
|
|
294
|
+
TransactionStatus,
|
|
295
|
+
OrdaError
|
|
296
|
+
} from '@ordanetwork/sdk';
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
## Error Handling
|
|
300
|
+
|
|
301
|
+
```typescript
|
|
302
|
+
try {
|
|
303
|
+
const quote = await orda.quote.request({...});
|
|
304
|
+
} catch (error) {
|
|
305
|
+
if (error instanceof OrdaError) {
|
|
306
|
+
console.error('Status Code:', error.statusCode);
|
|
307
|
+
console.error('Error Code:', error.code);
|
|
308
|
+
console.error('Details:', error.details);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
## License
|
|
314
|
+
|
|
315
|
+
MIT
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { UniversalHttpClient } from '../http/client';
|
|
2
|
+
import { OffRampQuoteParams, OffRampQuoteResponse, OffRampStatusResponse, OffRampStatusType } from '../types/offramp';
|
|
3
|
+
/**
|
|
4
|
+
* Polling options for off-ramp operations
|
|
5
|
+
*/
|
|
6
|
+
export interface OffRampPollingOptions {
|
|
7
|
+
intervalMs?: number;
|
|
8
|
+
timeoutMs?: number;
|
|
9
|
+
onStatusUpdate?: (status: OffRampStatusType) => void;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* API wrapper for off-ramp (crypto to fiat) operations
|
|
13
|
+
*/
|
|
14
|
+
export declare class OffRampAPI {
|
|
15
|
+
private httpClient;
|
|
16
|
+
constructor(httpClient: UniversalHttpClient);
|
|
17
|
+
/**
|
|
18
|
+
* Requests a quote for off-ramping crypto to fiat
|
|
19
|
+
* @param params Off-ramp quote parameters
|
|
20
|
+
* @returns Off-ramp quote response
|
|
21
|
+
*/
|
|
22
|
+
requestQuote(params: OffRampQuoteParams): Promise<OffRampQuoteResponse>;
|
|
23
|
+
/**
|
|
24
|
+
* Gets the status of an off-ramp transaction
|
|
25
|
+
* @param transactionId The transaction ID
|
|
26
|
+
* @returns Off-ramp transaction status
|
|
27
|
+
*/
|
|
28
|
+
getStatus(transactionId: string): Promise<OffRampStatusResponse>;
|
|
29
|
+
/**
|
|
30
|
+
* Waits for off-ramp completion using polling
|
|
31
|
+
* @param transactionId The transaction ID to monitor
|
|
32
|
+
* @param options Polling configuration
|
|
33
|
+
* @returns Final off-ramp status
|
|
34
|
+
*/
|
|
35
|
+
waitForCompletion(transactionId: string, options?: OffRampPollingOptions): Promise<OffRampStatusResponse>;
|
|
36
|
+
/**
|
|
37
|
+
* Checks if a status is terminal
|
|
38
|
+
*/
|
|
39
|
+
private isTerminalStatus;
|
|
40
|
+
/**
|
|
41
|
+
* Helper to sleep for a given duration
|
|
42
|
+
*/
|
|
43
|
+
private sleep;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=OffRampAPI.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OffRampAPI.d.ts","sourceRoot":"","sources":["../../../src/api/OffRampAPI.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACrB,iBAAiB,EAClB,MAAM,kBAAkB,CAAC;AAE1B;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,iBAAiB,KAAK,IAAI,CAAC;CACtD;AAED;;GAEG;AACH,qBAAa,UAAU;IACT,OAAO,CAAC,UAAU;gBAAV,UAAU,EAAE,mBAAmB;IAEnD;;;;OAIG;IACG,YAAY,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAI7E;;;;OAIG;IACG,SAAS,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAItE;;;;;OAKG;IACG,iBAAiB,CACrB,aAAa,EAAE,MAAM,EACrB,OAAO,CAAC,EAAE,qBAAqB,GAC9B,OAAO,CAAC,qBAAqB,CAAC;IAqCjC;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAIxB;;OAEG;IACH,OAAO,CAAC,KAAK;CAGd"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API wrapper for off-ramp (crypto to fiat) operations
|
|
3
|
+
*/
|
|
4
|
+
export class OffRampAPI {
|
|
5
|
+
constructor(httpClient) {
|
|
6
|
+
this.httpClient = httpClient;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Requests a quote for off-ramping crypto to fiat
|
|
10
|
+
* @param params Off-ramp quote parameters
|
|
11
|
+
* @returns Off-ramp quote response
|
|
12
|
+
*/
|
|
13
|
+
async requestQuote(params) {
|
|
14
|
+
return this.httpClient.post('/offramp/quote', params);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Gets the status of an off-ramp transaction
|
|
18
|
+
* @param transactionId The transaction ID
|
|
19
|
+
* @returns Off-ramp transaction status
|
|
20
|
+
*/
|
|
21
|
+
async getStatus(transactionId) {
|
|
22
|
+
return this.httpClient.get('/offramp/status', { transactionId });
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Waits for off-ramp completion using polling
|
|
26
|
+
* @param transactionId The transaction ID to monitor
|
|
27
|
+
* @param options Polling configuration
|
|
28
|
+
* @returns Final off-ramp status
|
|
29
|
+
*/
|
|
30
|
+
async waitForCompletion(transactionId, options) {
|
|
31
|
+
const intervalMs = options?.intervalMs || 10000; // 10 seconds
|
|
32
|
+
const timeoutMs = options?.timeoutMs || 1800000; // 30 minutes default
|
|
33
|
+
const startTime = Date.now();
|
|
34
|
+
let lastStatus = null;
|
|
35
|
+
while (true) {
|
|
36
|
+
if (Date.now() - startTime > timeoutMs) {
|
|
37
|
+
throw new Error(`Off-ramp polling timeout after ${timeoutMs}ms. Last status: ${lastStatus}`);
|
|
38
|
+
}
|
|
39
|
+
try {
|
|
40
|
+
const response = await this.getStatus(transactionId);
|
|
41
|
+
const currentStatus = response.status;
|
|
42
|
+
if (currentStatus !== lastStatus && options?.onStatusUpdate) {
|
|
43
|
+
options.onStatusUpdate(currentStatus);
|
|
44
|
+
}
|
|
45
|
+
lastStatus = currentStatus;
|
|
46
|
+
if (this.isTerminalStatus(currentStatus)) {
|
|
47
|
+
return response;
|
|
48
|
+
}
|
|
49
|
+
await this.sleep(intervalMs); // wait before next poll
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
if (error instanceof Error && error.message.includes('network')) {
|
|
53
|
+
await this.sleep(intervalMs);
|
|
54
|
+
continue; // continue polling on error
|
|
55
|
+
}
|
|
56
|
+
throw error;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Checks if a status is terminal
|
|
62
|
+
*/
|
|
63
|
+
isTerminalStatus(status) {
|
|
64
|
+
return ['Completed', 'Failed', 'Refunded'].includes(status);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Helper to sleep for a given duration
|
|
68
|
+
*/
|
|
69
|
+
sleep(ms) {
|
|
70
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=OffRampAPI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OffRampAPI.js","sourceRoot":"","sources":["../../../src/api/OffRampAPI.ts"],"names":[],"mappings":"AAiBA;;GAEG;AACH,MAAM,OAAO,UAAU;IACrB,YAAoB,UAA+B;QAA/B,eAAU,GAAV,UAAU,CAAqB;IAAG,CAAC;IAEvD;;;;OAIG;IACH,KAAK,CAAC,YAAY,CAAC,MAA0B;QAC3C,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAuB,gBAAgB,EAAE,MAAM,CAAC,CAAC;IAC9E,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,SAAS,CAAC,aAAqB;QACnC,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAwB,iBAAiB,EAAE,EAAE,aAAa,EAAE,CAAC,CAAC;IAC1F,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,iBAAiB,CACrB,aAAqB,EACrB,OAA+B;QAE/B,MAAM,UAAU,GAAG,OAAO,EAAE,UAAU,IAAI,KAAK,CAAC,CAAC,aAAa;QAC9D,MAAM,SAAS,GAAG,OAAO,EAAE,SAAS,IAAI,OAAO,CAAC,CAAC,qBAAqB;QACtE,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAC7B,IAAI,UAAU,GAA6B,IAAI,CAAC;QAEhD,OAAO,IAAI,EAAE,CAAC;YACZ,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,GAAG,SAAS,EAAE,CAAC;gBACvC,MAAM,IAAI,KAAK,CACb,kCAAkC,SAAS,oBAAoB,UAAU,EAAE,CAC5E,CAAC;YACJ,CAAC;YAED,IAAI,CAAC;gBACH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;gBACrD,MAAM,aAAa,GAAG,QAAQ,CAAC,MAAM,CAAC;gBAEtC,IAAI,aAAa,KAAK,UAAU,IAAI,OAAO,EAAE,cAAc,EAAE,CAAC;oBAC5D,OAAO,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC;gBACxC,CAAC;gBACD,UAAU,GAAG,aAAa,CAAC;gBAE3B,IAAI,IAAI,CAAC,gBAAgB,CAAC,aAAa,CAAC,EAAE,CAAC;oBACzC,OAAO,QAAQ,CAAC;gBAClB,CAAC;gBAED,MAAM,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,wBAAwB;YACxD,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,IAAI,KAAK,YAAY,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;oBAChE,MAAM,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;oBAC7B,SAAS,CAAC,4BAA4B;gBACxC,CAAC;gBACD,MAAM,KAAK,CAAC;YACd,CAAC;QACH,CAAC;IACH,CAAC;IAED;;OAEG;IACK,gBAAgB,CAAC,MAAyB;QAChD,OAAO,CAAC,WAAW,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC9D,CAAC;IAED;;OAEG;IACK,KAAK,CAAC,EAAU;QACtB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;IAC3D,CAAC;CACF"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { UniversalHttpClient } from '../http/client';
|
|
2
|
+
import { OnRampQuoteParams, OnRampQuoteResponse, OnRampStatusResponse } from '../types/onramp';
|
|
3
|
+
export interface OnRampPollingOptions {
|
|
4
|
+
intervalMs?: number;
|
|
5
|
+
timeoutMs?: number;
|
|
6
|
+
onStatusUpdate?: (status: string) => void;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* API wrapper for on-ramp (fiat to crypto) operations
|
|
10
|
+
*/
|
|
11
|
+
export declare class OnRampAPI {
|
|
12
|
+
private httpClient;
|
|
13
|
+
constructor(httpClient: UniversalHttpClient);
|
|
14
|
+
/**
|
|
15
|
+
* Requests a quote for on-ramping fiat to crypto
|
|
16
|
+
* @param params On-ramp quote parameters
|
|
17
|
+
* @returns On-ramp quote response with deposit instructions
|
|
18
|
+
*/
|
|
19
|
+
requestQuote(params: OnRampQuoteParams): Promise<OnRampQuoteResponse>;
|
|
20
|
+
/**
|
|
21
|
+
* Gets the status of an on-ramp transaction
|
|
22
|
+
* @param transactionId The transaction ID
|
|
23
|
+
* @returns On-ramp transaction status
|
|
24
|
+
*/
|
|
25
|
+
getStatus(transactionId: string): Promise<OnRampStatusResponse>;
|
|
26
|
+
/**
|
|
27
|
+
* Waits for on-ramp completion using polling
|
|
28
|
+
* @param transactionId The transaction ID to monitor
|
|
29
|
+
* @param options Polling configuration
|
|
30
|
+
* @returns Final on-ramp status
|
|
31
|
+
*/
|
|
32
|
+
waitForCompletion(transactionId: string, options?: OnRampPollingOptions): Promise<OnRampStatusResponse>;
|
|
33
|
+
/**
|
|
34
|
+
* Checks if a status is terminal
|
|
35
|
+
*/
|
|
36
|
+
private isTerminalStatus;
|
|
37
|
+
/**
|
|
38
|
+
* Helper to sleep for a given duration
|
|
39
|
+
*/
|
|
40
|
+
private sleep;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=OnRampAPI.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OnRampAPI.d.ts","sourceRoot":"","sources":["../../../src/api/OnRampAPI.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAG/F,MAAM,WAAW,oBAAoB;IACnC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3C;AAED;;GAEG;AACH,qBAAa,SAAS;IACR,OAAO,CAAC,UAAU;gBAAV,UAAU,EAAE,mBAAmB;IAEnD;;;;OAIG;IACG,YAAY,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAI3E;;;;OAIG;IACG,SAAS,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAIrE;;;;;OAKG;IACG,iBAAiB,CACrB,aAAa,EAAE,MAAM,EACrB,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,oBAAoB,CAAC;IAmChC;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAIxB;;OAEG;IACH,OAAO,CAAC,KAAK;CAGd"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API wrapper for on-ramp (fiat to crypto) operations
|
|
3
|
+
*/
|
|
4
|
+
export class OnRampAPI {
|
|
5
|
+
constructor(httpClient) {
|
|
6
|
+
this.httpClient = httpClient;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Requests a quote for on-ramping fiat to crypto
|
|
10
|
+
* @param params On-ramp quote parameters
|
|
11
|
+
* @returns On-ramp quote response with deposit instructions
|
|
12
|
+
*/
|
|
13
|
+
async requestQuote(params) {
|
|
14
|
+
return this.httpClient.post('/onramp/quote', params);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Gets the status of an on-ramp transaction
|
|
18
|
+
* @param transactionId The transaction ID
|
|
19
|
+
* @returns On-ramp transaction status
|
|
20
|
+
*/
|
|
21
|
+
async getStatus(transactionId) {
|
|
22
|
+
return this.httpClient.get('/onramp/status', { transactionId });
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Waits for on-ramp completion using polling
|
|
26
|
+
* @param transactionId The transaction ID to monitor
|
|
27
|
+
* @param options Polling configuration
|
|
28
|
+
* @returns Final on-ramp status
|
|
29
|
+
*/
|
|
30
|
+
async waitForCompletion(transactionId, options) {
|
|
31
|
+
const intervalMs = options?.intervalMs || 15000; // 15 secs
|
|
32
|
+
const timeoutMs = options?.timeoutMs || 3600000; // 60 mins for PIX
|
|
33
|
+
const startTime = Date.now();
|
|
34
|
+
let lastStatus = null;
|
|
35
|
+
while (true) {
|
|
36
|
+
if (Date.now() - startTime > timeoutMs) {
|
|
37
|
+
throw new Error(`On-ramp polling timeout after ${timeoutMs}ms. Last status: ${lastStatus}`);
|
|
38
|
+
}
|
|
39
|
+
try {
|
|
40
|
+
const response = await this.getStatus(transactionId);
|
|
41
|
+
const currentStatus = response.status;
|
|
42
|
+
if (currentStatus !== lastStatus && options?.onStatusUpdate) {
|
|
43
|
+
options.onStatusUpdate(currentStatus);
|
|
44
|
+
}
|
|
45
|
+
lastStatus = currentStatus;
|
|
46
|
+
if (this.isTerminalStatus(currentStatus)) {
|
|
47
|
+
return response;
|
|
48
|
+
}
|
|
49
|
+
await this.sleep(intervalMs); // wait before next poll
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
if (error instanceof Error && error.message.includes('network')) {
|
|
53
|
+
await this.sleep(intervalMs);
|
|
54
|
+
continue; // continue polling on error
|
|
55
|
+
}
|
|
56
|
+
throw error;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Checks if a status is terminal
|
|
62
|
+
*/
|
|
63
|
+
isTerminalStatus(status) {
|
|
64
|
+
return ['Completed', 'Failed', 'Cancelled', 'Refunded'].includes(status);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Helper to sleep for a given duration
|
|
68
|
+
*/
|
|
69
|
+
sleep(ms) {
|
|
70
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=OnRampAPI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OnRampAPI.js","sourceRoot":"","sources":["../../../src/api/OnRampAPI.ts"],"names":[],"mappings":"AAUA;;GAEG;AACH,MAAM,OAAO,SAAS;IACpB,YAAoB,UAA+B;QAA/B,eAAU,GAAV,UAAU,CAAqB;IAAG,CAAC;IAEvD;;;;OAIG;IACH,KAAK,CAAC,YAAY,CAAC,MAAyB;QAC1C,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAsB,eAAe,EAAE,MAAM,CAAC,CAAC;IAC5E,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,SAAS,CAAC,aAAqB;QACnC,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAuB,gBAAgB,EAAE,EAAE,aAAa,EAAE,CAAC,CAAC;IACxF,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,iBAAiB,CACrB,aAAqB,EACrB,OAA8B;QAE9B,MAAM,UAAU,GAAG,OAAO,EAAE,UAAU,IAAI,KAAK,CAAC,CAAC,UAAU;QAC3D,MAAM,SAAS,GAAG,OAAO,EAAE,SAAS,IAAI,OAAO,CAAC,CAAC,kBAAkB;QACnE,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAC7B,IAAI,UAAU,GAAkB,IAAI,CAAC;QAErC,OAAO,IAAI,EAAE,CAAC;YACZ,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,GAAG,SAAS,EAAE,CAAC;gBACvC,MAAM,IAAI,KAAK,CAAC,iCAAiC,SAAS,oBAAoB,UAAU,EAAE,CAAC,CAAC;YAC9F,CAAC;YAED,IAAI,CAAC;gBACH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;gBACrD,MAAM,aAAa,GAAG,QAAQ,CAAC,MAAM,CAAC;gBAEtC,IAAI,aAAa,KAAK,UAAU,IAAI,OAAO,EAAE,cAAc,EAAE,CAAC;oBAC5D,OAAO,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC;gBACxC,CAAC;gBACD,UAAU,GAAG,aAAa,CAAC;gBAE3B,IAAI,IAAI,CAAC,gBAAgB,CAAC,aAAa,CAAC,EAAE,CAAC;oBACzC,OAAO,QAAQ,CAAC;gBAClB,CAAC;gBAED,MAAM,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,wBAAwB;YACxD,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,IAAI,KAAK,YAAY,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;oBAChE,MAAM,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;oBAC7B,SAAS,CAAC,4BAA4B;gBACxC,CAAC;gBACD,MAAM,KAAK,CAAC;YACd,CAAC;QACH,CAAC;IACH,CAAC;IAED;;OAEG;IACK,gBAAgB,CAAC,MAAc;QACrC,OAAO,CAAC,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC3E,CAAC;IAED;;OAEG;IACK,KAAK,CAAC,EAAU;QACtB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;IAC3D,CAAC;CACF"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { UniversalHttpClient } from '../http/client';
|
|
2
|
+
import { QuoteRequestParams, QuoteResponse } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* API wrapper for quote operations
|
|
5
|
+
*/
|
|
6
|
+
export declare class QuoteAPI {
|
|
7
|
+
private httpClient;
|
|
8
|
+
constructor(httpClient: UniversalHttpClient);
|
|
9
|
+
/**
|
|
10
|
+
* Requests a quote for a cross-chain transfer
|
|
11
|
+
* @param params Quote request parameters
|
|
12
|
+
* @returns Quote response with transaction ID and transfer details
|
|
13
|
+
*/
|
|
14
|
+
request(params: QuoteRequestParams): Promise<QuoteResponse>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=QuoteAPI.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QuoteAPI.d.ts","sourceRoot":"","sources":["../../../src/api/QuoteAPI.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE7D;;GAEG;AACH,qBAAa,QAAQ;IACP,OAAO,CAAC,UAAU;gBAAV,UAAU,EAAE,mBAAmB;IAEnD;;;;OAIG;IACG,OAAO,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,aAAa,CAAC;CAGlE"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API wrapper for quote operations
|
|
3
|
+
*/
|
|
4
|
+
export class QuoteAPI {
|
|
5
|
+
constructor(httpClient) {
|
|
6
|
+
this.httpClient = httpClient;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Requests a quote for a cross-chain transfer
|
|
10
|
+
* @param params Quote request parameters
|
|
11
|
+
* @returns Quote response with transaction ID and transfer details
|
|
12
|
+
*/
|
|
13
|
+
async request(params) {
|
|
14
|
+
return this.httpClient.post('/quote', params);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=QuoteAPI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QuoteAPI.js","sourceRoot":"","sources":["../../../src/api/QuoteAPI.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,OAAO,QAAQ;IACnB,YAAoB,UAA+B;QAA/B,eAAU,GAAV,UAAU,CAAqB;IAAG,CAAC;IAEvD;;;;OAIG;IACH,KAAK,CAAC,OAAO,CAAC,MAA0B;QACtC,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAgB,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC/D,CAAC;CACF"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { UniversalHttpClient } from '../http/client';
|
|
2
|
+
import { CreateRecipientParams, UpdateRecipientSettlementParams, DeactivateRecipientParams, CreateRecipientResponse, UpdateRecipientResponse, DeactivateRecipientResponse } from '../types';
|
|
3
|
+
export declare class RecipientAPI {
|
|
4
|
+
private httpClient;
|
|
5
|
+
constructor(httpClient: UniversalHttpClient);
|
|
6
|
+
/**
|
|
7
|
+
* Creates a new recipient
|
|
8
|
+
* @param params Recipient creation parameters
|
|
9
|
+
* @returns Recipient response with ID and optional smart wallet
|
|
10
|
+
*/
|
|
11
|
+
create(params: CreateRecipientParams): Promise<CreateRecipientResponse>;
|
|
12
|
+
/**
|
|
13
|
+
* Updates recipient settlement details
|
|
14
|
+
* @param params Update parameters including recipient ID
|
|
15
|
+
* @returns Update response
|
|
16
|
+
*/
|
|
17
|
+
updateSettlement(params: UpdateRecipientSettlementParams): Promise<UpdateRecipientResponse>;
|
|
18
|
+
/**
|
|
19
|
+
* Deactivates a recipient
|
|
20
|
+
* @param params Deactivation parameters
|
|
21
|
+
* @returns Deactivation response
|
|
22
|
+
*/
|
|
23
|
+
deactivate(params: DeactivateRecipientParams): Promise<DeactivateRecipientResponse>;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=RecipientAPI.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RecipientAPI.d.ts","sourceRoot":"","sources":["../../../src/api/RecipientAPI.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EACL,qBAAqB,EACrB,+BAA+B,EAC/B,yBAAyB,EACzB,uBAAuB,EACvB,uBAAuB,EACvB,2BAA2B,EAC5B,MAAM,UAAU,CAAC;AAElB,qBAAa,YAAY;IACX,OAAO,CAAC,UAAU;gBAAV,UAAU,EAAE,mBAAmB;IAEnD;;;;OAIG;IACG,MAAM,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAAC,uBAAuB,CAAC;IAI7E;;;;OAIG;IACG,gBAAgB,CACpB,MAAM,EAAE,+BAA+B,GACtC,OAAO,CAAC,uBAAuB,CAAC;IAInC;;;;OAIG;IACG,UAAU,CAAC,MAAM,EAAE,yBAAyB,GAAG,OAAO,CAAC,2BAA2B,CAAC;CAG1F"}
|