@shogun-sdk/intents-sdk 1.2.6-test → 1.2.6-test.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/chains.js +1 -1
- package/dist/esm/constants.js.map +1 -1
- package/dist/esm/core/evm/cross-chain-limit-order.js +11 -11
- package/dist/esm/core/evm/cross-chain-limit-order.js.map +1 -1
- package/dist/esm/core/evm/intent-helpers.js +1 -1
- package/dist/esm/core/evm/intent-helpers.js.map +1 -1
- package/dist/esm/core/evm/single-chain-dca-order.js +15 -15
- package/dist/esm/core/evm/single-chain-dca-order.js.map +1 -1
- package/dist/esm/core/evm/single-chain-limit-order.js +12 -12
- package/dist/esm/core/evm/single-chain-limit-order.js.map +1 -1
- package/dist/esm/core/evm/types.js +3 -3
- package/dist/esm/core/solana/client.js +1 -1
- package/dist/esm/core/solana/client.js.map +1 -1
- package/dist/esm/core/solana/dca/single-chain-dca-order.js +8 -9
- package/dist/esm/core/solana/dca/single-chain-dca-order.js.map +1 -1
- package/dist/esm/core/solana/dca/single-chain-limit-order.js +9 -10
- package/dist/esm/core/solana/dca/single-chain-limit-order.js.map +1 -1
- package/dist/esm/core/solana/generated/cross-chain/accounts/adminSingleton.js +1 -3
- package/dist/esm/core/solana/generated/cross-chain/accounts/adminSingleton.js.map +1 -1
- package/dist/esm/core/solana/generated/cross-chain/errors/sourceChainGuard.js.map +1 -1
- package/dist/esm/core/solana/generated/cross-chain/instructions/acceptAdmin.js +4 -1
- package/dist/esm/core/solana/generated/cross-chain/instructions/acceptAdmin.js.map +1 -1
- package/dist/esm/core/solana/generated/cross-chain/instructions/cancelDcaOrder.js +5 -4
- package/dist/esm/core/solana/generated/cross-chain/instructions/cancelDcaOrder.js.map +1 -1
- package/dist/esm/core/solana/generated/cross-chain/instructions/cancelOrder.js +4 -1
- package/dist/esm/core/solana/generated/cross-chain/instructions/cancelOrder.js.map +1 -1
- package/dist/esm/core/solana/generated/cross-chain/instructions/claimTokens.js +4 -1
- package/dist/esm/core/solana/generated/cross-chain/instructions/claimTokens.js.map +1 -1
- package/dist/esm/core/solana/generated/cross-chain/instructions/collectProtocolFees.js +5 -4
- package/dist/esm/core/solana/generated/cross-chain/instructions/collectProtocolFees.js.map +1 -1
- package/dist/esm/core/solana/generated/cross-chain/instructions/createDcaOrder.js +2 -4
- package/dist/esm/core/solana/generated/cross-chain/instructions/createDcaOrder.js.map +1 -1
- package/dist/esm/core/solana/generated/cross-chain/instructions/createGuard.js +3 -5
- package/dist/esm/core/solana/generated/cross-chain/instructions/createGuard.js.map +1 -1
- package/dist/esm/core/solana/generated/cross-chain/instructions/createOrder.js +2 -4
- package/dist/esm/core/solana/generated/cross-chain/instructions/createOrder.js.map +1 -1
- package/dist/esm/core/solana/generated/cross-chain/instructions/initialize.js +6 -5
- package/dist/esm/core/solana/generated/cross-chain/instructions/initialize.js.map +1 -1
- package/dist/esm/core/solana/generated/cross-chain/instructions/preStartOrderExecution.js +5 -4
- package/dist/esm/core/solana/generated/cross-chain/instructions/preStartOrderExecution.js.map +1 -1
- package/dist/esm/core/solana/generated/cross-chain/instructions/setAdmin.js +1 -1
- package/dist/esm/core/solana/generated/cross-chain/instructions/setAdmin.js.map +1 -1
- package/dist/esm/core/solana/generated/cross-chain/instructions/setAuctioneerPubKey.js +4 -14
- package/dist/esm/core/solana/generated/cross-chain/instructions/setAuctioneerPubKey.js.map +1 -1
- package/dist/esm/core/solana/generated/cross-chain/instructions/startOrderExecution.js +5 -4
- package/dist/esm/core/solana/generated/cross-chain/instructions/startOrderExecution.js.map +1 -1
- package/dist/esm/core/solana/generated/cross-chain/instructions/startOrderExecutionAfterSwap.js +1 -3
- package/dist/esm/core/solana/generated/cross-chain/instructions/startOrderExecutionAfterSwap.js.map +1 -1
- package/dist/esm/core/solana/generated/cross-chain/programs/sourceChainGuard.js +1 -1
- package/dist/esm/core/solana/generated/cross-chain/programs/sourceChainGuard.js.map +1 -1
- package/dist/esm/core/solana/generated/cross-chain/shared/index.js +2 -2
- package/dist/esm/core/solana/generated/cross-chain/shared/index.js.map +1 -1
- package/dist/esm/core/solana/generated/cross-chain/types/adminUpdateStarted.js.map +1 -1
- package/dist/esm/core/solana/generated/cross-chain/types/dcaExecutionStarted.js.map +1 -1
- package/dist/esm/core/solana/generated/cross-chain/types/dcaTokenInSwapped.js.map +1 -1
- package/dist/esm/core/solana/generated/cross-chain/types/failedDcaIntervalExecution.js.map +1 -1
- package/dist/esm/core/solana/generated/single-chain/accounts/adminSingleton.js +1 -3
- package/dist/esm/core/solana/generated/single-chain/accounts/adminSingleton.js.map +1 -1
- package/dist/esm/core/solana/generated/single-chain/errors/singleChainGuard.js.map +1 -1
- package/dist/esm/core/solana/generated/single-chain/instructions/acceptAdmin.js +4 -1
- package/dist/esm/core/solana/generated/single-chain/instructions/acceptAdmin.js.map +1 -1
- package/dist/esm/core/solana/generated/single-chain/instructions/cancelDcaOrder.js +5 -4
- package/dist/esm/core/solana/generated/single-chain/instructions/cancelDcaOrder.js.map +1 -1
- package/dist/esm/core/solana/generated/single-chain/instructions/cancelLimitOrder.js +5 -4
- package/dist/esm/core/solana/generated/single-chain/instructions/cancelLimitOrder.js.map +1 -1
- package/dist/esm/core/solana/generated/single-chain/instructions/collectProtocolFees.js +5 -4
- package/dist/esm/core/solana/generated/single-chain/instructions/collectProtocolFees.js.map +1 -1
- package/dist/esm/core/solana/generated/single-chain/instructions/createDcaOrder.js +2 -4
- package/dist/esm/core/solana/generated/single-chain/instructions/createDcaOrder.js.map +1 -1
- package/dist/esm/core/solana/generated/single-chain/instructions/createGuard.js +3 -5
- package/dist/esm/core/solana/generated/single-chain/instructions/createGuard.js.map +1 -1
- package/dist/esm/core/solana/generated/single-chain/instructions/createLimitOrder.js +2 -4
- package/dist/esm/core/solana/generated/single-chain/instructions/createLimitOrder.js.map +1 -1
- package/dist/esm/core/solana/generated/single-chain/instructions/fulfillDcaOrderInterval.js +2 -5
- package/dist/esm/core/solana/generated/single-chain/instructions/fulfillDcaOrderInterval.js.map +1 -1
- package/dist/esm/core/solana/generated/single-chain/instructions/fulfillLimitOrder.js +2 -5
- package/dist/esm/core/solana/generated/single-chain/instructions/fulfillLimitOrder.js.map +1 -1
- package/dist/esm/core/solana/generated/single-chain/instructions/initialize.js +6 -5
- package/dist/esm/core/solana/generated/single-chain/instructions/initialize.js.map +1 -1
- package/dist/esm/core/solana/generated/single-chain/instructions/setAdmin.js +1 -1
- package/dist/esm/core/solana/generated/single-chain/instructions/setAdmin.js.map +1 -1
- package/dist/esm/core/solana/generated/single-chain/instructions/setAuctioneerPubKey.js +4 -14
- package/dist/esm/core/solana/generated/single-chain/instructions/setAuctioneerPubKey.js.map +1 -1
- package/dist/esm/core/solana/generated/single-chain/programs/singleChainGuard.js +1 -1
- package/dist/esm/core/solana/generated/single-chain/programs/singleChainGuard.js.map +1 -1
- package/dist/esm/core/solana/generated/single-chain/shared/index.js +2 -2
- package/dist/esm/core/solana/generated/single-chain/shared/index.js.map +1 -1
- package/dist/esm/core/solana/generated/single-chain/types/adminUpdateStarted.js.map +1 -1
- package/dist/esm/core/solana/generated/single-chain/types/dcaOrderFulfilled.js.map +1 -1
- package/dist/esm/core/solana/generated/single-chain/types/limitOrderCreated.js.map +1 -1
- package/dist/esm/core/solana/generated/single-chain/types/limitOrderFulfilled.js.map +1 -1
- package/dist/esm/core/solana/intent-helpers.js +3 -3
- package/dist/esm/core/solana/intent-helpers.js.map +1 -1
- package/dist/esm/core/solana/utils.js +4 -7
- package/dist/esm/core/solana/utils.js.map +1 -1
- package/dist/esm/core/sui/cross-chain-limit-order.js +1 -3
- package/dist/esm/core/sui/cross-chain-limit-order.js.map +1 -1
- package/dist/esm/core/sui/intent-helpers.js.map +1 -1
- package/dist/esm/core/sui/single-chain-dca-order.js +9 -21
- package/dist/esm/core/sui/single-chain-dca-order.js.map +1 -1
- package/dist/esm/core/sui/single-chain-limit-order.js +10 -24
- package/dist/esm/core/sui/single-chain-limit-order.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/api.js.map +1 -1
- package/dist/esm/utils/generate-execution-details-hash.js +3 -3
- package/dist/esm/utils/generate-execution-details-hash.js.map +1 -1
- package/dist/esm/utils/quote/aggregator.js +71 -52
- package/dist/esm/utils/quote/aggregator.js.map +1 -1
- package/dist/esm/utils/quote/liquidswap.js +34 -9
- package/dist/esm/utils/quote/liquidswap.js.map +1 -1
- package/dist/esm/utils/quote/stablecoins-tokens.js +31 -9
- package/dist/esm/utils/quote/stablecoins-tokens.js.map +1 -1
- package/dist/types/constants.d.ts.map +1 -1
- package/dist/types/core/evm/cross-chain-limit-order.d.ts +1 -1
- package/dist/types/core/evm/intent-helpers.d.ts.map +1 -1
- package/dist/types/core/evm/single-chain-dca-order.d.ts +2 -2
- package/dist/types/core/evm/single-chain-limit-order.d.ts +2 -2
- package/dist/types/core/evm/types.d.ts +1 -1
- package/dist/types/core/solana/dca/single-chain-dca-order.d.ts +2 -2
- package/dist/types/core/solana/dca/single-chain-dca-order.d.ts.map +1 -1
- package/dist/types/core/solana/dca/single-chain-limit-order.d.ts +1 -1
- package/dist/types/core/solana/dca/single-chain-limit-order.d.ts.map +1 -1
- package/dist/types/core/solana/generated/cross-chain/accounts/adminSingleton.d.ts.map +1 -1
- package/dist/types/core/solana/generated/cross-chain/errors/sourceChainGuard.d.ts.map +1 -1
- package/dist/types/core/solana/generated/cross-chain/instructions/acceptAdmin.d.ts.map +1 -1
- package/dist/types/core/solana/generated/cross-chain/instructions/cancelDcaOrder.d.ts.map +1 -1
- package/dist/types/core/solana/generated/cross-chain/instructions/cancelOrder.d.ts.map +1 -1
- package/dist/types/core/solana/generated/cross-chain/instructions/claimTokens.d.ts.map +1 -1
- package/dist/types/core/solana/generated/cross-chain/instructions/collectProtocolFees.d.ts.map +1 -1
- package/dist/types/core/solana/generated/cross-chain/instructions/createDcaOrder.d.ts.map +1 -1
- package/dist/types/core/solana/generated/cross-chain/instructions/createGuard.d.ts.map +1 -1
- package/dist/types/core/solana/generated/cross-chain/instructions/createOrder.d.ts.map +1 -1
- package/dist/types/core/solana/generated/cross-chain/instructions/initialize.d.ts.map +1 -1
- package/dist/types/core/solana/generated/cross-chain/instructions/preStartOrderExecution.d.ts.map +1 -1
- package/dist/types/core/solana/generated/cross-chain/instructions/setAdmin.d.ts.map +1 -1
- package/dist/types/core/solana/generated/cross-chain/instructions/setAuctioneerPubKey.d.ts.map +1 -1
- package/dist/types/core/solana/generated/cross-chain/instructions/startOrderExecution.d.ts.map +1 -1
- package/dist/types/core/solana/generated/cross-chain/instructions/startOrderExecutionAfterSwap.d.ts.map +1 -1
- package/dist/types/core/solana/generated/cross-chain/programs/sourceChainGuard.d.ts.map +1 -1
- package/dist/types/core/solana/generated/cross-chain/shared/index.d.ts.map +1 -1
- package/dist/types/core/solana/generated/cross-chain/types/adminUpdateStarted.d.ts.map +1 -1
- package/dist/types/core/solana/generated/cross-chain/types/dcaExecutionStarted.d.ts.map +1 -1
- package/dist/types/core/solana/generated/cross-chain/types/dcaTokenInSwapped.d.ts.map +1 -1
- package/dist/types/core/solana/generated/cross-chain/types/failedDcaIntervalExecution.d.ts.map +1 -1
- package/dist/types/core/solana/generated/single-chain/accounts/adminSingleton.d.ts.map +1 -1
- package/dist/types/core/solana/generated/single-chain/errors/singleChainGuard.d.ts.map +1 -1
- package/dist/types/core/solana/generated/single-chain/instructions/acceptAdmin.d.ts.map +1 -1
- package/dist/types/core/solana/generated/single-chain/instructions/cancelDcaOrder.d.ts.map +1 -1
- package/dist/types/core/solana/generated/single-chain/instructions/cancelLimitOrder.d.ts.map +1 -1
- package/dist/types/core/solana/generated/single-chain/instructions/collectProtocolFees.d.ts.map +1 -1
- package/dist/types/core/solana/generated/single-chain/instructions/createDcaOrder.d.ts.map +1 -1
- package/dist/types/core/solana/generated/single-chain/instructions/createGuard.d.ts.map +1 -1
- package/dist/types/core/solana/generated/single-chain/instructions/createLimitOrder.d.ts.map +1 -1
- package/dist/types/core/solana/generated/single-chain/instructions/fulfillDcaOrderInterval.d.ts.map +1 -1
- package/dist/types/core/solana/generated/single-chain/instructions/fulfillLimitOrder.d.ts.map +1 -1
- package/dist/types/core/solana/generated/single-chain/instructions/initialize.d.ts.map +1 -1
- package/dist/types/core/solana/generated/single-chain/instructions/setAdmin.d.ts.map +1 -1
- package/dist/types/core/solana/generated/single-chain/instructions/setAuctioneerPubKey.d.ts.map +1 -1
- package/dist/types/core/solana/generated/single-chain/programs/singleChainGuard.d.ts.map +1 -1
- package/dist/types/core/solana/generated/single-chain/shared/index.d.ts.map +1 -1
- package/dist/types/core/solana/generated/single-chain/types/adminUpdateStarted.d.ts.map +1 -1
- package/dist/types/core/solana/generated/single-chain/types/dcaOrderFulfilled.d.ts.map +1 -1
- package/dist/types/core/solana/generated/single-chain/types/limitOrderCreated.d.ts.map +1 -1
- package/dist/types/core/solana/generated/single-chain/types/limitOrderFulfilled.d.ts.map +1 -1
- package/dist/types/core/solana/intent-helpers.d.ts.map +1 -1
- package/dist/types/core/solana/utils.d.ts.map +1 -1
- package/dist/types/core/sui/cross-chain-limit-order.d.ts.map +1 -1
- package/dist/types/core/sui/intent-helpers.d.ts.map +1 -1
- package/dist/types/core/sui/single-chain-dca-order.d.ts.map +1 -1
- package/dist/types/core/sui/single-chain-limit-order.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/types/api.d.ts +10 -1
- package/dist/types/types/api.d.ts.map +1 -1
- package/dist/types/types/intent.d.ts.map +1 -1
- package/dist/types/utils/generate-execution-details-hash.d.ts +1 -1
- package/dist/types/utils/generate-execution-details-hash.d.ts.map +1 -1
- package/dist/types/utils/quote/aggregator.d.ts +0 -2
- package/dist/types/utils/quote/aggregator.d.ts.map +1 -1
- package/dist/types/utils/quote/liquidswap.d.ts +4 -2
- package/dist/types/utils/quote/liquidswap.d.ts.map +1 -1
- package/dist/types/utils/quote/stablecoins-tokens.d.ts +4 -1
- package/dist/types/utils/quote/stablecoins-tokens.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/chains.ts +2 -2
- package/src/constants.ts +5 -5
- package/src/core/evm/cross-chain-limit-order.ts +14 -14
- package/src/core/evm/intent-helpers.ts +14 -8
- package/src/core/evm/single-chain-dca-order.ts +18 -18
- package/src/core/evm/single-chain-limit-order.ts +15 -15
- package/src/core/evm/types.ts +4 -4
- package/src/core/solana/client.ts +1 -1
- package/src/core/solana/dca/single-chain-dca-order.ts +18 -21
- package/src/core/solana/dca/single-chain-limit-order.ts +19 -22
- package/src/core/solana/generated/cross-chain/accounts/adminSingleton.ts +9 -11
- package/src/core/solana/generated/cross-chain/accounts/dcaOrder.ts +8 -8
- package/src/core/solana/generated/cross-chain/accounts/guard.ts +8 -8
- package/src/core/solana/generated/cross-chain/accounts/order.ts +8 -8
- package/src/core/solana/generated/cross-chain/errors/sourceChainGuard.ts +2 -7
- package/src/core/solana/generated/cross-chain/instructions/acceptAdmin.ts +10 -20
- package/src/core/solana/generated/cross-chain/instructions/cancelDcaOrder.ts +13 -31
- package/src/core/solana/generated/cross-chain/instructions/cancelOrder.ts +8 -16
- package/src/core/solana/generated/cross-chain/instructions/claimTokens.ts +9 -19
- package/src/core/solana/generated/cross-chain/instructions/collectProtocolFees.ts +10 -19
- package/src/core/solana/generated/cross-chain/instructions/createDcaOrder.ts +14 -36
- package/src/core/solana/generated/cross-chain/instructions/createGuard.ts +12 -33
- package/src/core/solana/generated/cross-chain/instructions/createOrder.ts +12 -30
- package/src/core/solana/generated/cross-chain/instructions/initialize.ts +14 -29
- package/src/core/solana/generated/cross-chain/instructions/preStartOrderExecution.ts +11 -21
- package/src/core/solana/generated/cross-chain/instructions/setAdmin.ts +8 -23
- package/src/core/solana/generated/cross-chain/instructions/setAuctioneerPubKey.ts +16 -64
- package/src/core/solana/generated/cross-chain/instructions/startOrderExecution.ts +9 -18
- package/src/core/solana/generated/cross-chain/instructions/startOrderExecutionAfterSwap.ts +8 -16
- package/src/core/solana/generated/cross-chain/programs/sourceChainGuard.ts +40 -83
- package/src/core/solana/generated/cross-chain/shared/index.ts +7 -16
- package/src/core/solana/generated/cross-chain/types/adminUpdateStarted.ts +1 -4
- package/src/core/solana/generated/cross-chain/types/dcaExecutionStarted.ts +1 -4
- package/src/core/solana/generated/cross-chain/types/dcaTokenInSwapped.ts +1 -4
- package/src/core/solana/generated/cross-chain/types/failedDcaIntervalExecution.ts +1 -4
- package/src/core/solana/generated/single-chain/accounts/adminSingleton.ts +9 -11
- package/src/core/solana/generated/single-chain/accounts/dcaOrder.ts +8 -8
- package/src/core/solana/generated/single-chain/accounts/guard.ts +8 -8
- package/src/core/solana/generated/single-chain/accounts/limitOrder.ts +8 -8
- package/src/core/solana/generated/single-chain/errors/singleChainGuard.ts +2 -7
- package/src/core/solana/generated/single-chain/instructions/acceptAdmin.ts +10 -20
- package/src/core/solana/generated/single-chain/instructions/cancelDcaOrder.ts +11 -25
- package/src/core/solana/generated/single-chain/instructions/cancelLimitOrder.ts +11 -25
- package/src/core/solana/generated/single-chain/instructions/collectProtocolFees.ts +12 -25
- package/src/core/solana/generated/single-chain/instructions/createDcaOrder.ts +14 -36
- package/src/core/solana/generated/single-chain/instructions/createGuard.ts +15 -42
- package/src/core/solana/generated/single-chain/instructions/createLimitOrder.ts +14 -36
- package/src/core/solana/generated/single-chain/instructions/fulfillDcaOrderInterval.ts +15 -38
- package/src/core/solana/generated/single-chain/instructions/fulfillLimitOrder.ts +15 -41
- package/src/core/solana/generated/single-chain/instructions/initialize.ts +14 -29
- package/src/core/solana/generated/single-chain/instructions/setAdmin.ts +8 -23
- package/src/core/solana/generated/single-chain/instructions/setAuctioneerPubKey.ts +16 -64
- package/src/core/solana/generated/single-chain/programs/singleChainGuard.ts +36 -75
- package/src/core/solana/generated/single-chain/shared/index.ts +7 -16
- package/src/core/solana/generated/single-chain/types/adminUpdateStarted.ts +1 -4
- package/src/core/solana/generated/single-chain/types/dcaOrderFulfilled.ts +1 -4
- package/src/core/solana/generated/single-chain/types/limitOrderCreated.ts +1 -4
- package/src/core/solana/generated/single-chain/types/limitOrderFulfilled.ts +1 -4
- package/src/core/solana/intent-helpers.ts +20 -16
- package/src/core/solana/sdk.ts +1 -1
- package/src/core/solana/utils.ts +16 -19
- package/src/core/sui/cross-chain-limit-order.ts +1 -4
- package/src/core/sui/intent-helpers.ts +16 -25
- package/src/core/sui/order-transaction.ts +1 -1
- package/src/core/sui/single-chain-dca-order.ts +18 -31
- package/src/core/sui/single-chain-limit-order.ts +18 -33
- package/src/index.ts +2 -2
- package/src/types/api.ts +10 -1
- package/src/types/intent.ts +4 -2
- package/src/utils/generate-execution-details-hash.ts +25 -23
- package/src/utils/quote/aggregator.ts +92 -71
- package/src/utils/quote/liquidswap.ts +42 -13
- package/src/utils/quote/stablecoins-tokens.ts +31 -9
- package/dist/esm/core/evm/permit2-signature-transfer.js +0 -15
- package/dist/esm/core/evm/permit2-signature-transfer.js.map +0 -1
- package/dist/types/core/evm/permit2-signature-transfer.d.ts +0 -3
- package/dist/types/core/evm/permit2-signature-transfer.d.ts.map +0 -1
- package/src/core/evm/permit2-signature-transfer.ts +0 -15
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { ethers, type TypedDataField, type AddressLike, type BigNumberish } from
|
|
2
|
-
import { SignatureTransfer } from
|
|
1
|
+
import { ethers, type TypedDataField, type AddressLike, type BigNumberish } from 'ethers';
|
|
2
|
+
import { SignatureTransfer } from '@uniswap/permit2-sdk';
|
|
3
3
|
|
|
4
4
|
export const OrderInfoType: Record<string, TypedDataField[]> = {
|
|
5
5
|
OrderInfo: [
|
|
6
|
-
{ name:
|
|
7
|
-
{ name:
|
|
8
|
-
{ name:
|
|
9
|
-
{ name:
|
|
10
|
-
{ name:
|
|
11
|
-
{ name:
|
|
12
|
-
{ name:
|
|
13
|
-
{ name:
|
|
6
|
+
{ name: 'user', type: 'address' },
|
|
7
|
+
{ name: 'tokenIn', type: 'address' },
|
|
8
|
+
{ name: 'srcChainId', type: 'uint32' },
|
|
9
|
+
{ name: 'deadline', type: 'uint32' },
|
|
10
|
+
{ name: 'amountIn', type: 'uint128' },
|
|
11
|
+
{ name: 'minStablecoinsAmount', type: 'uint128' },
|
|
12
|
+
{ name: 'executionDetailsHash', type: 'bytes32' },
|
|
13
|
+
{ name: 'nonce', type: 'uint256' },
|
|
14
14
|
],
|
|
15
15
|
};
|
|
16
16
|
|
|
@@ -33,7 +33,7 @@ export async function signCrossChainLimitOrder(
|
|
|
33
33
|
orderInfo: OrderInfoStruct,
|
|
34
34
|
chainId: number,
|
|
35
35
|
guardAddress: string,
|
|
36
|
-
permit2Address: string
|
|
36
|
+
permit2Address: string,
|
|
37
37
|
): Promise<{
|
|
38
38
|
domain: any;
|
|
39
39
|
types: any;
|
|
@@ -54,9 +54,9 @@ export async function signCrossChainLimitOrder(
|
|
|
54
54
|
chainId,
|
|
55
55
|
{
|
|
56
56
|
witness: orderInfo,
|
|
57
|
-
witnessTypeName:
|
|
57
|
+
witnessTypeName: 'OrderInfo',
|
|
58
58
|
witnessType: OrderInfoType,
|
|
59
|
-
}
|
|
59
|
+
},
|
|
60
60
|
);
|
|
61
61
|
|
|
62
62
|
return {
|
|
@@ -70,7 +70,7 @@ export async function signCrossChainLimitOrder(
|
|
|
70
70
|
verifyingContract: permitData.domain.verifyingContract,
|
|
71
71
|
},
|
|
72
72
|
permitData.types,
|
|
73
|
-
permitData.values
|
|
73
|
+
permitData.values,
|
|
74
74
|
),
|
|
75
75
|
};
|
|
76
76
|
}
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import type { SupportedEvmChain } from '../../chains.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type {
|
|
3
|
+
SingleChainUserIntentRequest,
|
|
4
|
+
CrossChainUserIntentRequest,
|
|
5
|
+
DcaSingleChainUserIntentRequest,
|
|
6
|
+
} from '../../types/intent.js';
|
|
3
7
|
import type { SingleChainOrder } from '../orders/single-chain.js';
|
|
4
8
|
import type { CrossChainOrder } from '../orders/cross-chain.js';
|
|
5
9
|
import type { DcaSingleChainOrder } from '../orders/dca-single-chain.js';
|
|
6
10
|
import type { ExtraTransfer } from '../orders/common.js';
|
|
7
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
getEVMCrossChainOrderTypedData,
|
|
13
|
+
getEVMSingleChainOrderTypedData,
|
|
14
|
+
getEVMDcaSingleChainOrderTypedData,
|
|
15
|
+
} from './order-signature.js';
|
|
8
16
|
import { generateExecutionDetailsHash } from '../../utils/generate-execution-details-hash.js';
|
|
9
17
|
import { Parsers } from '../../utils/parsers.js';
|
|
10
18
|
|
|
@@ -65,7 +73,7 @@ export type CreateEvmCrossChainOrderIntentParams = {
|
|
|
65
73
|
* @returns Formatted intent request ready to send to auctioneer
|
|
66
74
|
*/
|
|
67
75
|
export function createEvmSingleChainLimitOrderIntentRequest(
|
|
68
|
-
params: CreateEvmSingleChainLimitOrderIntentParams
|
|
76
|
+
params: CreateEvmSingleChainLimitOrderIntentParams,
|
|
69
77
|
): SingleChainUserIntentRequest {
|
|
70
78
|
const order: SingleChainOrder = {
|
|
71
79
|
user: params.user,
|
|
@@ -98,7 +106,7 @@ export function createEvmSingleChainLimitOrderIntentRequest(
|
|
|
98
106
|
* @returns Formatted intent request ready to send to auctioneer
|
|
99
107
|
*/
|
|
100
108
|
export function createEvmSingleChainDcaOrderIntentRequest(
|
|
101
|
-
params: CreateEvmSingleChainDcaOrderIntentParams
|
|
109
|
+
params: CreateEvmSingleChainDcaOrderIntentParams,
|
|
102
110
|
): DcaSingleChainUserIntentRequest {
|
|
103
111
|
const order: DcaSingleChainOrder = {
|
|
104
112
|
user: params.user,
|
|
@@ -132,7 +140,7 @@ export function createEvmSingleChainDcaOrderIntentRequest(
|
|
|
132
140
|
* @returns Formatted intent request ready to send to auctioneer
|
|
133
141
|
*/
|
|
134
142
|
export function createEvmCrossChainOrderIntentRequest(
|
|
135
|
-
params: CreateEvmCrossChainOrderIntentParams
|
|
143
|
+
params: CreateEvmCrossChainOrderIntentParams,
|
|
136
144
|
): CrossChainUserIntentRequest {
|
|
137
145
|
const executionDetails = {
|
|
138
146
|
destChainId: params.destinationChainId,
|
|
@@ -146,9 +154,7 @@ export function createEvmCrossChainOrderIntentRequest(
|
|
|
146
154
|
const executionDetailsString = JSON.stringify(executionDetails, Parsers.bigIntReplacer);
|
|
147
155
|
|
|
148
156
|
// Calculate execution details hash
|
|
149
|
-
const executionDetailsHash = generateExecutionDetailsHash(
|
|
150
|
-
executionDetails
|
|
151
|
-
);
|
|
157
|
+
const executionDetailsHash = generateExecutionDetailsHash(executionDetails);
|
|
152
158
|
|
|
153
159
|
const genericData = {
|
|
154
160
|
user: params.user,
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { ethers, type TypedDataField, type AddressLike, type BigNumberish, type BytesLike } from
|
|
2
|
-
import { SignatureTransfer } from
|
|
3
|
-
import { TransferDataType, type TransferDataStruct } from
|
|
1
|
+
import { ethers, type TypedDataField, type AddressLike, type BigNumberish, type BytesLike } from 'ethers';
|
|
2
|
+
import { SignatureTransfer } from '@uniswap/permit2-sdk';
|
|
3
|
+
import { TransferDataType, type TransferDataStruct } from './types.js';
|
|
4
4
|
|
|
5
5
|
export const SingleChainDcaOrderType: Record<string, TypedDataField[]> = {
|
|
6
6
|
SingleChainDcaOrder: [
|
|
7
|
-
{ type:
|
|
8
|
-
{ type:
|
|
9
|
-
{ type:
|
|
10
|
-
{ type:
|
|
11
|
-
{ type:
|
|
12
|
-
{ type:
|
|
13
|
-
{ type:
|
|
14
|
-
{ type:
|
|
15
|
-
{ type:
|
|
16
|
-
{ type:
|
|
17
|
-
{ type:
|
|
7
|
+
{ type: 'address', name: 'user' },
|
|
8
|
+
{ type: 'address', name: 'tokenIn' },
|
|
9
|
+
{ type: 'uint32', name: 'startTime' },
|
|
10
|
+
{ type: 'uint256', name: 'amountInPerInterval' },
|
|
11
|
+
{ type: 'uint24', name: 'totalIntervals' },
|
|
12
|
+
{ type: 'uint32', name: 'intervalDuration' },
|
|
13
|
+
{ type: 'TransferData', name: 'requestedOutput' },
|
|
14
|
+
{ type: 'TransferData[]', name: 'extraTransfers' },
|
|
15
|
+
{ type: 'bytes', name: 'encodedExternalCallData' },
|
|
16
|
+
{ type: 'uint32', name: 'deadline' },
|
|
17
|
+
{ type: 'uint256', name: 'nonce' },
|
|
18
18
|
],
|
|
19
19
|
TransferData: TransferDataType.TransferData!,
|
|
20
20
|
};
|
|
@@ -41,7 +41,7 @@ export async function signSingleChainDcaOrder(
|
|
|
41
41
|
order: SingleChainDcaOrderStruct,
|
|
42
42
|
chainId: number,
|
|
43
43
|
guardAddress: string,
|
|
44
|
-
permit2Address: string
|
|
44
|
+
permit2Address: string,
|
|
45
45
|
): Promise<{
|
|
46
46
|
domain: any;
|
|
47
47
|
types: any;
|
|
@@ -63,9 +63,9 @@ export async function signSingleChainDcaOrder(
|
|
|
63
63
|
chainId,
|
|
64
64
|
{
|
|
65
65
|
witness: order,
|
|
66
|
-
witnessTypeName:
|
|
66
|
+
witnessTypeName: 'SingleChainDcaOrder',
|
|
67
67
|
witnessType: SingleChainDcaOrderType,
|
|
68
|
-
}
|
|
68
|
+
},
|
|
69
69
|
);
|
|
70
70
|
|
|
71
71
|
return {
|
|
@@ -79,7 +79,7 @@ export async function signSingleChainDcaOrder(
|
|
|
79
79
|
verifyingContract: permitData.domain.verifyingContract,
|
|
80
80
|
},
|
|
81
81
|
permitData.types,
|
|
82
|
-
permitData.values
|
|
82
|
+
permitData.values,
|
|
83
83
|
),
|
|
84
84
|
};
|
|
85
85
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { ethers, type TypedDataField, type AddressLike, type BigNumberish, type BytesLike } from
|
|
2
|
-
import { SignatureTransfer } from
|
|
3
|
-
import { TransferDataType, type TransferDataStruct } from
|
|
1
|
+
import { ethers, type TypedDataField, type AddressLike, type BigNumberish, type BytesLike } from 'ethers';
|
|
2
|
+
import { SignatureTransfer } from '@uniswap/permit2-sdk';
|
|
3
|
+
import { TransferDataType, type TransferDataStruct } from './types.js';
|
|
4
4
|
|
|
5
5
|
export const SingleChainLimitOrderType: Record<string, TypedDataField[]> = {
|
|
6
6
|
SingleChainLimitOrder: [
|
|
7
|
-
{ type:
|
|
8
|
-
{ type:
|
|
9
|
-
{ type:
|
|
10
|
-
{ type:
|
|
11
|
-
{ type:
|
|
12
|
-
{ type:
|
|
13
|
-
{ type:
|
|
14
|
-
{ type:
|
|
7
|
+
{ type: 'address', name: 'user' },
|
|
8
|
+
{ type: 'address', name: 'tokenIn' },
|
|
9
|
+
{ type: 'uint256', name: 'amountIn' },
|
|
10
|
+
{ type: 'TransferData', name: 'requestedOutput' },
|
|
11
|
+
{ type: 'TransferData[]', name: 'extraTransfers' },
|
|
12
|
+
{ type: 'bytes', name: 'encodedExternalCallData' },
|
|
13
|
+
{ type: 'uint32', name: 'deadline' },
|
|
14
|
+
{ type: 'uint256', name: 'nonce' },
|
|
15
15
|
],
|
|
16
16
|
TransferData: TransferDataType.TransferData!,
|
|
17
17
|
};
|
|
@@ -35,7 +35,7 @@ export async function signSingleChainLimitOrder(
|
|
|
35
35
|
order: SingleChainLimitOrderStruct,
|
|
36
36
|
chainId: number,
|
|
37
37
|
guardAddress: string,
|
|
38
|
-
permit2Address: string
|
|
38
|
+
permit2Address: string,
|
|
39
39
|
): Promise<{
|
|
40
40
|
domain: any;
|
|
41
41
|
types: any;
|
|
@@ -56,9 +56,9 @@ export async function signSingleChainLimitOrder(
|
|
|
56
56
|
chainId,
|
|
57
57
|
{
|
|
58
58
|
witness: order,
|
|
59
|
-
witnessTypeName:
|
|
59
|
+
witnessTypeName: 'SingleChainLimitOrder',
|
|
60
60
|
witnessType: SingleChainLimitOrderType,
|
|
61
|
-
}
|
|
61
|
+
},
|
|
62
62
|
);
|
|
63
63
|
|
|
64
64
|
return {
|
|
@@ -72,7 +72,7 @@ export async function signSingleChainLimitOrder(
|
|
|
72
72
|
verifyingContract: permitData.domain.verifyingContract,
|
|
73
73
|
},
|
|
74
74
|
permitData.types,
|
|
75
|
-
permitData.values
|
|
75
|
+
permitData.values,
|
|
76
76
|
),
|
|
77
77
|
};
|
|
78
78
|
}
|
package/src/core/evm/types.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { AddressLike, BigNumberish, TypedDataField } from
|
|
1
|
+
import type { AddressLike, BigNumberish, TypedDataField } from 'ethers';
|
|
2
2
|
|
|
3
3
|
export const TransferDataType: Record<string, TypedDataField[]> = {
|
|
4
4
|
TransferData: [
|
|
5
|
-
{ type:
|
|
6
|
-
{ type:
|
|
7
|
-
{ type:
|
|
5
|
+
{ type: 'address', name: 'token' },
|
|
6
|
+
{ type: 'address', name: 'receiver' },
|
|
7
|
+
{ type: 'uint256', name: 'amount' },
|
|
8
8
|
],
|
|
9
9
|
};
|
|
10
10
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { BN } from
|
|
2
|
-
import { PublicKey } from
|
|
3
|
-
import type { ExtraTransfer } from
|
|
4
|
-
import pkg from
|
|
1
|
+
import { BN } from 'bn.js';
|
|
2
|
+
import { PublicKey } from '@solana/web3.js';
|
|
3
|
+
import type { ExtraTransfer } from './single-chain-limit-order.js';
|
|
4
|
+
import pkg from 'js-sha3';
|
|
5
5
|
const { keccak256 } = pkg;
|
|
6
6
|
/**
|
|
7
7
|
* Generate secret number and prepare secret hash for single chain DCA orders
|
|
@@ -9,24 +9,21 @@ const { keccak256 } = pkg;
|
|
|
9
9
|
* @param receiver Token OUT receiver Pubkey
|
|
10
10
|
* @param extraTransfers Requested extra transfers
|
|
11
11
|
*/
|
|
12
|
-
export function prepareDcaSecretData(
|
|
13
|
-
tokenOut: PublicKey,
|
|
14
|
-
receiver: PublicKey,
|
|
15
|
-
extraTransfers: ExtraTransfer[],
|
|
16
|
-
) {
|
|
12
|
+
export function prepareDcaSecretData(tokenOut: PublicKey, receiver: PublicKey, extraTransfers: ExtraTransfer[]) {
|
|
17
13
|
const secretNumber = new BN(crypto.getRandomValues(new Uint8Array(8)));
|
|
18
|
-
const secretHash = [
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
14
|
+
const secretHash = [
|
|
15
|
+
...Uint8Array.from(
|
|
16
|
+
Buffer.from(
|
|
17
|
+
keccak256([
|
|
18
|
+
...tokenOut.toBuffer(),
|
|
19
|
+
...receiver.toBuffer(),
|
|
20
|
+
...Buffer.concat(extraTransfers.map((t) => Buffer.concat([t.token.toBuffer(), t.receiver.toBuffer()]))),
|
|
21
|
+
...secretNumber.toBuffer('le', 8),
|
|
22
|
+
]),
|
|
23
|
+
'hex',
|
|
24
|
+
),
|
|
25
|
+
),
|
|
26
|
+
];
|
|
30
27
|
|
|
31
28
|
return { secretHash, secretNumber };
|
|
32
29
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { BN } from
|
|
2
|
-
import { PublicKey } from
|
|
3
|
-
import pkg from
|
|
1
|
+
import { BN } from 'bn.js';
|
|
2
|
+
import { PublicKey } from '@solana/web3.js';
|
|
3
|
+
import pkg from 'js-sha3';
|
|
4
4
|
const { keccak256 } = pkg;
|
|
5
5
|
|
|
6
6
|
export type ExtraTransfer = {
|
|
@@ -15,31 +15,28 @@ export type ExtraTransfer = {
|
|
|
15
15
|
* @param receiver Token OUT receiver Pubkey
|
|
16
16
|
* @param extraTransfers Requested extra transfers
|
|
17
17
|
*/
|
|
18
|
-
export function prepareSecretData(
|
|
19
|
-
tokenOut: PublicKey,
|
|
20
|
-
receiver: PublicKey,
|
|
21
|
-
extraTransfers: ExtraTransfer[],
|
|
22
|
-
) {
|
|
18
|
+
export function prepareSecretData(tokenOut: PublicKey, receiver: PublicKey, extraTransfers: ExtraTransfer[]) {
|
|
23
19
|
const secretNumber = new BN(crypto.getRandomValues(new Uint8Array(8)));
|
|
24
|
-
const secretHash = [
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
20
|
+
const secretHash = [
|
|
21
|
+
...Uint8Array.from(
|
|
22
|
+
Buffer.from(
|
|
23
|
+
keccak256([
|
|
24
|
+
...tokenOut.toBuffer(),
|
|
25
|
+
...receiver.toBuffer(),
|
|
26
|
+
...Buffer.concat(extraTransfers.map((t) => Buffer.concat([t.token.toBuffer(), t.receiver.toBuffer()]))),
|
|
27
|
+
...secretNumber.toBuffer('le', 8),
|
|
28
|
+
]),
|
|
29
|
+
'hex',
|
|
30
|
+
),
|
|
31
|
+
),
|
|
32
|
+
];
|
|
36
33
|
|
|
37
34
|
return { secretHash, secretNumber };
|
|
38
35
|
}
|
|
39
36
|
|
|
40
37
|
export function formatTokenPubkey(token: PublicKey) {
|
|
41
|
-
if (token.equals(new PublicKey(
|
|
42
|
-
return PublicKey.default
|
|
38
|
+
if (token.equals(new PublicKey('So11111111111111111111111111111111111111111'))) {
|
|
39
|
+
return PublicKey.default;
|
|
43
40
|
}
|
|
44
41
|
|
|
45
42
|
return token;
|
|
@@ -37,9 +37,7 @@ import {
|
|
|
37
37
|
type ReadonlyUint8Array,
|
|
38
38
|
} from '@solana/codecs';
|
|
39
39
|
|
|
40
|
-
export const ADMIN_SINGLETON_DISCRIMINATOR = new Uint8Array([
|
|
41
|
-
179, 22, 254, 245, 204, 230, 222, 194,
|
|
42
|
-
]);
|
|
40
|
+
export const ADMIN_SINGLETON_DISCRIMINATOR = new Uint8Array([179, 22, 254, 245, 204, 230, 222, 194]);
|
|
43
41
|
|
|
44
42
|
export function getAdminSingletonDiscriminatorBytes() {
|
|
45
43
|
return fixEncoderSize(getBytesEncoder(), 8).encode(ADMIN_SINGLETON_DISCRIMINATOR);
|
|
@@ -72,7 +70,7 @@ export function getAdminSingletonEncoder(): FixedSizeEncoder<AdminSingletonArgs>
|
|
|
72
70
|
['pendingAdmin', getAddressEncoder()],
|
|
73
71
|
['bump', getU8Encoder()],
|
|
74
72
|
]),
|
|
75
|
-
(value) => ({ ...value, discriminator: ADMIN_SINGLETON_DISCRIMINATOR })
|
|
73
|
+
(value) => ({ ...value, discriminator: ADMIN_SINGLETON_DISCRIMINATOR }),
|
|
76
74
|
);
|
|
77
75
|
}
|
|
78
76
|
|
|
@@ -90,13 +88,13 @@ export function getAdminSingletonCodec(): FixedSizeCodec<AdminSingletonArgs, Adm
|
|
|
90
88
|
}
|
|
91
89
|
|
|
92
90
|
export function decodeAdminSingleton<TAddress extends string = string>(
|
|
93
|
-
encodedAccount: EncodedAccount<TAddress
|
|
91
|
+
encodedAccount: EncodedAccount<TAddress>,
|
|
94
92
|
): Account<AdminSingleton, TAddress>;
|
|
95
93
|
export function decodeAdminSingleton<TAddress extends string = string>(
|
|
96
|
-
encodedAccount: MaybeEncodedAccount<TAddress
|
|
94
|
+
encodedAccount: MaybeEncodedAccount<TAddress>,
|
|
97
95
|
): MaybeAccount<AdminSingleton, TAddress>;
|
|
98
96
|
export function decodeAdminSingleton<TAddress extends string = string>(
|
|
99
|
-
encodedAccount: EncodedAccount<TAddress> | MaybeEncodedAccount<TAddress
|
|
97
|
+
encodedAccount: EncodedAccount<TAddress> | MaybeEncodedAccount<TAddress>,
|
|
100
98
|
): Account<AdminSingleton, TAddress> | MaybeAccount<AdminSingleton, TAddress> {
|
|
101
99
|
return decodeAccount(encodedAccount as MaybeEncodedAccount<TAddress>, getAdminSingletonDecoder());
|
|
102
100
|
}
|
|
@@ -104,7 +102,7 @@ export function decodeAdminSingleton<TAddress extends string = string>(
|
|
|
104
102
|
export async function fetchAdminSingleton<TAddress extends string = string>(
|
|
105
103
|
rpc: Parameters<typeof fetchEncodedAccount>[0],
|
|
106
104
|
address: Address<TAddress>,
|
|
107
|
-
config?: FetchAccountConfig
|
|
105
|
+
config?: FetchAccountConfig,
|
|
108
106
|
): Promise<Account<AdminSingleton, TAddress>> {
|
|
109
107
|
const maybeAccount = await fetchMaybeAdminSingleton(rpc, address, config);
|
|
110
108
|
assertAccountExists(maybeAccount);
|
|
@@ -114,7 +112,7 @@ export async function fetchAdminSingleton<TAddress extends string = string>(
|
|
|
114
112
|
export async function fetchMaybeAdminSingleton<TAddress extends string = string>(
|
|
115
113
|
rpc: Parameters<typeof fetchEncodedAccount>[0],
|
|
116
114
|
address: Address<TAddress>,
|
|
117
|
-
config?: FetchAccountConfig
|
|
115
|
+
config?: FetchAccountConfig,
|
|
118
116
|
): Promise<MaybeAccount<AdminSingleton, TAddress>> {
|
|
119
117
|
const maybeAccount = await fetchEncodedAccount(rpc, address, config);
|
|
120
118
|
return decodeAdminSingleton(maybeAccount);
|
|
@@ -123,7 +121,7 @@ export async function fetchMaybeAdminSingleton<TAddress extends string = string>
|
|
|
123
121
|
export async function fetchAllAdminSingleton(
|
|
124
122
|
rpc: Parameters<typeof fetchEncodedAccounts>[0],
|
|
125
123
|
addresses: Array<Address>,
|
|
126
|
-
config?: FetchAccountsConfig
|
|
124
|
+
config?: FetchAccountsConfig,
|
|
127
125
|
): Promise<Account<AdminSingleton>[]> {
|
|
128
126
|
const maybeAccounts = await fetchAllMaybeAdminSingleton(rpc, addresses, config);
|
|
129
127
|
assertAccountsExist(maybeAccounts);
|
|
@@ -133,7 +131,7 @@ export async function fetchAllAdminSingleton(
|
|
|
133
131
|
export async function fetchAllMaybeAdminSingleton(
|
|
134
132
|
rpc: Parameters<typeof fetchEncodedAccounts>[0],
|
|
135
133
|
addresses: Array<Address>,
|
|
136
|
-
config?: FetchAccountsConfig
|
|
134
|
+
config?: FetchAccountsConfig,
|
|
137
135
|
): Promise<MaybeAccount<AdminSingleton>[]> {
|
|
138
136
|
const maybeAccounts = await fetchEncodedAccounts(rpc, addresses, config);
|
|
139
137
|
return maybeAccounts.map((maybeAccount) => decodeAdminSingleton(maybeAccount));
|
|
@@ -160,7 +160,7 @@ export function getDcaOrderEncoder(): FixedSizeEncoder<DcaOrderArgs> {
|
|
|
160
160
|
['totalExecutedIntervals', getU32Encoder()],
|
|
161
161
|
['lastExecutedIntervalIndex', getU32Encoder()],
|
|
162
162
|
]),
|
|
163
|
-
(value) => ({ ...value, discriminator: DCA_ORDER_DISCRIMINATOR })
|
|
163
|
+
(value) => ({ ...value, discriminator: DCA_ORDER_DISCRIMINATOR }),
|
|
164
164
|
);
|
|
165
165
|
}
|
|
166
166
|
|
|
@@ -194,13 +194,13 @@ export function getDcaOrderCodec(): FixedSizeCodec<DcaOrderArgs, DcaOrder> {
|
|
|
194
194
|
}
|
|
195
195
|
|
|
196
196
|
export function decodeDcaOrder<TAddress extends string = string>(
|
|
197
|
-
encodedAccount: EncodedAccount<TAddress
|
|
197
|
+
encodedAccount: EncodedAccount<TAddress>,
|
|
198
198
|
): Account<DcaOrder, TAddress>;
|
|
199
199
|
export function decodeDcaOrder<TAddress extends string = string>(
|
|
200
|
-
encodedAccount: MaybeEncodedAccount<TAddress
|
|
200
|
+
encodedAccount: MaybeEncodedAccount<TAddress>,
|
|
201
201
|
): MaybeAccount<DcaOrder, TAddress>;
|
|
202
202
|
export function decodeDcaOrder<TAddress extends string = string>(
|
|
203
|
-
encodedAccount: EncodedAccount<TAddress> | MaybeEncodedAccount<TAddress
|
|
203
|
+
encodedAccount: EncodedAccount<TAddress> | MaybeEncodedAccount<TAddress>,
|
|
204
204
|
): Account<DcaOrder, TAddress> | MaybeAccount<DcaOrder, TAddress> {
|
|
205
205
|
return decodeAccount(encodedAccount as MaybeEncodedAccount<TAddress>, getDcaOrderDecoder());
|
|
206
206
|
}
|
|
@@ -208,7 +208,7 @@ export function decodeDcaOrder<TAddress extends string = string>(
|
|
|
208
208
|
export async function fetchDcaOrder<TAddress extends string = string>(
|
|
209
209
|
rpc: Parameters<typeof fetchEncodedAccount>[0],
|
|
210
210
|
address: Address<TAddress>,
|
|
211
|
-
config?: FetchAccountConfig
|
|
211
|
+
config?: FetchAccountConfig,
|
|
212
212
|
): Promise<Account<DcaOrder, TAddress>> {
|
|
213
213
|
const maybeAccount = await fetchMaybeDcaOrder(rpc, address, config);
|
|
214
214
|
assertAccountExists(maybeAccount);
|
|
@@ -218,7 +218,7 @@ export async function fetchDcaOrder<TAddress extends string = string>(
|
|
|
218
218
|
export async function fetchMaybeDcaOrder<TAddress extends string = string>(
|
|
219
219
|
rpc: Parameters<typeof fetchEncodedAccount>[0],
|
|
220
220
|
address: Address<TAddress>,
|
|
221
|
-
config?: FetchAccountConfig
|
|
221
|
+
config?: FetchAccountConfig,
|
|
222
222
|
): Promise<MaybeAccount<DcaOrder, TAddress>> {
|
|
223
223
|
const maybeAccount = await fetchEncodedAccount(rpc, address, config);
|
|
224
224
|
return decodeDcaOrder(maybeAccount);
|
|
@@ -227,7 +227,7 @@ export async function fetchMaybeDcaOrder<TAddress extends string = string>(
|
|
|
227
227
|
export async function fetchAllDcaOrder(
|
|
228
228
|
rpc: Parameters<typeof fetchEncodedAccounts>[0],
|
|
229
229
|
addresses: Array<Address>,
|
|
230
|
-
config?: FetchAccountsConfig
|
|
230
|
+
config?: FetchAccountsConfig,
|
|
231
231
|
): Promise<Account<DcaOrder>[]> {
|
|
232
232
|
const maybeAccounts = await fetchAllMaybeDcaOrder(rpc, addresses, config);
|
|
233
233
|
assertAccountsExist(maybeAccounts);
|
|
@@ -237,7 +237,7 @@ export async function fetchAllDcaOrder(
|
|
|
237
237
|
export async function fetchAllMaybeDcaOrder(
|
|
238
238
|
rpc: Parameters<typeof fetchEncodedAccounts>[0],
|
|
239
239
|
addresses: Array<Address>,
|
|
240
|
-
config?: FetchAccountsConfig
|
|
240
|
+
config?: FetchAccountsConfig,
|
|
241
241
|
): Promise<MaybeAccount<DcaOrder>[]> {
|
|
242
242
|
const maybeAccounts = await fetchEncodedAccounts(rpc, addresses, config);
|
|
243
243
|
return maybeAccounts.map((maybeAccount) => decodeDcaOrder(maybeAccount));
|
|
@@ -87,7 +87,7 @@ export function getGuardEncoder(): FixedSizeEncoder<GuardArgs> {
|
|
|
87
87
|
['auctioneerPubKey', getAddressEncoder()],
|
|
88
88
|
['collectedFees', getU64Encoder()],
|
|
89
89
|
]),
|
|
90
|
-
(value) => ({ ...value, discriminator: GUARD_DISCRIMINATOR })
|
|
90
|
+
(value) => ({ ...value, discriminator: GUARD_DISCRIMINATOR }),
|
|
91
91
|
);
|
|
92
92
|
}
|
|
93
93
|
|
|
@@ -108,13 +108,13 @@ export function getGuardCodec(): FixedSizeCodec<GuardArgs, Guard> {
|
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
export function decodeGuard<TAddress extends string = string>(
|
|
111
|
-
encodedAccount: EncodedAccount<TAddress
|
|
111
|
+
encodedAccount: EncodedAccount<TAddress>,
|
|
112
112
|
): Account<Guard, TAddress>;
|
|
113
113
|
export function decodeGuard<TAddress extends string = string>(
|
|
114
|
-
encodedAccount: MaybeEncodedAccount<TAddress
|
|
114
|
+
encodedAccount: MaybeEncodedAccount<TAddress>,
|
|
115
115
|
): MaybeAccount<Guard, TAddress>;
|
|
116
116
|
export function decodeGuard<TAddress extends string = string>(
|
|
117
|
-
encodedAccount: EncodedAccount<TAddress> | MaybeEncodedAccount<TAddress
|
|
117
|
+
encodedAccount: EncodedAccount<TAddress> | MaybeEncodedAccount<TAddress>,
|
|
118
118
|
): Account<Guard, TAddress> | MaybeAccount<Guard, TAddress> {
|
|
119
119
|
return decodeAccount(encodedAccount as MaybeEncodedAccount<TAddress>, getGuardDecoder());
|
|
120
120
|
}
|
|
@@ -122,7 +122,7 @@ export function decodeGuard<TAddress extends string = string>(
|
|
|
122
122
|
export async function fetchGuard<TAddress extends string = string>(
|
|
123
123
|
rpc: Parameters<typeof fetchEncodedAccount>[0],
|
|
124
124
|
address: Address<TAddress>,
|
|
125
|
-
config?: FetchAccountConfig
|
|
125
|
+
config?: FetchAccountConfig,
|
|
126
126
|
): Promise<Account<Guard, TAddress>> {
|
|
127
127
|
const maybeAccount = await fetchMaybeGuard(rpc, address, config);
|
|
128
128
|
assertAccountExists(maybeAccount);
|
|
@@ -132,7 +132,7 @@ export async function fetchGuard<TAddress extends string = string>(
|
|
|
132
132
|
export async function fetchMaybeGuard<TAddress extends string = string>(
|
|
133
133
|
rpc: Parameters<typeof fetchEncodedAccount>[0],
|
|
134
134
|
address: Address<TAddress>,
|
|
135
|
-
config?: FetchAccountConfig
|
|
135
|
+
config?: FetchAccountConfig,
|
|
136
136
|
): Promise<MaybeAccount<Guard, TAddress>> {
|
|
137
137
|
const maybeAccount = await fetchEncodedAccount(rpc, address, config);
|
|
138
138
|
return decodeGuard(maybeAccount);
|
|
@@ -141,7 +141,7 @@ export async function fetchMaybeGuard<TAddress extends string = string>(
|
|
|
141
141
|
export async function fetchAllGuard(
|
|
142
142
|
rpc: Parameters<typeof fetchEncodedAccounts>[0],
|
|
143
143
|
addresses: Array<Address>,
|
|
144
|
-
config?: FetchAccountsConfig
|
|
144
|
+
config?: FetchAccountsConfig,
|
|
145
145
|
): Promise<Account<Guard>[]> {
|
|
146
146
|
const maybeAccounts = await fetchAllMaybeGuard(rpc, addresses, config);
|
|
147
147
|
assertAccountsExist(maybeAccounts);
|
|
@@ -151,7 +151,7 @@ export async function fetchAllGuard(
|
|
|
151
151
|
export async function fetchAllMaybeGuard(
|
|
152
152
|
rpc: Parameters<typeof fetchEncodedAccounts>[0],
|
|
153
153
|
addresses: Array<Address>,
|
|
154
|
-
config?: FetchAccountsConfig
|
|
154
|
+
config?: FetchAccountsConfig,
|
|
155
155
|
): Promise<MaybeAccount<Guard>[]> {
|
|
156
156
|
const maybeAccounts = await fetchEncodedAccounts(rpc, addresses, config);
|
|
157
157
|
return maybeAccounts.map((maybeAccount) => decodeGuard(maybeAccount));
|
|
@@ -136,7 +136,7 @@ export function getOrderEncoder(): FixedSizeEncoder<OrderArgs> {
|
|
|
136
136
|
['activeSolver', getAddressEncoder()],
|
|
137
137
|
['executionDeadline', getU32Encoder()],
|
|
138
138
|
]),
|
|
139
|
-
(value) => ({ ...value, discriminator: ORDER_DISCRIMINATOR })
|
|
139
|
+
(value) => ({ ...value, discriminator: ORDER_DISCRIMINATOR }),
|
|
140
140
|
);
|
|
141
141
|
}
|
|
142
142
|
|
|
@@ -164,13 +164,13 @@ export function getOrderCodec(): FixedSizeCodec<OrderArgs, Order> {
|
|
|
164
164
|
}
|
|
165
165
|
|
|
166
166
|
export function decodeOrder<TAddress extends string = string>(
|
|
167
|
-
encodedAccount: EncodedAccount<TAddress
|
|
167
|
+
encodedAccount: EncodedAccount<TAddress>,
|
|
168
168
|
): Account<Order, TAddress>;
|
|
169
169
|
export function decodeOrder<TAddress extends string = string>(
|
|
170
|
-
encodedAccount: MaybeEncodedAccount<TAddress
|
|
170
|
+
encodedAccount: MaybeEncodedAccount<TAddress>,
|
|
171
171
|
): MaybeAccount<Order, TAddress>;
|
|
172
172
|
export function decodeOrder<TAddress extends string = string>(
|
|
173
|
-
encodedAccount: EncodedAccount<TAddress> | MaybeEncodedAccount<TAddress
|
|
173
|
+
encodedAccount: EncodedAccount<TAddress> | MaybeEncodedAccount<TAddress>,
|
|
174
174
|
): Account<Order, TAddress> | MaybeAccount<Order, TAddress> {
|
|
175
175
|
return decodeAccount(encodedAccount as MaybeEncodedAccount<TAddress>, getOrderDecoder());
|
|
176
176
|
}
|
|
@@ -178,7 +178,7 @@ export function decodeOrder<TAddress extends string = string>(
|
|
|
178
178
|
export async function fetchOrder<TAddress extends string = string>(
|
|
179
179
|
rpc: Parameters<typeof fetchEncodedAccount>[0],
|
|
180
180
|
address: Address<TAddress>,
|
|
181
|
-
config?: FetchAccountConfig
|
|
181
|
+
config?: FetchAccountConfig,
|
|
182
182
|
): Promise<Account<Order, TAddress>> {
|
|
183
183
|
const maybeAccount = await fetchMaybeOrder(rpc, address, config);
|
|
184
184
|
assertAccountExists(maybeAccount);
|
|
@@ -188,7 +188,7 @@ export async function fetchOrder<TAddress extends string = string>(
|
|
|
188
188
|
export async function fetchMaybeOrder<TAddress extends string = string>(
|
|
189
189
|
rpc: Parameters<typeof fetchEncodedAccount>[0],
|
|
190
190
|
address: Address<TAddress>,
|
|
191
|
-
config?: FetchAccountConfig
|
|
191
|
+
config?: FetchAccountConfig,
|
|
192
192
|
): Promise<MaybeAccount<Order, TAddress>> {
|
|
193
193
|
const maybeAccount = await fetchEncodedAccount(rpc, address, config);
|
|
194
194
|
return decodeOrder(maybeAccount);
|
|
@@ -197,7 +197,7 @@ export async function fetchMaybeOrder<TAddress extends string = string>(
|
|
|
197
197
|
export async function fetchAllOrder(
|
|
198
198
|
rpc: Parameters<typeof fetchEncodedAccounts>[0],
|
|
199
199
|
addresses: Array<Address>,
|
|
200
|
-
config?: FetchAccountsConfig
|
|
200
|
+
config?: FetchAccountsConfig,
|
|
201
201
|
): Promise<Account<Order>[]> {
|
|
202
202
|
const maybeAccounts = await fetchAllMaybeOrder(rpc, addresses, config);
|
|
203
203
|
assertAccountsExist(maybeAccounts);
|
|
@@ -207,7 +207,7 @@ export async function fetchAllOrder(
|
|
|
207
207
|
export async function fetchAllMaybeOrder(
|
|
208
208
|
rpc: Parameters<typeof fetchEncodedAccounts>[0],
|
|
209
209
|
addresses: Array<Address>,
|
|
210
|
-
config?: FetchAccountsConfig
|
|
210
|
+
config?: FetchAccountsConfig,
|
|
211
211
|
): Promise<MaybeAccount<Order>[]> {
|
|
212
212
|
const maybeAccounts = await fetchEncodedAccounts(rpc, addresses, config);
|
|
213
213
|
return maybeAccounts.map((maybeAccount) => decodeOrder(maybeAccount));
|
|
@@ -183,13 +183,8 @@ export function getSourceChainGuardErrorMessage(code: SourceChainGuardError): st
|
|
|
183
183
|
export function isSourceChainGuardError<TProgramErrorCode extends SourceChainGuardError>(
|
|
184
184
|
error: unknown,
|
|
185
185
|
transactionMessage: { instructions: Record<number, { programAddress: Address }> },
|
|
186
|
-
code?: TProgramErrorCode
|
|
186
|
+
code?: TProgramErrorCode,
|
|
187
187
|
): error is SolanaError<typeof SOLANA_ERROR__INSTRUCTION_ERROR__CUSTOM> &
|
|
188
188
|
Readonly<{ context: Readonly<{ code: TProgramErrorCode }> }> {
|
|
189
|
-
return isProgramError<TProgramErrorCode>(
|
|
190
|
-
error,
|
|
191
|
-
transactionMessage,
|
|
192
|
-
SOURCE_CHAIN_GUARD_PROGRAM_ADDRESS,
|
|
193
|
-
code
|
|
194
|
-
);
|
|
189
|
+
return isProgramError<TProgramErrorCode>(error, transactionMessage, SOURCE_CHAIN_GUARD_PROGRAM_ADDRESS, code);
|
|
195
190
|
}
|