@shogun-sdk/intents-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/README.md +124 -0
- package/dist/_esm/chains.js +46 -0
- package/dist/_esm/chains.js.map +1 -0
- package/dist/_esm/config.js +2 -0
- package/dist/_esm/config.js.map +1 -0
- package/dist/_esm/constants.js +46 -0
- package/dist/_esm/constants.js.map +1 -0
- package/dist/_esm/core/evm/abi/erc20.js +313 -0
- package/dist/_esm/core/evm/abi/erc20.js.map +1 -0
- package/dist/_esm/core/evm/abi/source-chain-guard.js +1716 -0
- package/dist/_esm/core/evm/abi/source-chain-guard.js.map +1 -0
- package/dist/_esm/core/evm/intent-provider.js +59 -0
- package/dist/_esm/core/evm/intent-provider.js.map +1 -0
- package/dist/_esm/core/evm/order-signature.js +19 -0
- package/dist/_esm/core/evm/order-signature.js.map +1 -0
- package/dist/_esm/core/evm/permit2.js +31 -0
- package/dist/_esm/core/evm/permit2.js.map +1 -0
- package/dist/_esm/core/evm/sdk.js +79 -0
- package/dist/_esm/core/evm/sdk.js.map +1 -0
- package/dist/_esm/core/evm/validator.js +46 -0
- package/dist/_esm/core/evm/validator.js.map +1 -0
- package/dist/_esm/core/evm/viem-provider.js +76 -0
- package/dist/_esm/core/evm/viem-provider.js.map +1 -0
- package/dist/_esm/core/order.js +190 -0
- package/dist/_esm/core/order.js.map +1 -0
- package/dist/_esm/core/sdk.js +120 -0
- package/dist/_esm/core/sdk.js.map +1 -0
- package/dist/_esm/core/solana/client.js +19 -0
- package/dist/_esm/core/solana/client.js.map +1 -0
- package/dist/_esm/core/solana/generated/accounts/adminSingleton.js +56 -0
- package/dist/_esm/core/solana/generated/accounts/adminSingleton.js.map +1 -0
- package/dist/_esm/core/solana/generated/accounts/guard.js +62 -0
- package/dist/_esm/core/solana/generated/accounts/guard.js.map +1 -0
- package/dist/_esm/core/solana/generated/accounts/index.js +11 -0
- package/dist/_esm/core/solana/generated/accounts/index.js.map +1 -0
- package/dist/_esm/core/solana/generated/accounts/order.js +78 -0
- package/dist/_esm/core/solana/generated/accounts/order.js.map +1 -0
- package/dist/_esm/core/solana/generated/errors/index.js +9 -0
- package/dist/_esm/core/solana/generated/errors/index.js.map +1 -0
- package/dist/_esm/core/solana/generated/errors/sourceChainGuard.js +35 -0
- package/dist/_esm/core/solana/generated/errors/sourceChainGuard.js.map +1 -0
- package/dist/_esm/core/solana/generated/index.js +13 -0
- package/dist/_esm/core/solana/generated/index.js.map +1 -0
- package/dist/_esm/core/solana/generated/instructions/cancelOrder.js +125 -0
- package/dist/_esm/core/solana/generated/instructions/cancelOrder.js.map +1 -0
- package/dist/_esm/core/solana/generated/instructions/claimTokens.js +142 -0
- package/dist/_esm/core/solana/generated/instructions/claimTokens.js.map +1 -0
- package/dist/_esm/core/solana/generated/instructions/collectProtocolFees.js +146 -0
- package/dist/_esm/core/solana/generated/instructions/collectProtocolFees.js.map +1 -0
- package/dist/_esm/core/solana/generated/instructions/createGuard.js +236 -0
- package/dist/_esm/core/solana/generated/instructions/createGuard.js.map +1 -0
- package/dist/_esm/core/solana/generated/instructions/createOrder.js +182 -0
- package/dist/_esm/core/solana/generated/instructions/createOrder.js.map +1 -0
- package/dist/_esm/core/solana/generated/instructions/index.js +19 -0
- package/dist/_esm/core/solana/generated/instructions/index.js.map +1 -0
- package/dist/_esm/core/solana/generated/instructions/initialize.js +109 -0
- package/dist/_esm/core/solana/generated/instructions/initialize.js.map +1 -0
- package/dist/_esm/core/solana/generated/instructions/preStartOrderExecution.js +123 -0
- package/dist/_esm/core/solana/generated/instructions/preStartOrderExecution.js.map +1 -0
- package/dist/_esm/core/solana/generated/instructions/setAdmin.js +98 -0
- package/dist/_esm/core/solana/generated/instructions/setAdmin.js.map +1 -0
- package/dist/_esm/core/solana/generated/instructions/setAuctioneerPubKey.js +104 -0
- package/dist/_esm/core/solana/generated/instructions/setAuctioneerPubKey.js.map +1 -0
- package/dist/_esm/core/solana/generated/instructions/startOrderExecution.js +105 -0
- package/dist/_esm/core/solana/generated/instructions/startOrderExecution.js.map +1 -0
- package/dist/_esm/core/solana/generated/instructions/startOrderExecutionAfterSwap.js +113 -0
- package/dist/_esm/core/solana/generated/instructions/startOrderExecutionAfterSwap.js.map +1 -0
- package/dist/_esm/core/solana/generated/programs/index.js +9 -0
- package/dist/_esm/core/solana/generated/programs/index.js.map +1 -0
- package/dist/_esm/core/solana/generated/programs/sourceChainGuard.js +82 -0
- package/dist/_esm/core/solana/generated/programs/sourceChainGuard.js.map +1 -0
- package/dist/_esm/core/solana/generated/shared/index.js +82 -0
- package/dist/_esm/core/solana/generated/shared/index.js.map +1 -0
- package/dist/_esm/core/solana/generated/types/adminUpdated.js +18 -0
- package/dist/_esm/core/solana/generated/types/adminUpdated.js.map +1 -0
- package/dist/_esm/core/solana/generated/types/auctioneerPubkeyUpdated.js +24 -0
- package/dist/_esm/core/solana/generated/types/auctioneerPubkeyUpdated.js.map +1 -0
- package/dist/_esm/core/solana/generated/types/executionStarted.js +30 -0
- package/dist/_esm/core/solana/generated/types/executionStarted.js.map +1 -0
- package/dist/_esm/core/solana/generated/types/guardCreated.js +28 -0
- package/dist/_esm/core/solana/generated/types/guardCreated.js.map +1 -0
- package/dist/_esm/core/solana/generated/types/index.js +16 -0
- package/dist/_esm/core/solana/generated/types/index.js.map +1 -0
- package/dist/_esm/core/solana/generated/types/orderCancelled.js +18 -0
- package/dist/_esm/core/solana/generated/types/orderCancelled.js.map +1 -0
- package/dist/_esm/core/solana/generated/types/orderCreated.js +36 -0
- package/dist/_esm/core/solana/generated/types/orderCreated.js.map +1 -0
- package/dist/_esm/core/solana/generated/types/orderFulfilled.js +18 -0
- package/dist/_esm/core/solana/generated/types/orderFulfilled.js.map +1 -0
- package/dist/_esm/core/solana/generated/types/tokenInSwapped.js +26 -0
- package/dist/_esm/core/solana/generated/types/tokenInSwapped.js.map +1 -0
- package/dist/_esm/core/solana/order-instructions.js +92 -0
- package/dist/_esm/core/solana/order-instructions.js.map +1 -0
- package/dist/_esm/core/solana/sdk.js +111 -0
- package/dist/_esm/core/solana/sdk.js.map +1 -0
- package/dist/_esm/core/solana/validator.js +22 -0
- package/dist/_esm/core/solana/validator.js.map +1 -0
- package/dist/_esm/core/sui/client.js +3 -0
- package/dist/_esm/core/sui/client.js.map +1 -0
- package/dist/_esm/core/sui/order-transaction.js +56 -0
- package/dist/_esm/core/sui/order-transaction.js.map +1 -0
- package/dist/_esm/core/sui/sdk.js +94 -0
- package/dist/_esm/core/sui/sdk.js.map +1 -0
- package/dist/_esm/core/sui/validator.js +25 -0
- package/dist/_esm/core/sui/validator.js.map +1 -0
- package/dist/_esm/errors/index.js +94 -0
- package/dist/_esm/errors/index.js.map +1 -0
- package/dist/_esm/index.js +7 -0
- package/dist/_esm/index.js.map +1 -0
- package/dist/_esm/package.json +1 -0
- package/dist/_esm/types/intent.js +2 -0
- package/dist/_esm/types/intent.js.map +1 -0
- package/dist/_esm/utils/base-validator.js +51 -0
- package/dist/_esm/utils/base-validator.js.map +1 -0
- package/dist/_esm/utils/logger.js +109 -0
- package/dist/_esm/utils/logger.js.map +1 -0
- package/dist/_esm/utils/order-validator.js +75 -0
- package/dist/_esm/utils/order-validator.js.map +1 -0
- package/dist/_esm/utils/parsers.js +10 -0
- package/dist/_esm/utils/parsers.js.map +1 -0
- package/dist/_esm/utils/type-utils.js +2 -0
- package/dist/_esm/utils/type-utils.js.map +1 -0
- package/dist/_types/chains.d.ts +69 -0
- package/dist/_types/chains.d.ts.map +1 -0
- package/dist/_types/config.d.ts +21 -0
- package/dist/_types/config.d.ts.map +1 -0
- package/dist/_types/constants.d.ts +18 -0
- package/dist/_types/constants.d.ts.map +1 -0
- package/dist/_types/core/evm/abi/erc20.d.ts +240 -0
- package/dist/_types/core/evm/abi/erc20.d.ts.map +1 -0
- package/dist/_types/core/evm/abi/source-chain-guard.d.ts +1343 -0
- package/dist/_types/core/evm/abi/source-chain-guard.d.ts.map +1 -0
- package/dist/_types/core/evm/intent-provider.d.ts +12 -0
- package/dist/_types/core/evm/intent-provider.d.ts.map +1 -0
- package/dist/_types/core/evm/order-signature.d.ts +19 -0
- package/dist/_types/core/evm/order-signature.d.ts.map +1 -0
- package/dist/_types/core/evm/permit2.d.ts +75 -0
- package/dist/_types/core/evm/permit2.d.ts.map +1 -0
- package/dist/_types/core/evm/sdk.d.ts +50 -0
- package/dist/_types/core/evm/sdk.d.ts.map +1 -0
- package/dist/_types/core/evm/validator.d.ts +13 -0
- package/dist/_types/core/evm/validator.d.ts.map +1 -0
- package/dist/_types/core/evm/viem-provider.d.ts +9657 -0
- package/dist/_types/core/evm/viem-provider.d.ts.map +1 -0
- package/dist/_types/core/order.d.ts +122 -0
- package/dist/_types/core/order.d.ts.map +1 -0
- package/dist/_types/core/sdk.d.ts +86 -0
- package/dist/_types/core/sdk.d.ts.map +1 -0
- package/dist/_types/core/solana/client.d.ts +11 -0
- package/dist/_types/core/solana/client.d.ts.map +1 -0
- package/dist/_types/core/solana/generated/accounts/adminSingleton.d.ts +36 -0
- package/dist/_types/core/solana/generated/accounts/adminSingleton.d.ts.map +1 -0
- package/dist/_types/core/solana/generated/accounts/guard.d.ts +48 -0
- package/dist/_types/core/solana/generated/accounts/guard.d.ts.map +1 -0
- package/dist/_types/core/solana/generated/accounts/index.d.ts +11 -0
- package/dist/_types/core/solana/generated/accounts/index.d.ts.map +1 -0
- package/dist/_types/core/solana/generated/accounts/order.d.ts +92 -0
- package/dist/_types/core/solana/generated/accounts/order.d.ts.map +1 -0
- package/dist/_types/core/solana/generated/errors/index.d.ts +9 -0
- package/dist/_types/core/solana/generated/errors/index.d.ts.map +1 -0
- package/dist/_types/core/solana/generated/errors/sourceChainGuard.d.ts +27 -0
- package/dist/_types/core/solana/generated/errors/sourceChainGuard.d.ts.map +1 -0
- package/dist/_types/core/solana/generated/index.d.ts +13 -0
- package/dist/_types/core/solana/generated/index.d.ts.map +1 -0
- package/dist/_types/core/solana/generated/instructions/cancelOrder.d.ts +108 -0
- package/dist/_types/core/solana/generated/instructions/cancelOrder.d.ts.map +1 -0
- package/dist/_types/core/solana/generated/instructions/claimTokens.d.ts +131 -0
- package/dist/_types/core/solana/generated/instructions/claimTokens.d.ts.map +1 -0
- package/dist/_types/core/solana/generated/instructions/collectProtocolFees.d.ts +91 -0
- package/dist/_types/core/solana/generated/instructions/collectProtocolFees.d.ts.map +1 -0
- package/dist/_types/core/solana/generated/instructions/createGuard.d.ts +133 -0
- package/dist/_types/core/solana/generated/instructions/createGuard.d.ts.map +1 -0
- package/dist/_types/core/solana/generated/instructions/createOrder.d.ts +122 -0
- package/dist/_types/core/solana/generated/instructions/createOrder.d.ts.map +1 -0
- package/dist/_types/core/solana/generated/instructions/index.d.ts +19 -0
- package/dist/_types/core/solana/generated/instructions/index.d.ts.map +1 -0
- package/dist/_types/core/solana/generated/instructions/initialize.d.ts +63 -0
- package/dist/_types/core/solana/generated/instructions/initialize.d.ts.map +1 -0
- package/dist/_types/core/solana/generated/instructions/preStartOrderExecution.d.ts +105 -0
- package/dist/_types/core/solana/generated/instructions/preStartOrderExecution.d.ts.map +1 -0
- package/dist/_types/core/solana/generated/instructions/setAdmin.d.ts +61 -0
- package/dist/_types/core/solana/generated/instructions/setAdmin.d.ts.map +1 -0
- package/dist/_types/core/solana/generated/instructions/setAuctioneerPubKey.d.ts +68 -0
- package/dist/_types/core/solana/generated/instructions/setAuctioneerPubKey.d.ts.map +1 -0
- package/dist/_types/core/solana/generated/instructions/startOrderExecution.d.ts +85 -0
- package/dist/_types/core/solana/generated/instructions/startOrderExecution.d.ts.map +1 -0
- package/dist/_types/core/solana/generated/instructions/startOrderExecutionAfterSwap.d.ts +95 -0
- package/dist/_types/core/solana/generated/instructions/startOrderExecutionAfterSwap.d.ts.map +1 -0
- package/dist/_types/core/solana/generated/programs/index.d.ts +9 -0
- package/dist/_types/core/solana/generated/programs/index.d.ts.map +1 -0
- package/dist/_types/core/solana/generated/programs/sourceChainGuard.d.ts +59 -0
- package/dist/_types/core/solana/generated/programs/sourceChainGuard.d.ts.map +1 -0
- package/dist/_types/core/solana/generated/shared/index.d.ts +52 -0
- package/dist/_types/core/solana/generated/shared/index.d.ts.map +1 -0
- package/dist/_types/core/solana/generated/types/adminUpdated.d.ts +16 -0
- package/dist/_types/core/solana/generated/types/adminUpdated.d.ts.map +1 -0
- package/dist/_types/core/solana/generated/types/auctioneerPubkeyUpdated.d.ts +17 -0
- package/dist/_types/core/solana/generated/types/auctioneerPubkeyUpdated.d.ts.map +1 -0
- package/dist/_types/core/solana/generated/types/executionStarted.d.ts +26 -0
- package/dist/_types/core/solana/generated/types/executionStarted.d.ts.map +1 -0
- package/dist/_types/core/solana/generated/types/guardCreated.d.ts +19 -0
- package/dist/_types/core/solana/generated/types/guardCreated.d.ts.map +1 -0
- package/dist/_types/core/solana/generated/types/index.d.ts +16 -0
- package/dist/_types/core/solana/generated/types/index.d.ts.map +1 -0
- package/dist/_types/core/solana/generated/types/orderCancelled.d.ts +16 -0
- package/dist/_types/core/solana/generated/types/orderCancelled.d.ts.map +1 -0
- package/dist/_types/core/solana/generated/types/orderCreated.d.ts +32 -0
- package/dist/_types/core/solana/generated/types/orderCreated.d.ts.map +1 -0
- package/dist/_types/core/solana/generated/types/orderFulfilled.d.ts +16 -0
- package/dist/_types/core/solana/generated/types/orderFulfilled.d.ts.map +1 -0
- package/dist/_types/core/solana/generated/types/tokenInSwapped.d.ts +22 -0
- package/dist/_types/core/solana/generated/types/tokenInSwapped.d.ts.map +1 -0
- package/dist/_types/core/solana/order-instructions.d.ts +12 -0
- package/dist/_types/core/solana/order-instructions.d.ts.map +1 -0
- package/dist/_types/core/solana/sdk.d.ts +65 -0
- package/dist/_types/core/solana/sdk.d.ts.map +1 -0
- package/dist/_types/core/solana/validator.d.ts +9 -0
- package/dist/_types/core/solana/validator.d.ts.map +1 -0
- package/dist/_types/core/sui/client.d.ts +3 -0
- package/dist/_types/core/sui/client.d.ts.map +1 -0
- package/dist/_types/core/sui/order-transaction.d.ts +9 -0
- package/dist/_types/core/sui/order-transaction.d.ts.map +1 -0
- package/dist/_types/core/sui/sdk.d.ts +55 -0
- package/dist/_types/core/sui/sdk.d.ts.map +1 -0
- package/dist/_types/core/sui/validator.d.ts +9 -0
- package/dist/_types/core/sui/validator.d.ts.map +1 -0
- package/dist/_types/errors/index.d.ts +32 -0
- package/dist/_types/errors/index.d.ts.map +1 -0
- package/dist/_types/index.d.ts +10 -0
- package/dist/_types/index.d.ts.map +1 -0
- package/dist/_types/types/intent.d.ts +129 -0
- package/dist/_types/types/intent.d.ts.map +1 -0
- package/dist/_types/utils/base-validator.d.ts +28 -0
- package/dist/_types/utils/base-validator.d.ts.map +1 -0
- package/dist/_types/utils/logger.d.ts +35 -0
- package/dist/_types/utils/logger.d.ts.map +1 -0
- package/dist/_types/utils/order-validator.d.ts +40 -0
- package/dist/_types/utils/order-validator.d.ts.map +1 -0
- package/dist/_types/utils/parsers.d.ts +4 -0
- package/dist/_types/utils/parsers.d.ts.map +1 -0
- package/dist/_types/utils/type-utils.d.ts +2 -0
- package/dist/_types/utils/type-utils.d.ts.map +1 -0
- package/package.json +62 -0
- package/src/chains.ts +77 -0
- package/src/config.ts +24 -0
- package/src/constants.ts +61 -0
- package/src/core/evm/abi/erc20.ts +312 -0
- package/src/core/evm/abi/source-chain-guard.ts +1715 -0
- package/src/core/evm/intent-provider.ts +63 -0
- package/src/core/evm/order-signature.ts +33 -0
- package/src/core/evm/permit2.ts +60 -0
- package/src/core/evm/sdk.ts +74 -0
- package/src/core/evm/validator.ts +60 -0
- package/src/core/evm/viem-provider.ts +79 -0
- package/src/core/order.ts +186 -0
- package/src/core/sdk.ts +154 -0
- package/src/core/solana/client.ts +37 -0
- package/src/core/solana/generated/accounts/adminSingleton.ts +136 -0
- package/src/core/solana/generated/accounts/guard.ts +156 -0
- package/src/core/solana/generated/accounts/index.ts +11 -0
- package/src/core/solana/generated/accounts/order.ts +218 -0
- package/src/core/solana/generated/errors/index.ts +9 -0
- package/src/core/solana/generated/errors/sourceChainGuard.ts +52 -0
- package/src/core/solana/generated/index.ts +13 -0
- package/src/core/solana/generated/instructions/cancelOrder.ts +357 -0
- package/src/core/solana/generated/instructions/claimTokens.ts +419 -0
- package/src/core/solana/generated/instructions/collectProtocolFees.ts +383 -0
- package/src/core/solana/generated/instructions/createGuard.ts +569 -0
- package/src/core/solana/generated/instructions/createOrder.ts +480 -0
- package/src/core/solana/generated/instructions/index.ts +19 -0
- package/src/core/solana/generated/instructions/initialize.ts +231 -0
- package/src/core/solana/generated/instructions/preStartOrderExecution.ts +362 -0
- package/src/core/solana/generated/instructions/setAdmin.ts +211 -0
- package/src/core/solana/generated/instructions/setAuctioneerPubKey.ts +241 -0
- package/src/core/solana/generated/instructions/startOrderExecution.ts +293 -0
- package/src/core/solana/generated/instructions/startOrderExecutionAfterSwap.ts +323 -0
- package/src/core/solana/generated/programs/index.ts +9 -0
- package/src/core/solana/generated/programs/sourceChainGuard.ts +223 -0
- package/src/core/solana/generated/shared/index.ts +124 -0
- package/src/core/solana/generated/types/adminUpdated.ts +35 -0
- package/src/core/solana/generated/types/auctioneerPubkeyUpdated.ts +44 -0
- package/src/core/solana/generated/types/executionStarted.ts +63 -0
- package/src/core/solana/generated/types/guardCreated.ts +50 -0
- package/src/core/solana/generated/types/index.ts +16 -0
- package/src/core/solana/generated/types/orderCancelled.ts +35 -0
- package/src/core/solana/generated/types/orderCreated.ts +80 -0
- package/src/core/solana/generated/types/orderFulfilled.ts +35 -0
- package/src/core/solana/generated/types/tokenInSwapped.ts +53 -0
- package/src/core/solana/order-instructions.ts +131 -0
- package/src/core/solana/sdk.ts +135 -0
- package/src/core/solana/validator.ts +26 -0
- package/src/core/sui/client.ts +3 -0
- package/src/core/sui/order-transaction.ts +78 -0
- package/src/core/sui/sdk.ts +95 -0
- package/src/core/sui/validator.ts +32 -0
- package/src/errors/index.ts +106 -0
- package/src/index.ts +10 -0
- package/src/types/intent.ts +143 -0
- package/src/utils/base-validator.ts +64 -0
- package/src/utils/logger.ts +128 -0
- package/src/utils/order-validator.ts +103 -0
- package/src/utils/parsers.ts +8 -0
- package/src/utils/type-utils.ts +1 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { SuiConfig } from '../../config.js';
|
|
2
|
+
import type { PreparedOrder } from '../../types/intent.js';
|
|
3
|
+
import { Order } from '../order.js';
|
|
4
|
+
import { BaseSDK } from '../sdk.js';
|
|
5
|
+
/**
|
|
6
|
+
* Sui-specific SDK implementation
|
|
7
|
+
*
|
|
8
|
+
* Handles Sui-specific aspects of cross-chain swaps using the Sui blockchain.
|
|
9
|
+
* Uses @mysten/sui libraries for transaction creation, signing, and submission.
|
|
10
|
+
* Supports cross-chain swaps from Sui to other supported chains.
|
|
11
|
+
*/
|
|
12
|
+
export declare class SuiSDK extends BaseSDK {
|
|
13
|
+
/** Configuration for Sui connection and authentication */
|
|
14
|
+
private readonly config;
|
|
15
|
+
/** Client for Sui RPC interactions and transaction handling */
|
|
16
|
+
private client;
|
|
17
|
+
/**
|
|
18
|
+
* Creates a new instance of the Sui SDK
|
|
19
|
+
*
|
|
20
|
+
* @param config Sui configuration including privateKey and optional RPC URL
|
|
21
|
+
*/
|
|
22
|
+
constructor(config: SuiConfig);
|
|
23
|
+
/**
|
|
24
|
+
* Gets the user's Sui wallet address derived from their private key
|
|
25
|
+
*
|
|
26
|
+
* Uses Ed25519Keypair to securely derive the wallet address from the private key
|
|
27
|
+
*
|
|
28
|
+
* @returns Promise resolving to the user's Sui address as a hex string
|
|
29
|
+
*/
|
|
30
|
+
getUserAddress(): Promise<string>;
|
|
31
|
+
/**
|
|
32
|
+
* Creates an Ed25519Keypair from the user's private key
|
|
33
|
+
*
|
|
34
|
+
* The keypair is used for transaction signing and address derivation
|
|
35
|
+
*
|
|
36
|
+
* @returns Ed25519Keypair for cryptographic operations
|
|
37
|
+
* @private
|
|
38
|
+
*/
|
|
39
|
+
private getKeyPair;
|
|
40
|
+
/**
|
|
41
|
+
* Prepares a Sui order for submission
|
|
42
|
+
*
|
|
43
|
+
* This method:
|
|
44
|
+
* 1. Gets the user's keypair from their private key
|
|
45
|
+
* 2. Generates Sui-specific transaction for the order
|
|
46
|
+
* 3. Signs and executes the transaction on the Sui blockchain
|
|
47
|
+
* 4. Returns the prepared order with the transaction hash for tracking
|
|
48
|
+
*
|
|
49
|
+
* @param order The validated order to prepare
|
|
50
|
+
* @returns Promise resolving to a prepared order with Sui-specific data
|
|
51
|
+
* @protected
|
|
52
|
+
*/
|
|
53
|
+
protected prepareOrder(order: Order): Promise<PreparedOrder>;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=sdk.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../../../src/core/sui/sdk.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC;;;;;;GAMG;AACH,qBAAa,MAAO,SAAQ,OAAO;IACjC,0DAA0D;IAC1D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAY;IACnC,+DAA+D;IAC/D,OAAO,CAAC,MAAM,CAAY;IAE1B;;;;OAIG;gBACS,MAAM,EAAE,SAAS;IAM7B;;;;;;OAMG;IACU,cAAc,IAAI,OAAO,CAAC,MAAM,CAAC;IAI9C;;;;;;;OAOG;IACH,OAAO,CAAC,UAAU;IAIlB;;;;;;;;;;;;OAYG;cACa,YAAY,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,aAAa,CAAC;CAuBnE"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BaseValidator } from '../../utils/base-validator.js';
|
|
2
|
+
export declare class SuiValidator extends BaseValidator {
|
|
3
|
+
isValidAddress(address: string): boolean;
|
|
4
|
+
isValidTokenAddress(tokenAddress: string): boolean;
|
|
5
|
+
isValidAmount(amount: bigint): boolean;
|
|
6
|
+
protected getChainName(): string;
|
|
7
|
+
chainSpecificValidation(): Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../../../src/core/sui/validator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAI9D,qBAAa,YAAa,SAAQ,aAAa;IAC7C,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IAIxC,mBAAmB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO;IAQlD,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;IAItC,SAAS,CAAC,YAAY,IAAI,MAAM;IAInB,uBAAuB,IAAI,OAAO,CAAC,IAAI,CAAC;CAItD"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export declare class BaseError extends Error {
|
|
2
|
+
readonly cause?: unknown | undefined;
|
|
3
|
+
constructor(message: string, cause?: unknown | undefined);
|
|
4
|
+
toJSON(): Record<string, unknown>;
|
|
5
|
+
private formatCause;
|
|
6
|
+
}
|
|
7
|
+
export declare class EVMError extends BaseError {
|
|
8
|
+
constructor(message: string, cause?: unknown);
|
|
9
|
+
}
|
|
10
|
+
export declare class SolanaError extends BaseError {
|
|
11
|
+
constructor(message: string, cause?: unknown);
|
|
12
|
+
}
|
|
13
|
+
export declare class SuiError extends BaseError {
|
|
14
|
+
constructor(message: string, cause?: unknown);
|
|
15
|
+
}
|
|
16
|
+
export declare class ValidationError extends BaseError {
|
|
17
|
+
constructor(message: string, cause?: unknown);
|
|
18
|
+
}
|
|
19
|
+
export declare class OrderCreationError extends BaseError {
|
|
20
|
+
constructor(message: string, cause?: unknown);
|
|
21
|
+
}
|
|
22
|
+
export declare class NetworkError extends BaseError {
|
|
23
|
+
constructor(message: string, cause?: unknown);
|
|
24
|
+
}
|
|
25
|
+
export declare class InsufficientBalanceError extends BaseError {
|
|
26
|
+
constructor(message: string, cause?: unknown);
|
|
27
|
+
}
|
|
28
|
+
export declare class InsufficientAllowanceError extends BaseError {
|
|
29
|
+
constructor(message: string, cause?: unknown);
|
|
30
|
+
}
|
|
31
|
+
export declare function handleError(error: unknown): BaseError;
|
|
32
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/errors/index.ts"],"names":[],"mappings":"AAAA,qBAAa,SAAU,SAAQ,KAAK;aAGP,KAAK,CAAC,EAAE,OAAO;gBADxC,OAAO,EAAE,MAAM,EACU,KAAK,CAAC,EAAE,OAAO,YAAA;IAQnC,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAQxC,OAAO,CAAC,WAAW;CAapB;AAGD,qBAAa,QAAS,SAAQ,SAAS;gBACzB,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;CAI7C;AAED,qBAAa,WAAY,SAAQ,SAAS;gBAC5B,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;CAI7C;AAED,qBAAa,QAAS,SAAQ,SAAS;gBACzB,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;CAI7C;AAGD,qBAAa,eAAgB,SAAQ,SAAS;gBAChC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;CAI7C;AAED,qBAAa,kBAAmB,SAAQ,SAAS;gBACnC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;CAI7C;AAED,qBAAa,YAAa,SAAQ,SAAS;gBAC7B,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;CAI7C;AAED,qBAAa,wBAAyB,SAAQ,SAAS;gBACzC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;CAI7C;AAED,qBAAa,0BAA2B,SAAQ,SAAS;gBAC3C,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;CAI7C;AACD,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,CAcrD"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type { ChainID, ChainType } from './chains.js';
|
|
2
|
+
export { SupportedChains } from './chains.js';
|
|
3
|
+
export type { EVMConfig, SolanaConfig, SuiConfig } from './config.js';
|
|
4
|
+
export { EVMSDK } from './core/evm/sdk.js';
|
|
5
|
+
export { Order } from './core/order.js';
|
|
6
|
+
export { SolanaSDK } from './core/solana/sdk.js';
|
|
7
|
+
export { SuiSDK } from './core/sui/sdk.js';
|
|
8
|
+
export { ValidationError } from './errors/index.js';
|
|
9
|
+
export type { CreateOrderParams } from './types/intent.js';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACtE,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,YAAY,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import type { SupportedChain } from '../chains.js';
|
|
2
|
+
import type { ExtraTransfer, Order } from '../core/order.js';
|
|
3
|
+
/**
|
|
4
|
+
* Parameters for creating a cross-chain order
|
|
5
|
+
* Used as input for the createOrder and createAndSendOrder methods
|
|
6
|
+
*/
|
|
7
|
+
export type CreateOrderParams = {
|
|
8
|
+
/** Chain ID where tokens will be sent from */
|
|
9
|
+
sourceChainId: SupportedChain;
|
|
10
|
+
/** Token address on the source chain to be swapped */
|
|
11
|
+
sourceTokenAddress: string;
|
|
12
|
+
/** Amount of source tokens to swap, in smallest units (e.g., Wei for ETH) */
|
|
13
|
+
sourceTokenAmount: bigint;
|
|
14
|
+
/** Chain ID where tokens will be received */
|
|
15
|
+
destinationChainId: SupportedChain;
|
|
16
|
+
/** Token address on the destination chain to receive */
|
|
17
|
+
destinationTokenAddress: string;
|
|
18
|
+
/** Minimum amount of destination tokens to receive, in smallest units */
|
|
19
|
+
destinationTokenMinAmount: bigint;
|
|
20
|
+
/** Recipient wallet address on the destination chain */
|
|
21
|
+
destinationAddress: string;
|
|
22
|
+
/** Minimum amount of stablecoins in the intermediate swap, in smallest units */
|
|
23
|
+
minStablecoinAmount: bigint;
|
|
24
|
+
/** Timestamp (in seconds) after which the order expires */
|
|
25
|
+
deadline: number;
|
|
26
|
+
/** Extra Transfers */
|
|
27
|
+
extraTransfers?: ExtraTransfer[];
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Details required to execute the order on the destination chain
|
|
31
|
+
* Contains all information needed for the cross-chain fulfillment
|
|
32
|
+
*/
|
|
33
|
+
export type ExecutionDetails = {
|
|
34
|
+
/** Chain ID where tokens will be received */
|
|
35
|
+
destChainId: SupportedChain;
|
|
36
|
+
/** Token address on the destination chain to receive */
|
|
37
|
+
tokenOut: string;
|
|
38
|
+
/** Minimum amount of destination tokens to receive, in smallest units */
|
|
39
|
+
amountOutMin: bigint;
|
|
40
|
+
/** Recipient wallet address on the destination chain */
|
|
41
|
+
destinationAddress: string;
|
|
42
|
+
/** Extra transfers to be made */
|
|
43
|
+
extraTransfers?: ExtraTransfer[];
|
|
44
|
+
};
|
|
45
|
+
/** Hex string with 0x prefix, used for various hashes */
|
|
46
|
+
export type Hash = `0x${string}`;
|
|
47
|
+
/** Hash of execution details, used to verify order integrity across chains */
|
|
48
|
+
export type ExecutionDetailsHash = Hash;
|
|
49
|
+
/**
|
|
50
|
+
* EVM-specific data required for prepared orders
|
|
51
|
+
* Contains the signature and nonce for Permit2 allowance
|
|
52
|
+
*/
|
|
53
|
+
export type EvmPreparedData = {
|
|
54
|
+
/** Random nonce for Permit2 signature, prevents replay attacks */
|
|
55
|
+
nonce: string;
|
|
56
|
+
/** EIP-712 signature authorizing the order */
|
|
57
|
+
signature: string | Hash;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Sui-specific data required for prepared orders
|
|
61
|
+
* Contains the transaction hash of the order creation transaction
|
|
62
|
+
*/
|
|
63
|
+
export type SuiPreparedData = {
|
|
64
|
+
/** Transaction hash of the successful order creation transaction */
|
|
65
|
+
transactionHash: string;
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* Solana-specific data required for prepared orders
|
|
69
|
+
* Contains the public key of the created order account
|
|
70
|
+
*/
|
|
71
|
+
export type SolanaPreparedData = {
|
|
72
|
+
/** Public key of the created order account on Solana */
|
|
73
|
+
orderPubkey: string;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Source chain data sent to the auctioneer
|
|
77
|
+
* Contains all information needed to start the cross-chain swap from the source chain
|
|
78
|
+
*/
|
|
79
|
+
export type SourceChainData = {
|
|
80
|
+
/** User's wallet address that initiated the order */
|
|
81
|
+
user: string;
|
|
82
|
+
/** Source chain ID where tokens will be sent from */
|
|
83
|
+
srcChainId: SupportedChain;
|
|
84
|
+
/** Token address on the source chain to be swapped */
|
|
85
|
+
tokenIn: string;
|
|
86
|
+
/** Amount of source tokens to swap, in smallest units */
|
|
87
|
+
amountIn: bigint;
|
|
88
|
+
/** Minimum amount of stablecoins in the intermediate swap, in smallest units */
|
|
89
|
+
minStablecoinsAmount: bigint;
|
|
90
|
+
/** Timestamp (in seconds) after which the order expires */
|
|
91
|
+
deadline: number;
|
|
92
|
+
/** Hash of execution details for cross-chain verification */
|
|
93
|
+
executionDetailsHash: ExecutionDetailsHash;
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Complete user intent request sent to the auctioneer service
|
|
97
|
+
* Contains all the information needed to execute the cross-chain swap
|
|
98
|
+
*/
|
|
99
|
+
export type UserIntentRequest = {
|
|
100
|
+
/** Generic data common to all chains */
|
|
101
|
+
genericData: SourceChainData;
|
|
102
|
+
/** JSON-stringified execution details for the destination chain */
|
|
103
|
+
executionDetails: string;
|
|
104
|
+
/** Chain-specific data including signatures and transaction details */
|
|
105
|
+
chainSpecificData: {
|
|
106
|
+
/** EVM-specific data (for Ethereum, Arbitrum, Optimism, Base) */
|
|
107
|
+
EVM?: EvmPreparedData;
|
|
108
|
+
/** Solana-specific data */
|
|
109
|
+
Solana?: SolanaPreparedData;
|
|
110
|
+
/** Sui-specific data */
|
|
111
|
+
Sui?: SolanaPreparedData;
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* Union type of all chain-specific prepared data
|
|
116
|
+
* The actual type depends on the source chain
|
|
117
|
+
*/
|
|
118
|
+
export type ChainPreparedData = EvmPreparedData | SuiPreparedData | SolanaPreparedData;
|
|
119
|
+
/**
|
|
120
|
+
* Fully prepared order ready for submission to the auctioneer
|
|
121
|
+
* Contains both the order details and chain-specific prepared data
|
|
122
|
+
*/
|
|
123
|
+
export type PreparedOrder = {
|
|
124
|
+
/** The original order with all cross-chain details */
|
|
125
|
+
order: Order;
|
|
126
|
+
/** Chain-specific data needed for order execution */
|
|
127
|
+
preparedData: ChainPreparedData;
|
|
128
|
+
};
|
|
129
|
+
//# sourceMappingURL=intent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intent.d.ts","sourceRoot":"","sources":["../../../src/types/intent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAE7D;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,8CAA8C;IAC9C,aAAa,EAAE,cAAc,CAAC;IAC9B,sDAAsD;IACtD,kBAAkB,EAAE,MAAM,CAAC;IAC3B,6EAA6E;IAC7E,iBAAiB,EAAE,MAAM,CAAC;IAE1B,6CAA6C;IAC7C,kBAAkB,EAAE,cAAc,CAAC;IACnC,wDAAwD;IACxD,uBAAuB,EAAE,MAAM,CAAC;IAChC,yEAAyE;IACzE,yBAAyB,EAAE,MAAM,CAAC;IAClC,wDAAwD;IACxD,kBAAkB,EAAE,MAAM,CAAC;IAE3B,gFAAgF;IAChF,mBAAmB,EAAE,MAAM,CAAC;IAC5B,2DAA2D;IAC3D,QAAQ,EAAE,MAAM,CAAC;IAEjB,sBAAsB;IACtB,cAAc,CAAC,EAAE,aAAa,EAAE,CAAC;CAClC,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,6CAA6C;IAC7C,WAAW,EAAE,cAAc,CAAC;IAC5B,wDAAwD;IACxD,QAAQ,EAAE,MAAM,CAAC;IACjB,yEAAyE;IACzE,YAAY,EAAE,MAAM,CAAC;IACrB,wDAAwD;IACxD,kBAAkB,EAAE,MAAM,CAAC;IAC3B,iCAAiC;IACjC,cAAc,CAAC,EAAE,aAAa,EAAE,CAAC;CAClC,CAAC;AAEF,yDAAyD;AACzD,MAAM,MAAM,IAAI,GAAG,KAAK,MAAM,EAAE,CAAC;AACjC,8EAA8E;AAC9E,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC;AAExC;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,kEAAkE;IAClE,KAAK,EAAE,MAAM,CAAC;IACd,8CAA8C;IAC9C,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,oEAAoE;IACpE,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,wDAAwD;IACxD,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,qDAAqD;IACrD,IAAI,EAAE,MAAM,CAAC;IACb,qDAAqD;IACrD,UAAU,EAAE,cAAc,CAAC;IAC3B,sDAAsD;IACtD,OAAO,EAAE,MAAM,CAAC;IAChB,yDAAyD;IACzD,QAAQ,EAAE,MAAM,CAAC;IACjB,gFAAgF;IAChF,oBAAoB,EAAE,MAAM,CAAC;IAC7B,2DAA2D;IAC3D,QAAQ,EAAE,MAAM,CAAC;IACjB,6DAA6D;IAC7D,oBAAoB,EAAE,oBAAoB,CAAC;CAC5C,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,wCAAwC;IACxC,WAAW,EAAE,eAAe,CAAC;IAC7B,mEAAmE;IACnE,gBAAgB,EAAE,MAAM,CAAC;IACzB,uEAAuE;IACvE,iBAAiB,EAAE;QACjB,iEAAiE;QACjE,GAAG,CAAC,EAAE,eAAe,CAAC;QACtB,2BAA2B;QAC3B,MAAM,CAAC,EAAE,kBAAkB,CAAC;QAC5B,wBAAwB;QACxB,GAAG,CAAC,EAAE,kBAAkB,CAAC;KAC1B,CAAC;CACH,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,eAAe,GAAG,eAAe,GAAG,kBAAkB,CAAC;AAEvF;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,sDAAsD;IACtD,KAAK,EAAE,KAAK,CAAC;IACb,qDAAqD;IACrD,YAAY,EAAE,iBAAiB,CAAC;CAGjC,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { OrderInput } from '../core/order.js';
|
|
2
|
+
import type { IChainValidator } from './order-validator.js';
|
|
3
|
+
/**
|
|
4
|
+
* BaseValidator - Abstract class implementing common validation logic
|
|
5
|
+
* This follows the Template Method pattern
|
|
6
|
+
*/
|
|
7
|
+
export declare abstract class BaseValidator implements IChainValidator {
|
|
8
|
+
abstract isValidAddress(address: string): boolean;
|
|
9
|
+
abstract isValidTokenAddress(tokenAddress: string): boolean;
|
|
10
|
+
abstract isValidAmount(amount: bigint): boolean;
|
|
11
|
+
protected abstract getChainName(): string;
|
|
12
|
+
abstract chainSpecificValidation(order: OrderInput): Promise<void>;
|
|
13
|
+
/**
|
|
14
|
+
* Validate source chain specific parameters of the order
|
|
15
|
+
*/
|
|
16
|
+
validateSourceChain(order: OrderInput): Promise<void>;
|
|
17
|
+
/**
|
|
18
|
+
* Validate destination chain specific parameters of the order
|
|
19
|
+
*/
|
|
20
|
+
validateDestinationChain(order: OrderInput): void;
|
|
21
|
+
/**
|
|
22
|
+
* Helper methods that throw specific validation errors
|
|
23
|
+
*/
|
|
24
|
+
protected validateAddress(address: string): void;
|
|
25
|
+
protected validateTokenAddress(tokenAddress: string): void;
|
|
26
|
+
protected validateAmount(amount: bigint): void;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=base-validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-validator.d.ts","sourceRoot":"","sources":["../../../src/utils/base-validator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D;;;GAGG;AACH,8BAAsB,aAAc,YAAW,eAAe;IAC5D,QAAQ,CAAC,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IACjD,QAAQ,CAAC,mBAAmB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO;IAC3D,QAAQ,CAAC,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;IAC/C,SAAS,CAAC,QAAQ,CAAC,YAAY,IAAI,MAAM;IACzC,QAAQ,CAAC,uBAAuB,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAElE;;OAEG;IACG,mBAAmB,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ3D;;OAEG;IACH,wBAAwB,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;IAcjD;;OAEG;IACH,SAAS,CAAC,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAMhD,SAAS,CAAC,oBAAoB,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI;IAM1D,SAAS,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;CAK/C"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export declare enum LogLevel {
|
|
2
|
+
DEBUG = "DEBUG",
|
|
3
|
+
INFO = "INFO",
|
|
4
|
+
WARN = "WARN",
|
|
5
|
+
ERROR = "ERROR",
|
|
6
|
+
NONE = "NONE"
|
|
7
|
+
}
|
|
8
|
+
export type LoggerConfig = {
|
|
9
|
+
level: LogLevel;
|
|
10
|
+
customLogger?: CustomLogger;
|
|
11
|
+
};
|
|
12
|
+
export interface CustomLogger {
|
|
13
|
+
debug(message: string, ...args: unknown[]): void;
|
|
14
|
+
info(message: string, ...args: unknown[]): void;
|
|
15
|
+
warn(message: string, ...args: unknown[]): void;
|
|
16
|
+
error(message: string, ...args: unknown[]): void;
|
|
17
|
+
}
|
|
18
|
+
declare class Logger {
|
|
19
|
+
private static instance;
|
|
20
|
+
private loggerImpl;
|
|
21
|
+
private logLevel;
|
|
22
|
+
private constructor();
|
|
23
|
+
static getInstance(): Logger;
|
|
24
|
+
configure(config: LoggerConfig): void;
|
|
25
|
+
debug(message: string, ...args: unknown[]): void;
|
|
26
|
+
info(message: string, ...args: unknown[]): void;
|
|
27
|
+
warn(message: string, ...args: unknown[]): void;
|
|
28
|
+
error(message: string, error?: unknown): void;
|
|
29
|
+
logError(error: unknown): void;
|
|
30
|
+
private shouldLog;
|
|
31
|
+
private formatError;
|
|
32
|
+
}
|
|
33
|
+
export declare const logger: Logger;
|
|
34
|
+
export {};
|
|
35
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../src/utils/logger.ts"],"names":[],"mappings":"AAEA,oBAAY,QAAQ;IAClB,KAAK,UAAU;IACf,IAAI,SAAS;IACb,IAAI,SAAS;IACb,KAAK,UAAU;IACf,IAAI,SAAS;CACd;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,EAAE,QAAQ,CAAC;IAChB,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B,CAAC;AAEF,MAAM,WAAW,YAAY;IAC3B,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IACjD,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAChD,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAChD,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;CAClD;AAoBD,cAAM,MAAM;IACV,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAS;IAChC,OAAO,CAAC,UAAU,CAAqC;IACvD,OAAO,CAAC,QAAQ,CAA2B;IAE3C,OAAO;WAEO,WAAW,IAAI,MAAM;IAO5B,SAAS,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI;IAOrC,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAMhD,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAM/C,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAM/C,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,IAAI;IAO7C,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;IAcrC,OAAO,CAAC,SAAS;IAQjB,OAAO,CAAC,WAAW;CAiBpB;AAED,eAAO,MAAM,MAAM,QAAuB,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ChainType, type SupportedChain } from '../chains.js';
|
|
2
|
+
import type { OrderInput } from '../core/order.js';
|
|
3
|
+
export interface IAddressValidator {
|
|
4
|
+
isValidAddress(address: string): boolean;
|
|
5
|
+
}
|
|
6
|
+
export interface ITokenValidator {
|
|
7
|
+
isValidTokenAddress(tokenAddress: string): boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface IAmountValidator {
|
|
10
|
+
isValidAmount(amount: bigint): boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface IDeadlineValidator {
|
|
13
|
+
isValidDeadline(deadline: number): boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface ICrossChainValidator {
|
|
16
|
+
isValidCrossChain(sourceChainId: SupportedChain, destinationChainId: SupportedChain): boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface IChainValidator extends IAddressValidator, ITokenValidator, IAmountValidator {
|
|
19
|
+
validateSourceChain(order: OrderInput): Promise<void>;
|
|
20
|
+
validateDestinationChain(order: OrderInput): void;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* CommonValidator - Handles validations shared across chains
|
|
24
|
+
*/
|
|
25
|
+
export declare class CommonValidator implements IDeadlineValidator, ICrossChainValidator {
|
|
26
|
+
isValidDeadline(deadline: number): boolean;
|
|
27
|
+
validateDeadline(deadline: number): void;
|
|
28
|
+
isValidCrossChain(sourceChainId: SupportedChain, destinationChainId: SupportedChain): boolean;
|
|
29
|
+
validateCrossChain(sourceChainId: SupportedChain, destinationChainId: SupportedChain): void;
|
|
30
|
+
}
|
|
31
|
+
export declare class ValidatorFactory {
|
|
32
|
+
private static validators;
|
|
33
|
+
static getValidator(chainType: ChainType): IChainValidator;
|
|
34
|
+
static getValidatorForChain(chainId: SupportedChain): IChainValidator;
|
|
35
|
+
}
|
|
36
|
+
export declare class OrderValidator {
|
|
37
|
+
private readonly commonValidator;
|
|
38
|
+
validateOrder(order: OrderInput): Promise<void>;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=order-validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"order-validator.d.ts","sourceRoot":"","sources":["../../../src/utils/order-validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAyB,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAErF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAKnD,MAAM,WAAW,iBAAiB;IAChC,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1C;AAED,MAAM,WAAW,eAAe;IAC9B,mBAAmB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC;CACpD;AAED,MAAM,WAAW,gBAAgB;IAC/B,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;CACxC;AAED,MAAM,WAAW,kBAAkB;IACjC,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5C;AAED,MAAM,WAAW,oBAAoB;IACnC,iBAAiB,CAAC,aAAa,EAAE,cAAc,EAAE,kBAAkB,EAAE,cAAc,GAAG,OAAO,CAAC;CAC/F;AAED,MAAM,WAAW,eAAgB,SAAQ,iBAAiB,EAAE,eAAe,EAAE,gBAAgB;IAC3F,mBAAmB,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtD,wBAAwB,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CAAC;CACnD;AAED;;GAEG;AACH,qBAAa,eAAgB,YAAW,kBAAkB,EAAE,oBAAoB;IAC9E,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAI1C,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAMxC,iBAAiB,CAAC,aAAa,EAAE,cAAc,EAAE,kBAAkB,EAAE,cAAc,GAAG,OAAO;IAI7F,kBAAkB,CAAC,aAAa,EAAE,cAAc,EAAE,kBAAkB,EAAE,cAAc,GAAG,IAAI;CAK5F;AAED,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,MAAM,CAAC,UAAU,CAA8C;IAEvE,MAAM,CAAC,YAAY,CAAC,SAAS,EAAE,SAAS,GAAG,eAAe;IAoB1D,MAAM,CAAC,oBAAoB,CAAC,OAAO,EAAE,cAAc,GAAG,eAAe;CAItE;AAED,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAyB;IAEnD,aAAa,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;CAatD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parsers.d.ts","sourceRoot":"","sources":["../../../src/utils/parsers.ts"],"names":[],"mappings":"AAEA,yBAAiB,OAAO,CAAC;IAEvB,SAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,GAAG,CAE5D;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-utils.d.ts","sourceRoot":"","sources":["../../../src/utils/type-utils.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,CAAC,SAAS,IAAI,SAAS,SAAS,SAAS,OAAO,EAAE,GAAG,SAAS,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@shogun-sdk/intents-sdk",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Shogun Network Intent-based cross-chain swaps SDK",
|
|
6
|
+
"author": "Shogun network",
|
|
7
|
+
"license": "ISC",
|
|
8
|
+
"publishConfig": {
|
|
9
|
+
"access": "public"
|
|
10
|
+
},
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "https://github.com/shogun-network/shogun-sdk.git"
|
|
14
|
+
},
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"types": "./dist/_types/index.d.ts",
|
|
18
|
+
"default": "./dist/_esm/index.js"
|
|
19
|
+
},
|
|
20
|
+
"./package.json": "./package.json"
|
|
21
|
+
},
|
|
22
|
+
"module": "./dist/_esm/index.js",
|
|
23
|
+
"types": "./dist/_types/index.d.ts",
|
|
24
|
+
"typings": "./dist/_types/index.d.ts",
|
|
25
|
+
"sideEffects": false,
|
|
26
|
+
"files": [
|
|
27
|
+
"dist/**",
|
|
28
|
+
"!dist/**/*.tsbuildinfo",
|
|
29
|
+
"src/**/*.ts",
|
|
30
|
+
"!src/**/*.test.ts",
|
|
31
|
+
"!src/**/*.test-d.ts",
|
|
32
|
+
"README.md"
|
|
33
|
+
],
|
|
34
|
+
"keywords": [
|
|
35
|
+
"shogun",
|
|
36
|
+
"swap",
|
|
37
|
+
"sdk",
|
|
38
|
+
"api",
|
|
39
|
+
"typescript"
|
|
40
|
+
],
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@types/node": "22.13.10",
|
|
43
|
+
"typescript": "5.8.2"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@mysten/sui": "^1.29.1",
|
|
47
|
+
"@solana-program/system": "^0.7.0",
|
|
48
|
+
"@solana-program/token": "^0.5.1",
|
|
49
|
+
"@solana/kit": "^2.1.0",
|
|
50
|
+
"viem": "^2.26.2"
|
|
51
|
+
},
|
|
52
|
+
"scripts": {
|
|
53
|
+
"build": "pnpm clean && pnpm build:esm && pnpm build:types",
|
|
54
|
+
"build:esm": "tsc --project ./tsconfig.build.json --module es2015 --outDir ./dist/_esm && printf '{\"type\": \"module\",\"sideEffects\":false}' > ./dist/_esm/package.json",
|
|
55
|
+
"build:types": "tsc --project ./tsconfig.build.json --module esnext --declarationDir ./dist/_types --emitDeclarationOnly --declaration --declarationMap",
|
|
56
|
+
"clean": "rm -rf ./dist",
|
|
57
|
+
"check:types": "tsc --noEmit",
|
|
58
|
+
"lint": "npx eslint --fix --ext .ts ./src",
|
|
59
|
+
"format": "prettier --write ./src",
|
|
60
|
+
"pre-publish": "pnpm node ./scripts/prePublish.js"
|
|
61
|
+
}
|
|
62
|
+
}
|
package/src/chains.ts
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { TupleToUnion } from './utils/type-utils.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Represents the blockchain platform type
|
|
5
|
+
* Used to distinguish between different blockchain ecosystems
|
|
6
|
+
*/
|
|
7
|
+
export enum ChainType {
|
|
8
|
+
EVM = 'EVM',
|
|
9
|
+
Solana = 'Solana',
|
|
10
|
+
Sui = 'Sui',
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Enum of chain IDs for supported blockchains
|
|
15
|
+
* EVM chains use their standard chain IDs
|
|
16
|
+
* Non-EVM chains use custom assigned IDs
|
|
17
|
+
*/
|
|
18
|
+
export enum ChainID {
|
|
19
|
+
Arbitrum = 42161,
|
|
20
|
+
Optimism = 10,
|
|
21
|
+
Base = 8453,
|
|
22
|
+
Solana = 7565164,
|
|
23
|
+
Sui = 101,
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Array of chain IDs that are supported by the SDK
|
|
28
|
+
* Used as a source of truth for type generation
|
|
29
|
+
*/
|
|
30
|
+
export const SupportedChains = [ChainID.Arbitrum, ChainID.Base, ChainID.Optimism, ChainID.Solana, ChainID.Sui] as const;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Type utility to identify chains not in the SupportedChains array
|
|
34
|
+
* @internal
|
|
35
|
+
*/
|
|
36
|
+
type UnsupportedChain = Exclude<ChainID, TupleToUnion<typeof SupportedChains>>;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Type representing chains that are supported by the SDK
|
|
40
|
+
* Derived from the SupportedChains array
|
|
41
|
+
*/
|
|
42
|
+
export type SupportedChain = Exclude<ChainID, UnsupportedChain>;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Type representing EVM chains that are supported by the SDK
|
|
46
|
+
* Includes Arbitrum, Base, and Optimism
|
|
47
|
+
*/
|
|
48
|
+
export type SupportedEvmChain = Exclude<ChainID, TupleToUnion<[ChainID.Solana, ChainID.Sui]>>;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Type alias for Solana chain ID
|
|
52
|
+
*/
|
|
53
|
+
export type SupportedSolanaChain = ChainID.Solana;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Type alias for Sui chain ID
|
|
57
|
+
*/
|
|
58
|
+
export type SupportedSuiChain = ChainID.Sui;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Type guard that checks if a chain ID is among the supported chains
|
|
62
|
+
* @param chain - The chain ID to check
|
|
63
|
+
* @returns Boolean indicating if the chain is supported
|
|
64
|
+
*/
|
|
65
|
+
export const isSupportedChain = (chain: unknown): chain is SupportedChain => SupportedChains.includes(chain as number);
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Maps chain IDs to their corresponding chain types
|
|
69
|
+
* Used to determine which SDK implementation to use for a given chain
|
|
70
|
+
*/
|
|
71
|
+
export const chainIdToChainTypeMap = {
|
|
72
|
+
[ChainID.Arbitrum]: ChainType.EVM,
|
|
73
|
+
[ChainID.Base]: ChainType.EVM,
|
|
74
|
+
[ChainID.Optimism]: ChainType.EVM,
|
|
75
|
+
[ChainID.Solana]: ChainType.Solana,
|
|
76
|
+
[ChainID.Sui]: ChainType.Sui,
|
|
77
|
+
} as const;
|
package/src/config.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { SupportedEvmChain } from './chains.js';
|
|
2
|
+
|
|
3
|
+
export type EVMConfig = {
|
|
4
|
+
chainId: SupportedEvmChain;
|
|
5
|
+
rpcProviderUrl?: string;
|
|
6
|
+
privateKey: `0x${string}`;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export type SolanaConfig = {
|
|
10
|
+
rpcProviderUrl?: string;
|
|
11
|
+
privateKey: string;
|
|
12
|
+
/**
|
|
13
|
+
* Transaction confirmation level
|
|
14
|
+
* - 'confirmed': Transaction has been processed and confirmed by the cluster
|
|
15
|
+
* - 'finalized': Transaction has been finalized and cannot be rolled back
|
|
16
|
+
*/
|
|
17
|
+
commitment: 'confirmed' | 'finalized';
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export type SuiConfig = {
|
|
21
|
+
privateKey: string;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export type SDKConfigParams = EVMConfig | SolanaConfig | SuiConfig;
|
package/src/constants.ts
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { address, type Address as SolanaAddress } from '@solana/kit';
|
|
2
|
+
import type { Address, Hex } from 'viem';
|
|
3
|
+
import type { SupportedChain, SupportedEvmChain } from './chains.js';
|
|
4
|
+
import { ChainID } from './chains.js';
|
|
5
|
+
|
|
6
|
+
export const PERMIT2_ADDRESS: Record<SupportedEvmChain, Address> = {
|
|
7
|
+
[ChainID.Arbitrum]: '0x000000000022d473030f116ddee9f6b43ac78ba3' as Address,
|
|
8
|
+
[ChainID.Optimism]: '0x000000000022d473030f116ddee9f6b43ac78ba3' as Address,
|
|
9
|
+
[ChainID.Base]: '0x000000000022d473030f116ddee9f6b43ac78ba3' as Address,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
// export const SRC_CHAIN_GUARD: Record<SupportedChain, SolanaAddress | Hex> = {
|
|
13
|
+
// [ChainID.Arbitrum]: '0x921ab91ee3dc38fd47aefd6218fd6b0bd9d64c18' as Address,
|
|
14
|
+
// [ChainID.Optimism]: '0xa89b2aae94769bf4a5dc9982eabe2c513564d1ea' as Address,
|
|
15
|
+
// [ChainID.Base]: '0x5173e9f12e2485f990ce4dac877d8545fb4ec81a' as Address,
|
|
16
|
+
// [ChainID.Solana]: address('4kD6otCKkKZQej8YNQkWdzG9xMo5XYN8T1BbUrJUE63E'),
|
|
17
|
+
// [ChainID.Sui]:
|
|
18
|
+
// '0x88a47715f41c5e47ff6d6dcfc0285f3802ae1587a9f411d0daff20269245a1b0',
|
|
19
|
+
// }
|
|
20
|
+
|
|
21
|
+
export const SRC_CHAIN_GUARD: Record<SupportedChain, SolanaAddress | Hex> = {
|
|
22
|
+
[ChainID.Arbitrum]: '0x8cfacbe4e236c0ca0a7b4b9fc5b696aa9f07cc41' as Address,
|
|
23
|
+
[ChainID.Optimism]: '0x66fbcccbd3ffe2d347bc2776ef8a6561ff29998e' as Address,
|
|
24
|
+
[ChainID.Base]: '0xa895a53634854756ae8e902065e3be26ee36381d' as Address,
|
|
25
|
+
[ChainID.Solana]: address('FAKnXTY7cNz9wMTpH1wwsU9a1xzBAiMwAn2NXmGMLynP'),
|
|
26
|
+
[ChainID.Sui]: '0xd5057237ba5fe3d9aa00bb2a1555c3d3de77fd5653e72ce70f4aa0561fa9f04d',
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
// export const SRC_CHAIN_GUARD_TEST: Record<SupportedChain, SolanaAddress | Hex> =
|
|
30
|
+
// {
|
|
31
|
+
// [ChainID.Arbitrum]: '0x8cfacbe4e236c0ca0a7b4b9fc5b696aa9f07cc41' as Address,
|
|
32
|
+
// [ChainID.Optimism]: '0x66fbcccbd3ffe2d347bc2776ef8a6561ff29998e' as Address,
|
|
33
|
+
// [ChainID.Base]: '0xa895a53634854756ae8e902065e3be26ee36381d' as Address,
|
|
34
|
+
// [ChainID.Solana]: address('FAKnXTY7cNz9wMTpH1wwsU9a1xzBAiMwAn2NXmGMLynP'),
|
|
35
|
+
// [ChainID.Sui]:
|
|
36
|
+
// '0xd5057237ba5fe3d9aa00bb2a1555c3d3de77fd5653e72ce70f4aa0561fa9f04d',
|
|
37
|
+
// }
|
|
38
|
+
|
|
39
|
+
export const NATIVE_SOLANA_TOKEN_ADDRESS = address('So11111111111111111111111111111111111111111');
|
|
40
|
+
|
|
41
|
+
export const WRAPPED_SOL_MINT_ADDRESS = address('So11111111111111111111111111111111111111112');
|
|
42
|
+
|
|
43
|
+
export const SUI_PACKAGE_ID = '0x6273e29f803ff5851f89ec17d40d5b1f367476e1677ad0a52ca408f64c4473fe';
|
|
44
|
+
|
|
45
|
+
// export const TEST_SUI_PACKAGE_ID = '0x6273e29f803ff5851f89ec17d40d5b1f367476e1677ad0a52ca408f64c4473fe'
|
|
46
|
+
|
|
47
|
+
export const SUI_GUARD_COLLATERAL_TYPE =
|
|
48
|
+
'0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC';
|
|
49
|
+
|
|
50
|
+
export const SUI_GUARD_STABLECOIN_TYPE =
|
|
51
|
+
'0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC';
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* URL of the auctioneer service endpoint
|
|
55
|
+
*/
|
|
56
|
+
// export const AUCTIONEER_URL = 'https://auctioneer-825534211396.us-central1.run.app'
|
|
57
|
+
export const AUCTIONEER_URL = 'http://127.0.0.1:8080';
|
|
58
|
+
|
|
59
|
+
export const MAX_UINT_64 = 2n ** 64n - 1n;
|
|
60
|
+
export const MAX_UINT_128 = 2n ** 128n - 1n;
|
|
61
|
+
export const MAX_UINT_256 = 2n ** 256n - 1n;
|