@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
|
@@ -6,12 +6,7 @@
|
|
|
6
6
|
* @see https://github.com/codama-idl/codama
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import {
|
|
10
|
-
getAddressDecoder,
|
|
11
|
-
getAddressEncoder,
|
|
12
|
-
getProgramDerivedAddress,
|
|
13
|
-
type Address,
|
|
14
|
-
} from '@solana/addresses';
|
|
9
|
+
import { getAddressDecoder, getAddressEncoder, getProgramDerivedAddress, type Address } from '@solana/addresses';
|
|
15
10
|
import {
|
|
16
11
|
combineCodec,
|
|
17
12
|
fixDecoderSize,
|
|
@@ -39,9 +34,7 @@ import { type AccountSignerMeta, type TransactionSigner } from '@solana/signers'
|
|
|
39
34
|
import { SINGLE_CHAIN_GUARD_PROGRAM_ADDRESS } from '../programs/index.js';
|
|
40
35
|
import { getAccountMetaFactory, type ResolvedAccount } from '../shared/index.js';
|
|
41
36
|
|
|
42
|
-
export const SET_AUCTIONEER_PUB_KEY_DISCRIMINATOR = new Uint8Array([
|
|
43
|
-
153, 39, 10, 108, 220, 0, 84, 47,
|
|
44
|
-
]);
|
|
37
|
+
export const SET_AUCTIONEER_PUB_KEY_DISCRIMINATOR = new Uint8Array([153, 39, 10, 108, 220, 0, 84, 47]);
|
|
45
38
|
|
|
46
39
|
export function getSetAuctioneerPubKeyDiscriminatorBytes() {
|
|
47
40
|
return fixEncoderSize(getBytesEncoder(), 8).encode(SET_AUCTIONEER_PUB_KEY_DISCRIMINATOR);
|
|
@@ -60,9 +53,7 @@ export type SetAuctioneerPubKeyInstruction<
|
|
|
60
53
|
TAccountAdmin extends string
|
|
61
54
|
? WritableSignerAccount<TAccountAdmin> & AccountSignerMeta<TAccountAdmin>
|
|
62
55
|
: TAccountAdmin,
|
|
63
|
-
TAccountAdminSingleton extends string
|
|
64
|
-
? ReadonlyAccount<TAccountAdminSingleton>
|
|
65
|
-
: TAccountAdminSingleton,
|
|
56
|
+
TAccountAdminSingleton extends string ? ReadonlyAccount<TAccountAdminSingleton> : TAccountAdminSingleton,
|
|
66
57
|
TAccountGuard extends string ? WritableAccount<TAccountGuard> : TAccountGuard,
|
|
67
58
|
...TRemainingAccounts,
|
|
68
59
|
]
|
|
@@ -81,7 +72,7 @@ export function getSetAuctioneerPubKeyInstructionDataEncoder(): FixedSizeEncoder
|
|
|
81
72
|
['discriminator', fixEncoderSize(getBytesEncoder(), 8)],
|
|
82
73
|
['auctioneerPubKey', getAddressEncoder()],
|
|
83
74
|
]),
|
|
84
|
-
(value) => ({ ...value, discriminator: SET_AUCTIONEER_PUB_KEY_DISCRIMINATOR })
|
|
75
|
+
(value) => ({ ...value, discriminator: SET_AUCTIONEER_PUB_KEY_DISCRIMINATOR }),
|
|
85
76
|
);
|
|
86
77
|
}
|
|
87
78
|
|
|
@@ -96,10 +87,7 @@ export function getSetAuctioneerPubKeyInstructionDataCodec(): FixedSizeCodec<
|
|
|
96
87
|
SetAuctioneerPubKeyInstructionDataArgs,
|
|
97
88
|
SetAuctioneerPubKeyInstructionData
|
|
98
89
|
> {
|
|
99
|
-
return combineCodec(
|
|
100
|
-
getSetAuctioneerPubKeyInstructionDataEncoder(),
|
|
101
|
-
getSetAuctioneerPubKeyInstructionDataDecoder()
|
|
102
|
-
);
|
|
90
|
+
return combineCodec(getSetAuctioneerPubKeyInstructionDataEncoder(), getSetAuctioneerPubKeyInstructionDataDecoder());
|
|
103
91
|
}
|
|
104
92
|
|
|
105
93
|
export type SetAuctioneerPubKeyAsyncInput<
|
|
@@ -123,15 +111,8 @@ export async function getSetAuctioneerPubKeyInstructionAsync<
|
|
|
123
111
|
TProgramAddress extends Address = typeof SINGLE_CHAIN_GUARD_PROGRAM_ADDRESS,
|
|
124
112
|
>(
|
|
125
113
|
input: SetAuctioneerPubKeyAsyncInput<TAccountAdmin, TAccountAdminSingleton, TAccountGuard>,
|
|
126
|
-
config?: { programAddress?: TProgramAddress }
|
|
127
|
-
): Promise<
|
|
128
|
-
SetAuctioneerPubKeyInstruction<
|
|
129
|
-
TProgramAddress,
|
|
130
|
-
TAccountAdmin,
|
|
131
|
-
TAccountAdminSingleton,
|
|
132
|
-
TAccountGuard
|
|
133
|
-
>
|
|
134
|
-
> {
|
|
114
|
+
config?: { programAddress?: TProgramAddress },
|
|
115
|
+
): Promise<SetAuctioneerPubKeyInstruction<TProgramAddress, TAccountAdmin, TAccountAdminSingleton, TAccountGuard>> {
|
|
135
116
|
// Program address.
|
|
136
117
|
const programAddress = config?.programAddress ?? SINGLE_CHAIN_GUARD_PROGRAM_ADDRESS;
|
|
137
118
|
|
|
@@ -156,21 +137,10 @@ export async function getSetAuctioneerPubKeyInstructionAsync<
|
|
|
156
137
|
|
|
157
138
|
const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');
|
|
158
139
|
const instruction = {
|
|
159
|
-
accounts: [
|
|
160
|
-
getAccountMeta(accounts.admin),
|
|
161
|
-
getAccountMeta(accounts.adminSingleton),
|
|
162
|
-
getAccountMeta(accounts.guard),
|
|
163
|
-
],
|
|
140
|
+
accounts: [getAccountMeta(accounts.admin), getAccountMeta(accounts.adminSingleton), getAccountMeta(accounts.guard)],
|
|
164
141
|
programAddress,
|
|
165
|
-
data: getSetAuctioneerPubKeyInstructionDataEncoder().encode(
|
|
166
|
-
|
|
167
|
-
),
|
|
168
|
-
} as SetAuctioneerPubKeyInstruction<
|
|
169
|
-
TProgramAddress,
|
|
170
|
-
TAccountAdmin,
|
|
171
|
-
TAccountAdminSingleton,
|
|
172
|
-
TAccountGuard
|
|
173
|
-
>;
|
|
142
|
+
data: getSetAuctioneerPubKeyInstructionDataEncoder().encode(args as SetAuctioneerPubKeyInstructionDataArgs),
|
|
143
|
+
} as SetAuctioneerPubKeyInstruction<TProgramAddress, TAccountAdmin, TAccountAdminSingleton, TAccountGuard>;
|
|
174
144
|
|
|
175
145
|
return instruction;
|
|
176
146
|
}
|
|
@@ -196,13 +166,8 @@ export function getSetAuctioneerPubKeyInstruction<
|
|
|
196
166
|
TProgramAddress extends Address = typeof SINGLE_CHAIN_GUARD_PROGRAM_ADDRESS,
|
|
197
167
|
>(
|
|
198
168
|
input: SetAuctioneerPubKeyInput<TAccountAdmin, TAccountAdminSingleton, TAccountGuard>,
|
|
199
|
-
config?: { programAddress?: TProgramAddress }
|
|
200
|
-
): SetAuctioneerPubKeyInstruction<
|
|
201
|
-
TProgramAddress,
|
|
202
|
-
TAccountAdmin,
|
|
203
|
-
TAccountAdminSingleton,
|
|
204
|
-
TAccountGuard
|
|
205
|
-
> {
|
|
169
|
+
config?: { programAddress?: TProgramAddress },
|
|
170
|
+
): SetAuctioneerPubKeyInstruction<TProgramAddress, TAccountAdmin, TAccountAdminSingleton, TAccountGuard> {
|
|
206
171
|
// Program address.
|
|
207
172
|
const programAddress = config?.programAddress ?? SINGLE_CHAIN_GUARD_PROGRAM_ADDRESS;
|
|
208
173
|
|
|
@@ -219,21 +184,10 @@ export function getSetAuctioneerPubKeyInstruction<
|
|
|
219
184
|
|
|
220
185
|
const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');
|
|
221
186
|
const instruction = {
|
|
222
|
-
accounts: [
|
|
223
|
-
getAccountMeta(accounts.admin),
|
|
224
|
-
getAccountMeta(accounts.adminSingleton),
|
|
225
|
-
getAccountMeta(accounts.guard),
|
|
226
|
-
],
|
|
187
|
+
accounts: [getAccountMeta(accounts.admin), getAccountMeta(accounts.adminSingleton), getAccountMeta(accounts.guard)],
|
|
227
188
|
programAddress,
|
|
228
|
-
data: getSetAuctioneerPubKeyInstructionDataEncoder().encode(
|
|
229
|
-
|
|
230
|
-
),
|
|
231
|
-
} as SetAuctioneerPubKeyInstruction<
|
|
232
|
-
TProgramAddress,
|
|
233
|
-
TAccountAdmin,
|
|
234
|
-
TAccountAdminSingleton,
|
|
235
|
-
TAccountGuard
|
|
236
|
-
>;
|
|
189
|
+
data: getSetAuctioneerPubKeyInstructionDataEncoder().encode(args as SetAuctioneerPubKeyInstructionDataArgs),
|
|
190
|
+
} as SetAuctioneerPubKeyInstruction<TProgramAddress, TAccountAdmin, TAccountAdminSingleton, TAccountGuard>;
|
|
237
191
|
|
|
238
192
|
return instruction;
|
|
239
193
|
}
|
|
@@ -258,9 +212,7 @@ export function parseSetAuctioneerPubKeyInstruction<
|
|
|
258
212
|
TProgram extends string,
|
|
259
213
|
TAccountMetas extends readonly AccountMeta[],
|
|
260
214
|
>(
|
|
261
|
-
instruction: Instruction<TProgram> &
|
|
262
|
-
InstructionWithAccounts<TAccountMetas> &
|
|
263
|
-
InstructionWithData<ReadonlyUint8Array>
|
|
215
|
+
instruction: Instruction<TProgram> & InstructionWithAccounts<TAccountMetas> & InstructionWithData<ReadonlyUint8Array>,
|
|
264
216
|
): ParsedSetAuctioneerPubKeyInstruction<TProgram, TAccountMetas> {
|
|
265
217
|
if (instruction.accounts.length < 3) {
|
|
266
218
|
// TODO: Coded error.
|
|
@@ -7,12 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { type Address } from '@solana/addresses';
|
|
10
|
-
import {
|
|
11
|
-
containsBytes,
|
|
12
|
-
fixEncoderSize,
|
|
13
|
-
getBytesEncoder,
|
|
14
|
-
type ReadonlyUint8Array,
|
|
15
|
-
} from '@solana/codecs';
|
|
10
|
+
import { containsBytes, fixEncoderSize, getBytesEncoder, type ReadonlyUint8Array } from '@solana/codecs';
|
|
16
11
|
import {
|
|
17
12
|
type ParsedAcceptAdminInstruction,
|
|
18
13
|
type ParsedCancelDcaOrderInstruction,
|
|
@@ -39,16 +34,14 @@ export enum SingleChainGuardAccount {
|
|
|
39
34
|
}
|
|
40
35
|
|
|
41
36
|
export function identifySingleChainGuardAccount(
|
|
42
|
-
account: { data: ReadonlyUint8Array } | ReadonlyUint8Array
|
|
37
|
+
account: { data: ReadonlyUint8Array } | ReadonlyUint8Array,
|
|
43
38
|
): SingleChainGuardAccount {
|
|
44
39
|
const data = 'data' in account ? account.data : account;
|
|
45
40
|
if (
|
|
46
41
|
containsBytes(
|
|
47
42
|
data,
|
|
48
|
-
fixEncoderSize(getBytesEncoder(), 8).encode(
|
|
49
|
-
|
|
50
|
-
),
|
|
51
|
-
0
|
|
43
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([179, 22, 254, 245, 204, 230, 222, 194])),
|
|
44
|
+
0,
|
|
52
45
|
)
|
|
53
46
|
) {
|
|
54
47
|
return SingleChainGuardAccount.AdminSingleton;
|
|
@@ -56,10 +49,8 @@ export function identifySingleChainGuardAccount(
|
|
|
56
49
|
if (
|
|
57
50
|
containsBytes(
|
|
58
51
|
data,
|
|
59
|
-
fixEncoderSize(getBytesEncoder(), 8).encode(
|
|
60
|
-
|
|
61
|
-
),
|
|
62
|
-
0
|
|
52
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([55, 1, 103, 253, 215, 66, 27, 57])),
|
|
53
|
+
0,
|
|
63
54
|
)
|
|
64
55
|
) {
|
|
65
56
|
return SingleChainGuardAccount.DcaOrder;
|
|
@@ -67,10 +58,8 @@ export function identifySingleChainGuardAccount(
|
|
|
67
58
|
if (
|
|
68
59
|
containsBytes(
|
|
69
60
|
data,
|
|
70
|
-
fixEncoderSize(getBytesEncoder(), 8).encode(
|
|
71
|
-
|
|
72
|
-
),
|
|
73
|
-
0
|
|
61
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([54, 187, 84, 137, 192, 15, 74, 248])),
|
|
62
|
+
0,
|
|
74
63
|
)
|
|
75
64
|
) {
|
|
76
65
|
return SingleChainGuardAccount.Guard;
|
|
@@ -78,10 +67,8 @@ export function identifySingleChainGuardAccount(
|
|
|
78
67
|
if (
|
|
79
68
|
containsBytes(
|
|
80
69
|
data,
|
|
81
|
-
fixEncoderSize(getBytesEncoder(), 8).encode(
|
|
82
|
-
|
|
83
|
-
),
|
|
84
|
-
0
|
|
70
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([137, 183, 212, 91, 115, 29, 141, 227])),
|
|
71
|
+
0,
|
|
85
72
|
)
|
|
86
73
|
) {
|
|
87
74
|
return SingleChainGuardAccount.LimitOrder;
|
|
@@ -105,16 +92,14 @@ export enum SingleChainGuardInstruction {
|
|
|
105
92
|
}
|
|
106
93
|
|
|
107
94
|
export function identifySingleChainGuardInstruction(
|
|
108
|
-
instruction: { data: ReadonlyUint8Array } | ReadonlyUint8Array
|
|
95
|
+
instruction: { data: ReadonlyUint8Array } | ReadonlyUint8Array,
|
|
109
96
|
): SingleChainGuardInstruction {
|
|
110
97
|
const data = 'data' in instruction ? instruction.data : instruction;
|
|
111
98
|
if (
|
|
112
99
|
containsBytes(
|
|
113
100
|
data,
|
|
114
|
-
fixEncoderSize(getBytesEncoder(), 8).encode(
|
|
115
|
-
|
|
116
|
-
),
|
|
117
|
-
0
|
|
101
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([112, 42, 45, 90, 116, 181, 13, 170])),
|
|
102
|
+
0,
|
|
118
103
|
)
|
|
119
104
|
) {
|
|
120
105
|
return SingleChainGuardInstruction.AcceptAdmin;
|
|
@@ -122,10 +107,8 @@ export function identifySingleChainGuardInstruction(
|
|
|
122
107
|
if (
|
|
123
108
|
containsBytes(
|
|
124
109
|
data,
|
|
125
|
-
fixEncoderSize(getBytesEncoder(), 8).encode(
|
|
126
|
-
|
|
127
|
-
),
|
|
128
|
-
0
|
|
110
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([60, 161, 130, 157, 181, 55, 218, 163])),
|
|
111
|
+
0,
|
|
129
112
|
)
|
|
130
113
|
) {
|
|
131
114
|
return SingleChainGuardInstruction.CancelDcaOrder;
|
|
@@ -133,10 +116,8 @@ export function identifySingleChainGuardInstruction(
|
|
|
133
116
|
if (
|
|
134
117
|
containsBytes(
|
|
135
118
|
data,
|
|
136
|
-
fixEncoderSize(getBytesEncoder(), 8).encode(
|
|
137
|
-
|
|
138
|
-
),
|
|
139
|
-
0
|
|
119
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([132, 156, 132, 31, 67, 40, 232, 97])),
|
|
120
|
+
0,
|
|
140
121
|
)
|
|
141
122
|
) {
|
|
142
123
|
return SingleChainGuardInstruction.CancelLimitOrder;
|
|
@@ -144,10 +125,8 @@ export function identifySingleChainGuardInstruction(
|
|
|
144
125
|
if (
|
|
145
126
|
containsBytes(
|
|
146
127
|
data,
|
|
147
|
-
fixEncoderSize(getBytesEncoder(), 8).encode(
|
|
148
|
-
|
|
149
|
-
),
|
|
150
|
-
0
|
|
128
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([22, 67, 23, 98, 150, 178, 70, 220])),
|
|
129
|
+
0,
|
|
151
130
|
)
|
|
152
131
|
) {
|
|
153
132
|
return SingleChainGuardInstruction.CollectProtocolFees;
|
|
@@ -155,10 +134,8 @@ export function identifySingleChainGuardInstruction(
|
|
|
155
134
|
if (
|
|
156
135
|
containsBytes(
|
|
157
136
|
data,
|
|
158
|
-
fixEncoderSize(getBytesEncoder(), 8).encode(
|
|
159
|
-
|
|
160
|
-
),
|
|
161
|
-
0
|
|
137
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([95, 66, 166, 38, 170, 3, 150, 169])),
|
|
138
|
+
0,
|
|
162
139
|
)
|
|
163
140
|
) {
|
|
164
141
|
return SingleChainGuardInstruction.CreateDcaOrder;
|
|
@@ -166,10 +143,8 @@ export function identifySingleChainGuardInstruction(
|
|
|
166
143
|
if (
|
|
167
144
|
containsBytes(
|
|
168
145
|
data,
|
|
169
|
-
fixEncoderSize(getBytesEncoder(), 8).encode(
|
|
170
|
-
|
|
171
|
-
),
|
|
172
|
-
0
|
|
146
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([251, 254, 17, 198, 219, 218, 154, 99])),
|
|
147
|
+
0,
|
|
173
148
|
)
|
|
174
149
|
) {
|
|
175
150
|
return SingleChainGuardInstruction.CreateGuard;
|
|
@@ -177,10 +152,8 @@ export function identifySingleChainGuardInstruction(
|
|
|
177
152
|
if (
|
|
178
153
|
containsBytes(
|
|
179
154
|
data,
|
|
180
|
-
fixEncoderSize(getBytesEncoder(), 8).encode(
|
|
181
|
-
|
|
182
|
-
),
|
|
183
|
-
0
|
|
155
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([76, 161, 70, 122, 82, 20, 142, 75])),
|
|
156
|
+
0,
|
|
184
157
|
)
|
|
185
158
|
) {
|
|
186
159
|
return SingleChainGuardInstruction.CreateLimitOrder;
|
|
@@ -188,10 +161,8 @@ export function identifySingleChainGuardInstruction(
|
|
|
188
161
|
if (
|
|
189
162
|
containsBytes(
|
|
190
163
|
data,
|
|
191
|
-
fixEncoderSize(getBytesEncoder(), 8).encode(
|
|
192
|
-
|
|
193
|
-
),
|
|
194
|
-
0
|
|
164
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([15, 118, 183, 60, 46, 43, 243, 244])),
|
|
165
|
+
0,
|
|
195
166
|
)
|
|
196
167
|
) {
|
|
197
168
|
return SingleChainGuardInstruction.FulfillDcaOrderInterval;
|
|
@@ -199,10 +170,8 @@ export function identifySingleChainGuardInstruction(
|
|
|
199
170
|
if (
|
|
200
171
|
containsBytes(
|
|
201
172
|
data,
|
|
202
|
-
fixEncoderSize(getBytesEncoder(), 8).encode(
|
|
203
|
-
|
|
204
|
-
),
|
|
205
|
-
0
|
|
173
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([70, 1, 151, 197, 125, 110, 46, 244])),
|
|
174
|
+
0,
|
|
206
175
|
)
|
|
207
176
|
) {
|
|
208
177
|
return SingleChainGuardInstruction.FulfillLimitOrder;
|
|
@@ -210,10 +179,8 @@ export function identifySingleChainGuardInstruction(
|
|
|
210
179
|
if (
|
|
211
180
|
containsBytes(
|
|
212
181
|
data,
|
|
213
|
-
fixEncoderSize(getBytesEncoder(), 8).encode(
|
|
214
|
-
|
|
215
|
-
),
|
|
216
|
-
0
|
|
182
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([175, 175, 109, 31, 13, 152, 155, 237])),
|
|
183
|
+
0,
|
|
217
184
|
)
|
|
218
185
|
) {
|
|
219
186
|
return SingleChainGuardInstruction.Initialize;
|
|
@@ -221,10 +188,8 @@ export function identifySingleChainGuardInstruction(
|
|
|
221
188
|
if (
|
|
222
189
|
containsBytes(
|
|
223
190
|
data,
|
|
224
|
-
fixEncoderSize(getBytesEncoder(), 8).encode(
|
|
225
|
-
|
|
226
|
-
),
|
|
227
|
-
0
|
|
191
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([251, 163, 0, 52, 91, 194, 187, 92])),
|
|
192
|
+
0,
|
|
228
193
|
)
|
|
229
194
|
) {
|
|
230
195
|
return SingleChainGuardInstruction.SetAdmin;
|
|
@@ -232,17 +197,13 @@ export function identifySingleChainGuardInstruction(
|
|
|
232
197
|
if (
|
|
233
198
|
containsBytes(
|
|
234
199
|
data,
|
|
235
|
-
fixEncoderSize(getBytesEncoder(), 8).encode(
|
|
236
|
-
|
|
237
|
-
),
|
|
238
|
-
0
|
|
200
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([153, 39, 10, 108, 220, 0, 84, 47])),
|
|
201
|
+
0,
|
|
239
202
|
)
|
|
240
203
|
) {
|
|
241
204
|
return SingleChainGuardInstruction.SetAuctioneerPubKey;
|
|
242
205
|
}
|
|
243
|
-
throw new Error(
|
|
244
|
-
'The provided instruction could not be identified as a singleChainGuard instruction.'
|
|
245
|
-
);
|
|
206
|
+
throw new Error('The provided instruction could not be identified as a singleChainGuard instruction.');
|
|
246
207
|
}
|
|
247
208
|
|
|
248
209
|
export type ParsedSingleChainGuardInstruction<
|
|
@@ -6,11 +6,7 @@
|
|
|
6
6
|
* @see https://github.com/codama-idl/codama
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import {
|
|
10
|
-
isProgramDerivedAddress,
|
|
11
|
-
type Address,
|
|
12
|
-
type ProgramDerivedAddress,
|
|
13
|
-
} from '@solana/addresses';
|
|
9
|
+
import { isProgramDerivedAddress, type Address, type ProgramDerivedAddress } from '@solana/addresses';
|
|
14
10
|
import { AccountRole, type AccountMeta, upgradeRoleToSigner } from '@solana/instructions';
|
|
15
11
|
import {
|
|
16
12
|
isTransactionSigner as kitIsTransactionSigner,
|
|
@@ -34,7 +30,7 @@ export function expectSome<T>(value: T | null | undefined): T {
|
|
|
34
30
|
* @internal
|
|
35
31
|
*/
|
|
36
32
|
export function expectAddress<T extends string = string>(
|
|
37
|
-
value: Address<T> | ProgramDerivedAddress<T> | TransactionSigner<T> | null | undefined
|
|
33
|
+
value: Address<T> | ProgramDerivedAddress<T> | TransactionSigner<T> | null | undefined,
|
|
38
34
|
): Address<T> {
|
|
39
35
|
if (!value) {
|
|
40
36
|
throw new Error('Expected a Address.');
|
|
@@ -53,7 +49,7 @@ export function expectAddress<T extends string = string>(
|
|
|
53
49
|
* @internal
|
|
54
50
|
*/
|
|
55
51
|
export function expectProgramDerivedAddress<T extends string = string>(
|
|
56
|
-
value: Address<T> | ProgramDerivedAddress<T> | TransactionSigner<T> | null | undefined
|
|
52
|
+
value: Address<T> | ProgramDerivedAddress<T> | TransactionSigner<T> | null | undefined,
|
|
57
53
|
): ProgramDerivedAddress<T> {
|
|
58
54
|
if (!value || !Array.isArray(value) || !isProgramDerivedAddress(value)) {
|
|
59
55
|
throw new Error('Expected a ProgramDerivedAddress.');
|
|
@@ -66,7 +62,7 @@ export function expectProgramDerivedAddress<T extends string = string>(
|
|
|
66
62
|
* @internal
|
|
67
63
|
*/
|
|
68
64
|
export function expectTransactionSigner<T extends string = string>(
|
|
69
|
-
value: Address<T> | ProgramDerivedAddress<T> | TransactionSigner<T> | null | undefined
|
|
65
|
+
value: Address<T> | ProgramDerivedAddress<T> | TransactionSigner<T> | null | undefined,
|
|
70
66
|
): TransactionSigner<T> {
|
|
71
67
|
if (!value || !isTransactionSigner(value)) {
|
|
72
68
|
throw new Error('Expected a TransactionSigner.');
|
|
@@ -102,10 +98,7 @@ export type InstructionWithByteDelta = {
|
|
|
102
98
|
* Get account metas and signers from resolved accounts.
|
|
103
99
|
* @internal
|
|
104
100
|
*/
|
|
105
|
-
export function getAccountMetaFactory(
|
|
106
|
-
programAddress: Address,
|
|
107
|
-
optionalAccountStrategy: 'omitted' | 'programId'
|
|
108
|
-
) {
|
|
101
|
+
export function getAccountMetaFactory(programAddress: Address, optionalAccountStrategy: 'omitted' | 'programId') {
|
|
109
102
|
return (account: ResolvedAccount): AccountMeta | AccountSignerMeta | undefined => {
|
|
110
103
|
if (!account.value) {
|
|
111
104
|
if (optionalAccountStrategy === 'omitted') return;
|
|
@@ -122,9 +115,7 @@ export function getAccountMetaFactory(
|
|
|
122
115
|
}
|
|
123
116
|
|
|
124
117
|
export function isTransactionSigner<TAddress extends string = string>(
|
|
125
|
-
value: Address<TAddress> | ProgramDerivedAddress<TAddress> | TransactionSigner<TAddress
|
|
118
|
+
value: Address<TAddress> | ProgramDerivedAddress<TAddress> | TransactionSigner<TAddress>,
|
|
126
119
|
): value is TransactionSigner<TAddress> {
|
|
127
|
-
return (
|
|
128
|
-
!!value && typeof value === 'object' && 'address' in value && kitIsTransactionSigner(value)
|
|
129
|
-
);
|
|
120
|
+
return !!value && typeof value === 'object' && 'address' in value && kitIsTransactionSigner(value);
|
|
130
121
|
}
|
|
@@ -30,9 +30,6 @@ export function getAdminUpdateStartedDecoder(): FixedSizeDecoder<AdminUpdateStar
|
|
|
30
30
|
return getStructDecoder([['newAdmin', getAddressDecoder()]]);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
export function getAdminUpdateStartedCodec(): FixedSizeCodec<
|
|
34
|
-
AdminUpdateStartedArgs,
|
|
35
|
-
AdminUpdateStarted
|
|
36
|
-
> {
|
|
33
|
+
export function getAdminUpdateStartedCodec(): FixedSizeCodec<AdminUpdateStartedArgs, AdminUpdateStarted> {
|
|
37
34
|
return combineCodec(getAdminUpdateStartedEncoder(), getAdminUpdateStartedDecoder());
|
|
38
35
|
}
|
|
@@ -30,9 +30,6 @@ export function getDcaOrderFulfilledDecoder(): FixedSizeDecoder<DcaOrderFulfille
|
|
|
30
30
|
return getStructDecoder([['orderId', getAddressDecoder()]]);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
export function getDcaOrderFulfilledCodec(): FixedSizeCodec<
|
|
34
|
-
DcaOrderFulfilledArgs,
|
|
35
|
-
DcaOrderFulfilled
|
|
36
|
-
> {
|
|
33
|
+
export function getDcaOrderFulfilledCodec(): FixedSizeCodec<DcaOrderFulfilledArgs, DcaOrderFulfilled> {
|
|
37
34
|
return combineCodec(getDcaOrderFulfilledEncoder(), getDcaOrderFulfilledDecoder());
|
|
38
35
|
}
|
|
@@ -72,9 +72,6 @@ export function getLimitOrderCreatedDecoder(): FixedSizeDecoder<LimitOrderCreate
|
|
|
72
72
|
]);
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
export function getLimitOrderCreatedCodec(): FixedSizeCodec<
|
|
76
|
-
LimitOrderCreatedArgs,
|
|
77
|
-
LimitOrderCreated
|
|
78
|
-
> {
|
|
75
|
+
export function getLimitOrderCreatedCodec(): FixedSizeCodec<LimitOrderCreatedArgs, LimitOrderCreated> {
|
|
79
76
|
return combineCodec(getLimitOrderCreatedEncoder(), getLimitOrderCreatedDecoder());
|
|
80
77
|
}
|
|
@@ -38,9 +38,6 @@ export function getLimitOrderFulfilledDecoder(): FixedSizeDecoder<LimitOrderFulf
|
|
|
38
38
|
]);
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
export function getLimitOrderFulfilledCodec(): FixedSizeCodec<
|
|
42
|
-
LimitOrderFulfilledArgs,
|
|
43
|
-
LimitOrderFulfilled
|
|
44
|
-
> {
|
|
41
|
+
export function getLimitOrderFulfilledCodec(): FixedSizeCodec<LimitOrderFulfilledArgs, LimitOrderFulfilled> {
|
|
45
42
|
return combineCodec(getLimitOrderFulfilledEncoder(), getLimitOrderFulfilledDecoder());
|
|
46
43
|
}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { ChainID } 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';
|
|
@@ -65,10 +69,10 @@ export type CreateSolanaCrossChainOrderIntentParams = {
|
|
|
65
69
|
* @returns Formatted intent request ready to send to auctioneer
|
|
66
70
|
*/
|
|
67
71
|
export function createSolanaSingleChainLimitOrderIntentRequest(
|
|
68
|
-
params: CreateSolanaSingleChainLimitOrderIntentParams
|
|
72
|
+
params: CreateSolanaSingleChainLimitOrderIntentParams,
|
|
69
73
|
): SingleChainUserIntentRequest {
|
|
70
74
|
const secretNumber = params.secretNumber || generateSolanaRandomSecretNumber();
|
|
71
|
-
|
|
75
|
+
|
|
72
76
|
const order: SingleChainOrder = {
|
|
73
77
|
user: params.user,
|
|
74
78
|
chainId: ChainID.Solana,
|
|
@@ -100,10 +104,10 @@ export function createSolanaSingleChainLimitOrderIntentRequest(
|
|
|
100
104
|
* @returns Formatted intent request ready to send to auctioneer
|
|
101
105
|
*/
|
|
102
106
|
export function createSolanaSingleChainDcaOrderIntentRequest(
|
|
103
|
-
params: CreateSolanaSingleChainDcaOrderIntentParams
|
|
107
|
+
params: CreateSolanaSingleChainDcaOrderIntentParams,
|
|
104
108
|
): DcaSingleChainUserIntentRequest {
|
|
105
109
|
const secretNumber = params.secretNumber || generateSolanaRandomSecretNumber();
|
|
106
|
-
|
|
110
|
+
|
|
107
111
|
const order: DcaSingleChainOrder = {
|
|
108
112
|
user: params.user,
|
|
109
113
|
chainId: ChainID.Solana,
|
|
@@ -136,7 +140,7 @@ export function createSolanaSingleChainDcaOrderIntentRequest(
|
|
|
136
140
|
* @returns Formatted intent request ready to send to auctioneer
|
|
137
141
|
*/
|
|
138
142
|
export function createSolanaCrossChainOrderIntentRequest(
|
|
139
|
-
params: CreateSolanaCrossChainOrderIntentParams
|
|
143
|
+
params: CreateSolanaCrossChainOrderIntentParams,
|
|
140
144
|
): CrossChainUserIntentRequest {
|
|
141
145
|
const executionDetails = {
|
|
142
146
|
destChainId: params.destinationChainId,
|
|
@@ -145,8 +149,8 @@ export function createSolanaCrossChainOrderIntentRequest(
|
|
|
145
149
|
destinationAddress: params.destinationAddress,
|
|
146
150
|
extraTransfers: params.extraTransfers,
|
|
147
151
|
stopLossMaxOut: params.stopLossMaxOut?.toString(),
|
|
148
|
-
takeProfitMinOut: params.takeProfitMinOut?.toString()
|
|
149
|
-
}
|
|
152
|
+
takeProfitMinOut: params.takeProfitMinOut?.toString(),
|
|
153
|
+
};
|
|
150
154
|
const executionDetailsString = JSON.stringify(executionDetails, Parsers.bigIntReplacer);
|
|
151
155
|
|
|
152
156
|
// Calculate execution details hash
|
|
@@ -213,19 +217,19 @@ export function generateSolanaLimitOrderSecretData(
|
|
|
213
217
|
tokenOut: string,
|
|
214
218
|
receiver: string,
|
|
215
219
|
secretNumber?: string,
|
|
216
|
-
extraTransfers?: ExtraTransfer[]
|
|
220
|
+
extraTransfers?: ExtraTransfer[],
|
|
217
221
|
): { secretNumber: string; secretData: any } {
|
|
218
222
|
const secret = secretNumber || generateSolanaRandomSecretNumber();
|
|
219
|
-
|
|
223
|
+
|
|
220
224
|
const { PublicKey } = require('@solana/web3.js');
|
|
221
225
|
const secretData = prepareSecretData(
|
|
222
226
|
new PublicKey(tokenOut),
|
|
223
227
|
new PublicKey(receiver),
|
|
224
|
-
extraTransfers?.map(t => ({
|
|
228
|
+
extraTransfers?.map((t) => ({
|
|
225
229
|
token: new PublicKey(t.token),
|
|
226
230
|
receiver: new PublicKey(t.receiver),
|
|
227
231
|
amount: t.amount.toString(),
|
|
228
|
-
})) || []
|
|
232
|
+
})) || [],
|
|
229
233
|
);
|
|
230
234
|
|
|
231
235
|
return {
|
|
@@ -246,19 +250,19 @@ export function generateSolanaDcaOrderSecretData(
|
|
|
246
250
|
tokenOut: string,
|
|
247
251
|
receiver: string,
|
|
248
252
|
secretNumber?: string,
|
|
249
|
-
extraTransfers?: ExtraTransfer[]
|
|
253
|
+
extraTransfers?: ExtraTransfer[],
|
|
250
254
|
): { secretNumber: string; secretData: any } {
|
|
251
255
|
const secret = secretNumber || generateSolanaRandomSecretNumber();
|
|
252
|
-
|
|
256
|
+
|
|
253
257
|
const { PublicKey } = require('@solana/web3.js');
|
|
254
258
|
const secretData = prepareDcaSecretData(
|
|
255
259
|
new PublicKey(tokenOut),
|
|
256
260
|
new PublicKey(receiver),
|
|
257
|
-
extraTransfers?.map(t => ({
|
|
261
|
+
extraTransfers?.map((t) => ({
|
|
258
262
|
token: new PublicKey(t.token),
|
|
259
263
|
receiver: new PublicKey(t.receiver),
|
|
260
264
|
amount: t.amount.toString(),
|
|
261
|
-
})) || []
|
|
265
|
+
})) || [],
|
|
262
266
|
);
|
|
263
267
|
|
|
264
268
|
return {
|
package/src/core/solana/sdk.ts
CHANGED
|
@@ -98,7 +98,7 @@ export class SolanaSDK extends BaseSDK {
|
|
|
98
98
|
const myTx = compileTransaction(transactionMessage);
|
|
99
99
|
|
|
100
100
|
const signature = await signTransaction([signerKeyPair], myTx);
|
|
101
|
-
|
|
101
|
+
|
|
102
102
|
assertIsSendableTransaction(signature);
|
|
103
103
|
|
|
104
104
|
await this.client.sendAndConfirmTransaction(signature, {
|
package/src/core/solana/utils.ts
CHANGED
|
@@ -5,40 +5,37 @@ import sha3 from 'js-sha3';
|
|
|
5
5
|
import type { DcaSingleChainOrder } from '../orders/dca-single-chain.js';
|
|
6
6
|
|
|
7
7
|
export function genSecretHashAndNumber(order: SingleChainOrder | DcaSingleChainOrder): {
|
|
8
|
-
secretHash: number[]
|
|
9
|
-
secretNumber: string
|
|
8
|
+
secretHash: number[];
|
|
9
|
+
secretNumber: string;
|
|
10
10
|
} {
|
|
11
|
-
const rawTokenOut = new PublicKey(order.tokenOut)
|
|
12
|
-
const tokenOut = formatTokenPubkey(rawTokenOut)
|
|
13
|
-
const receiver = new PublicKey(order.destinationAddress)
|
|
11
|
+
const rawTokenOut = new PublicKey(order.tokenOut);
|
|
12
|
+
const tokenOut = formatTokenPubkey(rawTokenOut);
|
|
13
|
+
const receiver = new PublicKey(order.destinationAddress);
|
|
14
14
|
|
|
15
|
-
const extraTransfers = order.extraTransfers ?? []
|
|
16
|
-
const secretNumber = new BN(crypto.getRandomValues(new Uint8Array(8)))
|
|
15
|
+
const extraTransfers = order.extraTransfers ?? [];
|
|
16
|
+
const secretNumber = new BN(crypto.getRandomValues(new Uint8Array(8)));
|
|
17
17
|
|
|
18
18
|
const fullArray = [
|
|
19
19
|
...tokenOut.toBuffer(),
|
|
20
20
|
...receiver.toBuffer(),
|
|
21
21
|
...Buffer.concat(
|
|
22
22
|
extraTransfers.map((t) =>
|
|
23
|
-
Buffer.concat([
|
|
24
|
-
new PublicKey(t.token).toBuffer(),
|
|
25
|
-
new PublicKey(t.receiver).toBuffer(),
|
|
26
|
-
]),
|
|
23
|
+
Buffer.concat([new PublicKey(t.token).toBuffer(), new PublicKey(t.receiver).toBuffer()]),
|
|
27
24
|
),
|
|
28
25
|
),
|
|
29
|
-
...secretNumber.toArrayLike(Buffer,
|
|
30
|
-
]
|
|
26
|
+
...secretNumber.toArrayLike(Buffer, 'le', 8),
|
|
27
|
+
];
|
|
31
28
|
|
|
32
|
-
const value = sha3.keccak256(Uint8Array.from(fullArray))
|
|
33
|
-
const secretHash = [...Uint8Array.from(Buffer.from(value,
|
|
29
|
+
const value = sha3.keccak256(Uint8Array.from(fullArray));
|
|
30
|
+
const secretHash = [...Uint8Array.from(Buffer.from(value, 'hex'))];
|
|
34
31
|
|
|
35
|
-
return { secretHash, secretNumber: secretNumber.toString() }
|
|
32
|
+
return { secretHash, secretNumber: secretNumber.toString() };
|
|
36
33
|
}
|
|
37
34
|
|
|
38
35
|
export function formatTokenPubkey(token: PublicKey) {
|
|
39
|
-
if (token.equals(new PublicKey(
|
|
40
|
-
return PublicKey.default
|
|
36
|
+
if (token.equals(new PublicKey('So11111111111111111111111111111111111111111'))) {
|
|
37
|
+
return PublicKey.default;
|
|
41
38
|
}
|
|
42
39
|
|
|
43
40
|
return token;
|
|
44
|
-
}
|
|
41
|
+
}
|