@shogun-sdk/swap 0.0.2-test.28 → 0.0.2-test.29
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/core.cjs +307 -0
- package/dist/core.d.cts +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +317 -0
- package/dist/{index-CapCmdE-.d.cts → index-6Wt_Nfub.d.cts} +18 -1
- package/dist/{index-BYkOqhW8.d.ts → index-DdO3mOAE.d.ts} +18 -1
- package/dist/index.cjs +307 -0
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +317 -0
- package/dist/react.cjs +348 -0
- package/dist/react.d.cts +32 -4
- package/dist/react.d.ts +32 -4
- package/dist/react.js +358 -0
- package/package.json +1 -1
package/dist/react.cjs
CHANGED
|
@@ -39,6 +39,7 @@ __export(react_exports, {
|
|
|
39
39
|
buildQuoteParams: () => buildQuoteParams,
|
|
40
40
|
isEvmChain: () => isEvmChain,
|
|
41
41
|
useBalances: () => useBalances,
|
|
42
|
+
useCancelOrder: () => useCancelOrder,
|
|
42
43
|
useExecuteTransaction: () => useExecuteTransaction,
|
|
43
44
|
useOrders: () => useOrders,
|
|
44
45
|
useQuote: () => useQuote,
|
|
@@ -986,6 +987,294 @@ async function getOrders({
|
|
|
986
987
|
return orders;
|
|
987
988
|
}
|
|
988
989
|
|
|
990
|
+
// src/core/orders/cancelOrder.ts
|
|
991
|
+
var import_intents_sdk14 = require("@shogun-sdk/intents-sdk");
|
|
992
|
+
var import_web32 = require("@solana/web3.js");
|
|
993
|
+
var import_viem8 = require("viem");
|
|
994
|
+
async function cancelIntentsOrder({
|
|
995
|
+
order,
|
|
996
|
+
wallet,
|
|
997
|
+
sol_rpc
|
|
998
|
+
}) {
|
|
999
|
+
const isCrossChain = "srcChainId" in order && "destChainId" in order && order.srcChainId !== order.destChainId;
|
|
1000
|
+
const srcChain = "srcChainId" in order ? order.srcChainId : order.chainId;
|
|
1001
|
+
const isSolanaOrder = srcChain === import_intents_sdk14.ChainID.Solana;
|
|
1002
|
+
if (isSolanaOrder) {
|
|
1003
|
+
if (!isCrossChain) {
|
|
1004
|
+
const { versionedMessageBytes: versionedMessageBytes2 } = await (0, import_intents_sdk14.cancelSingleChainOrderInstructionsAsBytes)(
|
|
1005
|
+
order.orderId,
|
|
1006
|
+
order.user,
|
|
1007
|
+
{ rpcUrl: sol_rpc }
|
|
1008
|
+
);
|
|
1009
|
+
const message2 = import_web32.VersionedMessage.deserialize(
|
|
1010
|
+
versionedMessageBytes2
|
|
1011
|
+
);
|
|
1012
|
+
const tx2 = new import_web32.VersionedTransaction(message2);
|
|
1013
|
+
return await wallet.sendTransaction(tx2);
|
|
1014
|
+
}
|
|
1015
|
+
const { versionedMessageBytes } = await (0, import_intents_sdk14.cancelCrossChainOrderInstructionsAsBytes)(
|
|
1016
|
+
order.orderId,
|
|
1017
|
+
order.user,
|
|
1018
|
+
{ rpcUrl: sol_rpc }
|
|
1019
|
+
);
|
|
1020
|
+
const message = import_web32.VersionedMessage.deserialize(
|
|
1021
|
+
versionedMessageBytes
|
|
1022
|
+
);
|
|
1023
|
+
const tx = new import_web32.VersionedTransaction(message);
|
|
1024
|
+
return await wallet.sendTransaction(tx);
|
|
1025
|
+
}
|
|
1026
|
+
const chainId = srcChain;
|
|
1027
|
+
const { readContract } = wallet;
|
|
1028
|
+
if (!readContract) {
|
|
1029
|
+
throw new Error("Wallet does not support readContract");
|
|
1030
|
+
}
|
|
1031
|
+
const nonce = BigInt(order.nonce ?? "0");
|
|
1032
|
+
const nonceWordPos = nonce >> 8n;
|
|
1033
|
+
const nonceBitPos = nonce - nonceWordPos * 256n;
|
|
1034
|
+
if (isCrossChain) {
|
|
1035
|
+
const [orderData = [false, false], currentNonceBitmap = 0n] = await Promise.all([
|
|
1036
|
+
readContract({
|
|
1037
|
+
address: import_intents_sdk14.CROSS_CHAIN_GUARD_ADDRESSES[chainId],
|
|
1038
|
+
abi: [
|
|
1039
|
+
{
|
|
1040
|
+
inputs: [{ name: "orderId", type: "bytes32" }],
|
|
1041
|
+
name: "orderData",
|
|
1042
|
+
outputs: [
|
|
1043
|
+
{ name: "initialized", type: "bool" },
|
|
1044
|
+
{ name: "deactivated", type: "bool" }
|
|
1045
|
+
],
|
|
1046
|
+
stateMutability: "view",
|
|
1047
|
+
type: "function"
|
|
1048
|
+
}
|
|
1049
|
+
],
|
|
1050
|
+
functionName: "orderData",
|
|
1051
|
+
args: [order.orderId]
|
|
1052
|
+
}),
|
|
1053
|
+
readContract({
|
|
1054
|
+
address: import_intents_sdk14.PERMIT2_ADDRESS[chainId],
|
|
1055
|
+
abi: [
|
|
1056
|
+
{
|
|
1057
|
+
inputs: [
|
|
1058
|
+
{ name: "owner", type: "address" },
|
|
1059
|
+
{ name: "wordPos", type: "uint256" }
|
|
1060
|
+
],
|
|
1061
|
+
name: "nonceBitmap",
|
|
1062
|
+
outputs: [{ name: "", type: "uint256" }],
|
|
1063
|
+
stateMutability: "view",
|
|
1064
|
+
type: "function"
|
|
1065
|
+
}
|
|
1066
|
+
],
|
|
1067
|
+
functionName: "nonceBitmap",
|
|
1068
|
+
args: [order.user, nonceWordPos]
|
|
1069
|
+
})
|
|
1070
|
+
]);
|
|
1071
|
+
const [initialized, deactivated] = orderData;
|
|
1072
|
+
if (initialized) {
|
|
1073
|
+
if (deactivated) {
|
|
1074
|
+
throw new Error("Order is already deactivated");
|
|
1075
|
+
}
|
|
1076
|
+
return await wallet.sendTransaction({
|
|
1077
|
+
to: import_intents_sdk14.CROSS_CHAIN_GUARD_ADDRESSES[order.srcChainId],
|
|
1078
|
+
data: (0, import_viem8.encodeFunctionData)({
|
|
1079
|
+
abi: [
|
|
1080
|
+
{
|
|
1081
|
+
inputs: [
|
|
1082
|
+
{
|
|
1083
|
+
components: [
|
|
1084
|
+
{ name: "user", type: "address" },
|
|
1085
|
+
{ name: "tokenIn", type: "address" },
|
|
1086
|
+
{ name: "srcChainId", type: "uint256" },
|
|
1087
|
+
{ name: "deadline", type: "uint256" },
|
|
1088
|
+
{ name: "amountIn", type: "uint256" },
|
|
1089
|
+
{ name: "minStablecoinsAmount", type: "uint256" },
|
|
1090
|
+
{ name: "executionDetailsHash", type: "bytes32" },
|
|
1091
|
+
{ name: "nonce", type: "uint256" }
|
|
1092
|
+
],
|
|
1093
|
+
name: "orderInfo",
|
|
1094
|
+
type: "tuple"
|
|
1095
|
+
}
|
|
1096
|
+
],
|
|
1097
|
+
name: "cancelOrder",
|
|
1098
|
+
outputs: [],
|
|
1099
|
+
stateMutability: "nonpayable",
|
|
1100
|
+
type: "function"
|
|
1101
|
+
}
|
|
1102
|
+
],
|
|
1103
|
+
functionName: "cancelOrder",
|
|
1104
|
+
args: [
|
|
1105
|
+
{
|
|
1106
|
+
user: order.user,
|
|
1107
|
+
tokenIn: order.tokenIn,
|
|
1108
|
+
srcChainId: BigInt(order.srcChainId),
|
|
1109
|
+
deadline: BigInt(order.deadline),
|
|
1110
|
+
amountIn: BigInt(order.amountIn),
|
|
1111
|
+
minStablecoinsAmount: BigInt(order.minStablecoinsAmount),
|
|
1112
|
+
executionDetailsHash: order.executionDetailsHash,
|
|
1113
|
+
nonce
|
|
1114
|
+
}
|
|
1115
|
+
]
|
|
1116
|
+
}),
|
|
1117
|
+
value: BigInt(0),
|
|
1118
|
+
from: order.user
|
|
1119
|
+
});
|
|
1120
|
+
} else {
|
|
1121
|
+
if ((currentNonceBitmap & 1n << nonceBitPos) !== 0n) {
|
|
1122
|
+
throw new Error("Nonce is already invalidated");
|
|
1123
|
+
}
|
|
1124
|
+
const mask2 = 1n << nonceBitPos;
|
|
1125
|
+
return await wallet.sendTransaction({
|
|
1126
|
+
to: import_intents_sdk14.PERMIT2_ADDRESS[order.srcChainId],
|
|
1127
|
+
data: (0, import_viem8.encodeFunctionData)({
|
|
1128
|
+
abi: [
|
|
1129
|
+
{
|
|
1130
|
+
inputs: [
|
|
1131
|
+
{ name: "wordPos", type: "uint256" },
|
|
1132
|
+
{ name: "mask", type: "uint256" }
|
|
1133
|
+
],
|
|
1134
|
+
name: "invalidateUnorderedNonces",
|
|
1135
|
+
outputs: [],
|
|
1136
|
+
stateMutability: "nonpayable",
|
|
1137
|
+
type: "function"
|
|
1138
|
+
}
|
|
1139
|
+
],
|
|
1140
|
+
functionName: "invalidateUnorderedNonces",
|
|
1141
|
+
args: [nonceWordPos, mask2]
|
|
1142
|
+
}),
|
|
1143
|
+
value: BigInt(0),
|
|
1144
|
+
from: order.user
|
|
1145
|
+
});
|
|
1146
|
+
}
|
|
1147
|
+
}
|
|
1148
|
+
const [wasManuallyInitialized, currentBitmap = 0n] = await Promise.all([
|
|
1149
|
+
readContract({
|
|
1150
|
+
address: import_intents_sdk14.SINGLE_CHAIN_GUARD_ADDRESSES[chainId],
|
|
1151
|
+
abi: [
|
|
1152
|
+
{
|
|
1153
|
+
inputs: [{ name: "orderHash", type: "bytes32" }],
|
|
1154
|
+
name: "orderManuallyInitialized",
|
|
1155
|
+
outputs: [{ name: "", type: "bool" }],
|
|
1156
|
+
stateMutability: "view",
|
|
1157
|
+
type: "function"
|
|
1158
|
+
}
|
|
1159
|
+
],
|
|
1160
|
+
functionName: "orderManuallyInitialized",
|
|
1161
|
+
args: [order.orderId]
|
|
1162
|
+
}),
|
|
1163
|
+
readContract({
|
|
1164
|
+
address: import_intents_sdk14.PERMIT2_ADDRESS[chainId],
|
|
1165
|
+
abi: [
|
|
1166
|
+
{
|
|
1167
|
+
inputs: [
|
|
1168
|
+
{ name: "owner", type: "address" },
|
|
1169
|
+
{ name: "wordPos", type: "uint256" }
|
|
1170
|
+
],
|
|
1171
|
+
name: "nonceBitmap",
|
|
1172
|
+
outputs: [{ name: "", type: "uint256" }],
|
|
1173
|
+
stateMutability: "view",
|
|
1174
|
+
type: "function"
|
|
1175
|
+
}
|
|
1176
|
+
],
|
|
1177
|
+
functionName: "nonceBitmap",
|
|
1178
|
+
args: [order.user, nonceWordPos]
|
|
1179
|
+
})
|
|
1180
|
+
]);
|
|
1181
|
+
if (wasManuallyInitialized) {
|
|
1182
|
+
return await wallet.sendTransaction({
|
|
1183
|
+
to: import_intents_sdk14.SINGLE_CHAIN_GUARD_ADDRESSES[chainId],
|
|
1184
|
+
data: (0, import_viem8.encodeFunctionData)({
|
|
1185
|
+
abi: [
|
|
1186
|
+
{
|
|
1187
|
+
inputs: [
|
|
1188
|
+
{
|
|
1189
|
+
name: "order",
|
|
1190
|
+
type: "tuple",
|
|
1191
|
+
components: [
|
|
1192
|
+
{ name: "amountIn", type: "uint256" },
|
|
1193
|
+
{ name: "tokenIn", type: "address" },
|
|
1194
|
+
{ name: "deadline", type: "uint256" },
|
|
1195
|
+
{ name: "nonce", type: "uint256" },
|
|
1196
|
+
{ name: "encodedExternalCallData", type: "bytes" },
|
|
1197
|
+
{
|
|
1198
|
+
name: "extraTransfers",
|
|
1199
|
+
type: "tuple[]",
|
|
1200
|
+
components: [
|
|
1201
|
+
{ name: "amount", type: "uint256" },
|
|
1202
|
+
{ name: "receiver", type: "address" },
|
|
1203
|
+
{ name: "token", type: "address" }
|
|
1204
|
+
]
|
|
1205
|
+
},
|
|
1206
|
+
{
|
|
1207
|
+
name: "requestedOutput",
|
|
1208
|
+
type: "tuple",
|
|
1209
|
+
components: [
|
|
1210
|
+
{ name: "amount", type: "uint256" },
|
|
1211
|
+
{ name: "receiver", type: "address" },
|
|
1212
|
+
{ name: "token", type: "address" }
|
|
1213
|
+
]
|
|
1214
|
+
},
|
|
1215
|
+
{ name: "user", type: "address" }
|
|
1216
|
+
]
|
|
1217
|
+
}
|
|
1218
|
+
],
|
|
1219
|
+
name: "cancelManuallyCreatedOrder",
|
|
1220
|
+
outputs: [],
|
|
1221
|
+
stateMutability: "nonpayable",
|
|
1222
|
+
type: "function"
|
|
1223
|
+
}
|
|
1224
|
+
],
|
|
1225
|
+
functionName: "cancelManuallyCreatedOrder",
|
|
1226
|
+
args: [
|
|
1227
|
+
{
|
|
1228
|
+
amountIn: BigInt(order.amountIn),
|
|
1229
|
+
tokenIn: order.tokenIn,
|
|
1230
|
+
deadline: BigInt(order.deadline),
|
|
1231
|
+
nonce,
|
|
1232
|
+
encodedExternalCallData: "0x",
|
|
1233
|
+
extraTransfers: (order.extraTransfers || []).map((t) => ({
|
|
1234
|
+
amount: BigInt(t.amount),
|
|
1235
|
+
receiver: t.receiver,
|
|
1236
|
+
token: t.token
|
|
1237
|
+
})),
|
|
1238
|
+
requestedOutput: {
|
|
1239
|
+
amount: BigInt(order.amountOutMin),
|
|
1240
|
+
receiver: order.destinationAddress,
|
|
1241
|
+
token: order.tokenOut
|
|
1242
|
+
},
|
|
1243
|
+
user: order.user
|
|
1244
|
+
}
|
|
1245
|
+
]
|
|
1246
|
+
}),
|
|
1247
|
+
value: 0n,
|
|
1248
|
+
from: order.user
|
|
1249
|
+
});
|
|
1250
|
+
}
|
|
1251
|
+
const mask = 1n << nonceBitPos;
|
|
1252
|
+
if ((currentBitmap & mask) !== 0n) {
|
|
1253
|
+
throw new Error("Nonce is already invalidated");
|
|
1254
|
+
}
|
|
1255
|
+
return await wallet.sendTransaction({
|
|
1256
|
+
to: import_intents_sdk14.PERMIT2_ADDRESS[chainId],
|
|
1257
|
+
data: (0, import_viem8.encodeFunctionData)({
|
|
1258
|
+
abi: [
|
|
1259
|
+
{
|
|
1260
|
+
inputs: [
|
|
1261
|
+
{ name: "wordPos", type: "uint256" },
|
|
1262
|
+
{ name: "mask", type: "uint256" }
|
|
1263
|
+
],
|
|
1264
|
+
name: "invalidateUnorderedNonces",
|
|
1265
|
+
outputs: [],
|
|
1266
|
+
stateMutability: "nonpayable",
|
|
1267
|
+
type: "function"
|
|
1268
|
+
}
|
|
1269
|
+
],
|
|
1270
|
+
functionName: "invalidateUnorderedNonces",
|
|
1271
|
+
args: [nonceWordPos, mask]
|
|
1272
|
+
}),
|
|
1273
|
+
value: 0n,
|
|
1274
|
+
from: order.user
|
|
1275
|
+
});
|
|
1276
|
+
}
|
|
1277
|
+
|
|
989
1278
|
// src/core/client.ts
|
|
990
1279
|
var SwapSDK = class {
|
|
991
1280
|
constructor(config) {
|
|
@@ -1146,6 +1435,25 @@ var SwapSDK = class {
|
|
|
1146
1435
|
async getOrders(params) {
|
|
1147
1436
|
return getOrders(params);
|
|
1148
1437
|
}
|
|
1438
|
+
/**
|
|
1439
|
+
* Cancels an order (single-chain or cross-chain) on EVM or Solana.
|
|
1440
|
+
*
|
|
1441
|
+
* Internally routes to the correct guard contract or Solana program to
|
|
1442
|
+
* deactivate the order or invalidate its nonce.
|
|
1443
|
+
*
|
|
1444
|
+
* @param params.order - Order payload returned from the Intents API.
|
|
1445
|
+
* @param params.wallet - Adapted wallet used to submit the cancellation transaction.
|
|
1446
|
+
* @param params.solRpc - Solana RPC URL used for SVM cancellations.
|
|
1447
|
+
*
|
|
1448
|
+
* @returns A transaction signature or hash from the underlying wallet.
|
|
1449
|
+
*/
|
|
1450
|
+
async cancelOrder(params) {
|
|
1451
|
+
return cancelIntentsOrder({
|
|
1452
|
+
order: params.order,
|
|
1453
|
+
wallet: params.wallet,
|
|
1454
|
+
sol_rpc: params.solRpc
|
|
1455
|
+
});
|
|
1456
|
+
}
|
|
1149
1457
|
};
|
|
1150
1458
|
|
|
1151
1459
|
// src/react/SwapProvider.tsx
|
|
@@ -1560,3 +1868,43 @@ function useOrders(initialAddresses) {
|
|
|
1560
1868
|
[data, loading, error, refetch, setAddresses]
|
|
1561
1869
|
);
|
|
1562
1870
|
}
|
|
1871
|
+
|
|
1872
|
+
// src/react/useCancelOrder.ts
|
|
1873
|
+
var import_react8 = require("react");
|
|
1874
|
+
var import_swr4 = require("swr");
|
|
1875
|
+
function useCancelOrder() {
|
|
1876
|
+
const sdk = useSwap();
|
|
1877
|
+
const [isLoading, setLoading] = (0, import_react8.useState)(false);
|
|
1878
|
+
const [error, setError] = (0, import_react8.useState)(null);
|
|
1879
|
+
const [result, setResult] = (0, import_react8.useState)(null);
|
|
1880
|
+
const cancel = (0, import_react8.useCallback)(
|
|
1881
|
+
async (params) => {
|
|
1882
|
+
setLoading(true);
|
|
1883
|
+
setError(null);
|
|
1884
|
+
setResult(null);
|
|
1885
|
+
try {
|
|
1886
|
+
const tx = await sdk.cancelOrder({
|
|
1887
|
+
order: params.order,
|
|
1888
|
+
wallet: params.wallet,
|
|
1889
|
+
solRpc: params.solRpc
|
|
1890
|
+
});
|
|
1891
|
+
setResult(tx);
|
|
1892
|
+
void (0, import_swr4.mutate)("orders-global");
|
|
1893
|
+
return tx;
|
|
1894
|
+
} catch (err) {
|
|
1895
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
1896
|
+
setError(msg);
|
|
1897
|
+
throw err;
|
|
1898
|
+
} finally {
|
|
1899
|
+
setLoading(false);
|
|
1900
|
+
}
|
|
1901
|
+
},
|
|
1902
|
+
[sdk]
|
|
1903
|
+
);
|
|
1904
|
+
return {
|
|
1905
|
+
cancel,
|
|
1906
|
+
isLoading,
|
|
1907
|
+
error,
|
|
1908
|
+
result
|
|
1909
|
+
};
|
|
1910
|
+
}
|
package/dist/react.d.cts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { S as SwapSDKConfig, a as SwapSDK, b as SwapQuoteParams, c as SwapQuoteResponse, E as ExecuteOrderParams, d as Stage, P as PlaceOrderResult, T as TokenInfo, B as BalanceRequestParams, e as BalanceResponse } from './index-
|
|
3
|
-
export { C as ChainId, O as OrderExecutionType, j as SupportedChain, g as SupportedChains, h as TokenBalance, f as buildQuoteParams, i as isEvmChain } from './index-
|
|
2
|
+
import { S as SwapSDKConfig, a as SwapSDK, b as SwapQuoteParams, c as SwapQuoteResponse, E as ExecuteOrderParams, d as Stage, P as PlaceOrderResult, T as TokenInfo, B as BalanceRequestParams, e as BalanceResponse } from './index-6Wt_Nfub.cjs';
|
|
3
|
+
export { C as ChainId, O as OrderExecutionType, j as SupportedChain, g as SupportedChains, h as TokenBalance, f as buildQuoteParams, i as isEvmChain } from './index-6Wt_Nfub.cjs';
|
|
4
4
|
import { WalletClient } from 'viem';
|
|
5
5
|
import { A as AdaptedWallet } from './wallet-B9bKceyN.cjs';
|
|
6
|
-
import { ApiUserOrders } from '@shogun-sdk/intents-sdk';
|
|
6
|
+
import { ApiUserOrders, ApiCrossChainOrder, ApiSingleChainOrder } from '@shogun-sdk/intents-sdk';
|
|
7
7
|
import '@solana/web3.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -297,4 +297,32 @@ declare function useOrders(initialAddresses?: {
|
|
|
297
297
|
} | null;
|
|
298
298
|
};
|
|
299
299
|
|
|
300
|
-
|
|
300
|
+
/**
|
|
301
|
+
* `useCancelOrder`
|
|
302
|
+
*
|
|
303
|
+
* React hook to cancel an intents order (single-chain or cross-chain) on EVM or Solana.
|
|
304
|
+
* Returns helpers for loading/error state and the resulting transaction hash/signature.
|
|
305
|
+
*
|
|
306
|
+
* @example
|
|
307
|
+
* ```tsx
|
|
308
|
+
* const { cancel, isLoading, error, result } = useCancelOrder();
|
|
309
|
+
*
|
|
310
|
+
* await cancel({
|
|
311
|
+
* order,
|
|
312
|
+
* wallet, // AdaptedWallet instance
|
|
313
|
+
* solRpc: "https://api.mainnet-beta.solana.com",
|
|
314
|
+
* });
|
|
315
|
+
* ```
|
|
316
|
+
*/
|
|
317
|
+
declare function useCancelOrder(): {
|
|
318
|
+
cancel: (params: {
|
|
319
|
+
order: ApiCrossChainOrder | ApiSingleChainOrder;
|
|
320
|
+
wallet: AdaptedWallet;
|
|
321
|
+
solRpc: string;
|
|
322
|
+
}) => Promise<string>;
|
|
323
|
+
isLoading: boolean;
|
|
324
|
+
error: string | null;
|
|
325
|
+
result: string | null;
|
|
326
|
+
};
|
|
327
|
+
|
|
328
|
+
export { BalanceRequestParams, BalanceResponse, SwapProvider, SwapQuoteParams, SwapQuoteResponse, useBalances, useCancelOrder, useExecuteTransaction, useOrders, useQuote, useSwap, useTokenList, useTokensData };
|
package/dist/react.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { S as SwapSDKConfig, a as SwapSDK, b as SwapQuoteParams, c as SwapQuoteResponse, E as ExecuteOrderParams, d as Stage, P as PlaceOrderResult, T as TokenInfo, B as BalanceRequestParams, e as BalanceResponse } from './index-
|
|
3
|
-
export { C as ChainId, O as OrderExecutionType, j as SupportedChain, g as SupportedChains, h as TokenBalance, f as buildQuoteParams, i as isEvmChain } from './index-
|
|
2
|
+
import { S as SwapSDKConfig, a as SwapSDK, b as SwapQuoteParams, c as SwapQuoteResponse, E as ExecuteOrderParams, d as Stage, P as PlaceOrderResult, T as TokenInfo, B as BalanceRequestParams, e as BalanceResponse } from './index-DdO3mOAE.js';
|
|
3
|
+
export { C as ChainId, O as OrderExecutionType, j as SupportedChain, g as SupportedChains, h as TokenBalance, f as buildQuoteParams, i as isEvmChain } from './index-DdO3mOAE.js';
|
|
4
4
|
import { WalletClient } from 'viem';
|
|
5
5
|
import { A as AdaptedWallet } from './wallet-B9bKceyN.js';
|
|
6
|
-
import { ApiUserOrders } from '@shogun-sdk/intents-sdk';
|
|
6
|
+
import { ApiUserOrders, ApiCrossChainOrder, ApiSingleChainOrder } from '@shogun-sdk/intents-sdk';
|
|
7
7
|
import '@solana/web3.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -297,4 +297,32 @@ declare function useOrders(initialAddresses?: {
|
|
|
297
297
|
} | null;
|
|
298
298
|
};
|
|
299
299
|
|
|
300
|
-
|
|
300
|
+
/**
|
|
301
|
+
* `useCancelOrder`
|
|
302
|
+
*
|
|
303
|
+
* React hook to cancel an intents order (single-chain or cross-chain) on EVM or Solana.
|
|
304
|
+
* Returns helpers for loading/error state and the resulting transaction hash/signature.
|
|
305
|
+
*
|
|
306
|
+
* @example
|
|
307
|
+
* ```tsx
|
|
308
|
+
* const { cancel, isLoading, error, result } = useCancelOrder();
|
|
309
|
+
*
|
|
310
|
+
* await cancel({
|
|
311
|
+
* order,
|
|
312
|
+
* wallet, // AdaptedWallet instance
|
|
313
|
+
* solRpc: "https://api.mainnet-beta.solana.com",
|
|
314
|
+
* });
|
|
315
|
+
* ```
|
|
316
|
+
*/
|
|
317
|
+
declare function useCancelOrder(): {
|
|
318
|
+
cancel: (params: {
|
|
319
|
+
order: ApiCrossChainOrder | ApiSingleChainOrder;
|
|
320
|
+
wallet: AdaptedWallet;
|
|
321
|
+
solRpc: string;
|
|
322
|
+
}) => Promise<string>;
|
|
323
|
+
isLoading: boolean;
|
|
324
|
+
error: string | null;
|
|
325
|
+
result: string | null;
|
|
326
|
+
};
|
|
327
|
+
|
|
328
|
+
export { BalanceRequestParams, BalanceResponse, SwapProvider, SwapQuoteParams, SwapQuoteResponse, useBalances, useCancelOrder, useExecuteTransaction, useOrders, useQuote, useSwap, useTokenList, useTokensData };
|