@rabby-wallet/rabby-action 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -0
- package/dist/actions/approveNFT/fetchData.d.ts +4 -0
- package/dist/actions/approveNFT/fetchData.js +60 -0
- package/dist/actions/approveNFT/formatSecurityEngine.d.ts +2 -0
- package/dist/actions/approveNFT/formatSecurityEngine.js +31 -0
- package/dist/actions/approveNFT/parseAction.d.ts +2 -0
- package/dist/actions/approveNFT/parseAction.js +9 -0
- package/dist/actions/approveNFTCollection/fetchData.d.ts +2 -0
- package/dist/actions/approveNFTCollection/fetchData.js +19 -0
- package/dist/actions/approveNFTCollection/formatSecurityEngine.d.ts +2 -0
- package/dist/actions/approveNFTCollection/formatSecurityEngine.js +31 -0
- package/dist/actions/approveNFTCollection/parseAction.d.ts +2 -0
- package/dist/actions/approveNFTCollection/parseAction.js +9 -0
- package/dist/actions/approveToken/fetchData.d.ts +6 -0
- package/dist/actions/approveToken/fetchData.js +64 -0
- package/dist/actions/approveToken/formatSecurityEngine.d.ts +2 -0
- package/dist/actions/approveToken/formatSecurityEngine.js +31 -0
- package/dist/actions/approveToken/parseAction.d.ts +2 -0
- package/dist/actions/approveToken/parseAction.js +13 -0
- package/dist/actions/assetOrder/fetchData.d.ts +2 -0
- package/dist/actions/assetOrder/fetchData.js +29 -0
- package/dist/actions/assetOrder/formatSecurityEngine.d.ts +2 -0
- package/dist/actions/assetOrder/formatSecurityEngine.js +30 -0
- package/dist/actions/assetOrder/parseAction.d.ts +2 -0
- package/dist/actions/assetOrder/parseAction.js +18 -0
- package/dist/actions/batchPermit2/fetchData.d.ts +2 -0
- package/dist/actions/batchPermit2/fetchData.js +65 -0
- package/dist/actions/batchPermit2/formatSecurityEngine.d.ts +2 -0
- package/dist/actions/batchPermit2/formatSecurityEngine.js +30 -0
- package/dist/actions/batchPermit2/parseAction.d.ts +2 -0
- package/dist/actions/batchPermit2/parseAction.js +9 -0
- package/dist/actions/batchSellNFT/fetchData.d.ts +2 -0
- package/dist/actions/batchSellNFT/fetchData.js +21 -0
- package/dist/actions/batchSellNFT/formatSecurityEngine.d.ts +2 -0
- package/dist/actions/batchSellNFT/formatSecurityEngine.js +33 -0
- package/dist/actions/batchSellNFT/parseAction.d.ts +2 -0
- package/dist/actions/batchSellNFT/parseAction.js +9 -0
- package/dist/actions/buyNFT/fetchData.d.ts +2 -0
- package/dist/actions/buyNFT/fetchData.js +21 -0
- package/dist/actions/buyNFT/formatSecurityEngine.d.ts +2 -0
- package/dist/actions/buyNFT/formatSecurityEngine.js +33 -0
- package/dist/actions/buyNFT/parseAction.d.ts +2 -0
- package/dist/actions/buyNFT/parseAction.js +9 -0
- package/dist/actions/cancelTx/fetchData.d.ts +2 -0
- package/dist/actions/cancelTx/fetchData.js +32 -0
- package/dist/actions/cancelTx/formatSecurityEngine.d.ts +2 -0
- package/dist/actions/cancelTx/formatSecurityEngine.js +12 -0
- package/dist/actions/cancelTx/parseAction.d.ts +2 -0
- package/dist/actions/cancelTx/parseAction.js +11 -0
- package/dist/actions/coboSafeCreate/fetchData.d.ts +2 -0
- package/dist/actions/coboSafeCreate/fetchData.js +12 -0
- package/dist/actions/coboSafeCreate/formatSecurityEngine.d.ts +2 -0
- package/dist/actions/coboSafeCreate/formatSecurityEngine.js +12 -0
- package/dist/actions/coboSafeCreate/parseAction.d.ts +2 -0
- package/dist/actions/coboSafeCreate/parseAction.js +9 -0
- package/dist/actions/coboSafeModificationDelegatedAddress/fetchData.d.ts +2 -0
- package/dist/actions/coboSafeModificationDelegatedAddress/fetchData.js +12 -0
- package/dist/actions/coboSafeModificationDelegatedAddress/formatSecurityEngine.d.ts +2 -0
- package/dist/actions/coboSafeModificationDelegatedAddress/formatSecurityEngine.js +12 -0
- package/dist/actions/coboSafeModificationDelegatedAddress/parseAction.d.ts +2 -0
- package/dist/actions/coboSafeModificationDelegatedAddress/parseAction.js +9 -0
- package/dist/actions/coboSafeModificationRole/fetchData.d.ts +2 -0
- package/dist/actions/coboSafeModificationRole/fetchData.js +12 -0
- package/dist/actions/coboSafeModificationRole/formatSecurityEngine.d.ts +2 -0
- package/dist/actions/coboSafeModificationRole/formatSecurityEngine.js +12 -0
- package/dist/actions/coboSafeModificationRole/parseAction.d.ts +2 -0
- package/dist/actions/coboSafeModificationRole/parseAction.js +9 -0
- package/dist/actions/coboSafeModificationTokenApproval/fetchData.d.ts +2 -0
- package/dist/actions/coboSafeModificationTokenApproval/fetchData.js +12 -0
- package/dist/actions/coboSafeModificationTokenApproval/formatSecurityEngine.d.ts +2 -0
- package/dist/actions/coboSafeModificationTokenApproval/formatSecurityEngine.js +12 -0
- package/dist/actions/coboSafeModificationTokenApproval/parseAction.d.ts +2 -0
- package/dist/actions/coboSafeModificationTokenApproval/parseAction.js +9 -0
- package/dist/actions/common/fetchData.d.ts +4 -0
- package/dist/actions/common/fetchData.js +119 -0
- package/dist/actions/common/formatSecurityEngine.d.ts +2 -0
- package/dist/actions/common/formatSecurityEngine.js +21 -0
- package/dist/actions/common/parseAction.d.ts +2 -0
- package/dist/actions/common/parseAction.js +14 -0
- package/dist/actions/contractCall/fetchData.d.ts +2 -0
- package/dist/actions/contractCall/fetchData.js +115 -0
- package/dist/actions/contractCall/formatSecurityEngine.d.ts +2 -0
- package/dist/actions/contractCall/formatSecurityEngine.js +25 -0
- package/dist/actions/contractCall/parseAction.d.ts +2 -0
- package/dist/actions/contractCall/parseAction.js +5 -0
- package/dist/actions/createKey/fetchData.d.ts +2 -0
- package/dist/actions/createKey/fetchData.js +12 -0
- package/dist/actions/createKey/formatSecurityEngine.d.ts +2 -0
- package/dist/actions/createKey/formatSecurityEngine.js +24 -0
- package/dist/actions/createKey/parseAction.d.ts +2 -0
- package/dist/actions/createKey/parseAction.js +9 -0
- package/dist/actions/crossSwapToken/fetchData.d.ts +2 -0
- package/dist/actions/crossSwapToken/fetchData.js +19 -0
- package/dist/actions/crossSwapToken/formatSecurityEngine.d.ts +2 -0
- package/dist/actions/crossSwapToken/formatSecurityEngine.js +38 -0
- package/dist/actions/crossSwapToken/parseAction.d.ts +2 -0
- package/dist/actions/crossSwapToken/parseAction.js +26 -0
- package/dist/actions/crossToken/fetchData.d.ts +2 -0
- package/dist/actions/crossToken/fetchData.js +19 -0
- package/dist/actions/crossToken/formatSecurityEngine.d.ts +2 -0
- package/dist/actions/crossToken/formatSecurityEngine.js +38 -0
- package/dist/actions/crossToken/parseAction.d.ts +2 -0
- package/dist/actions/crossToken/parseAction.js +22 -0
- package/dist/actions/deployContract/fetchData.d.ts +2 -0
- package/dist/actions/deployContract/fetchData.js +12 -0
- package/dist/actions/deployContract/formatSecurityEngine.d.ts +2 -0
- package/dist/actions/deployContract/formatSecurityEngine.js +12 -0
- package/dist/actions/deployContract/parseAction.d.ts +2 -0
- package/dist/actions/deployContract/parseAction.js +9 -0
- package/dist/actions/permit/fetchData.d.ts +2 -0
- package/dist/actions/permit/fetchData.js +19 -0
- package/dist/actions/permit/formatSecurityEngine.d.ts +2 -0
- package/dist/actions/permit/formatSecurityEngine.js +30 -0
- package/dist/actions/permit/parseAction.d.ts +2 -0
- package/dist/actions/permit/parseAction.js +9 -0
- package/dist/actions/permit2/fetchData.d.ts +2 -0
- package/dist/actions/permit2/fetchData.js +19 -0
- package/dist/actions/permit2/formatSecurityEngine.d.ts +2 -0
- package/dist/actions/permit2/formatSecurityEngine.js +30 -0
- package/dist/actions/permit2/parseAction.d.ts +2 -0
- package/dist/actions/permit2/parseAction.js +9 -0
- package/dist/actions/permit2BatchRevokeToken/fetchData.d.ts +2 -0
- package/dist/actions/permit2BatchRevokeToken/fetchData.js +30 -0
- package/dist/actions/permit2BatchRevokeToken/formatSecurityEngine.d.ts +2 -0
- package/dist/actions/permit2BatchRevokeToken/formatSecurityEngine.js +12 -0
- package/dist/actions/permit2BatchRevokeToken/parseAction.d.ts +2 -0
- package/dist/actions/permit2BatchRevokeToken/parseAction.js +9 -0
- package/dist/actions/pushMultiSig/fetchData.d.ts +2 -0
- package/dist/actions/pushMultiSig/fetchData.js +27 -0
- package/dist/actions/pushMultiSig/formatSecurityEngine.d.ts +2 -0
- package/dist/actions/pushMultiSig/formatSecurityEngine.js +12 -0
- package/dist/actions/pushMultiSig/parseAction.d.ts +2 -0
- package/dist/actions/pushMultiSig/parseAction.js +9 -0
- package/dist/actions/revokeNFT/fetchData.d.ts +2 -0
- package/dist/actions/revokeNFT/fetchData.js +19 -0
- package/dist/actions/revokeNFT/formatSecurityEngine.d.ts +2 -0
- package/dist/actions/revokeNFT/formatSecurityEngine.js +12 -0
- package/dist/actions/revokeNFT/parseAction.d.ts +2 -0
- package/dist/actions/revokeNFT/parseAction.js +9 -0
- package/dist/actions/revokeNFTCollection/fetchData.d.ts +2 -0
- package/dist/actions/revokeNFTCollection/fetchData.js +19 -0
- package/dist/actions/revokeNFTCollection/formatSecurityEngine.d.ts +2 -0
- package/dist/actions/revokeNFTCollection/formatSecurityEngine.js +12 -0
- package/dist/actions/revokeNFTCollection/parseAction.d.ts +2 -0
- package/dist/actions/revokeNFTCollection/parseAction.js +9 -0
- package/dist/actions/revokePermit/fetchData.d.ts +2 -0
- package/dist/actions/revokePermit/fetchData.js +19 -0
- package/dist/actions/revokePermit/formatSecurityEngine.d.ts +2 -0
- package/dist/actions/revokePermit/formatSecurityEngine.js +12 -0
- package/dist/actions/revokePermit/parseAction.d.ts +2 -0
- package/dist/actions/revokePermit/parseAction.js +9 -0
- package/dist/actions/revokePermit2/fetchData.d.ts +2 -0
- package/dist/actions/revokePermit2/fetchData.js +19 -0
- package/dist/actions/revokePermit2/formatSecurityEngine.d.ts +2 -0
- package/dist/actions/revokePermit2/formatSecurityEngine.js +12 -0
- package/dist/actions/revokePermit2/parseAction.d.ts +2 -0
- package/dist/actions/revokePermit2/parseAction.js +13 -0
- package/dist/actions/revokeToken/fetchData.d.ts +2 -0
- package/dist/actions/revokeToken/fetchData.js +19 -0
- package/dist/actions/revokeToken/formatSecurityEngine.d.ts +2 -0
- package/dist/actions/revokeToken/formatSecurityEngine.js +25 -0
- package/dist/actions/revokeToken/parseAction.d.ts +2 -0
- package/dist/actions/revokeToken/parseAction.js +14 -0
- package/dist/actions/sellNFT/fetchData.d.ts +2 -0
- package/dist/actions/sellNFT/fetchData.js +21 -0
- package/dist/actions/sellNFT/formatSecurityEngine.d.ts +2 -0
- package/dist/actions/sellNFT/formatSecurityEngine.js +33 -0
- package/dist/actions/sellNFT/parseAction.d.ts +2 -0
- package/dist/actions/sellNFT/parseAction.js +9 -0
- package/dist/actions/send/fetchData.d.ts +8 -0
- package/dist/actions/send/fetchData.js +103 -0
- package/dist/actions/send/formatSecurityEngine.d.ts +2 -0
- package/dist/actions/send/formatSecurityEngine.js +47 -0
- package/dist/actions/send/parseAction.d.ts +2 -0
- package/dist/actions/send/parseAction.js +9 -0
- package/dist/actions/sendNFT/fetchData.d.ts +2 -0
- package/dist/actions/sendNFT/fetchData.js +26 -0
- package/dist/actions/sendNFT/formatSecurityEngine.d.ts +2 -0
- package/dist/actions/sendNFT/formatSecurityEngine.js +46 -0
- package/dist/actions/sendNFT/parseAction.d.ts +2 -0
- package/dist/actions/sendNFT/parseAction.js +9 -0
- package/dist/actions/signMultiSig/fetchData.d.ts +2 -0
- package/dist/actions/signMultiSig/fetchData.js +27 -0
- package/dist/actions/signMultiSig/formatSecurityEngine.d.ts +2 -0
- package/dist/actions/signMultiSig/formatSecurityEngine.js +12 -0
- package/dist/actions/signMultiSig/parseAction.d.ts +2 -0
- package/dist/actions/signMultiSig/parseAction.js +9 -0
- package/dist/actions/swap/fetchData.d.ts +4 -0
- package/dist/actions/swap/fetchData.js +51 -0
- package/dist/actions/swap/formatSecurityEngine.d.ts +2 -0
- package/dist/actions/swap/formatSecurityEngine.js +39 -0
- package/dist/actions/swap/parseAction.d.ts +2 -0
- package/dist/actions/swap/parseAction.js +43 -0
- package/dist/actions/swapTokenOrder/fetchData.d.ts +2 -0
- package/dist/actions/swapTokenOrder/fetchData.js +21 -0
- package/dist/actions/swapTokenOrder/formatSecurityEngine.d.ts +2 -0
- package/dist/actions/swapTokenOrder/formatSecurityEngine.js +35 -0
- package/dist/actions/swapTokenOrder/parseAction.d.ts +2 -0
- package/dist/actions/swapTokenOrder/parseAction.js +27 -0
- package/dist/actions/unwrapToken/fetchData.d.ts +2 -0
- package/dist/actions/unwrapToken/fetchData.js +19 -0
- package/dist/actions/unwrapToken/formatSecurityEngine.d.ts +2 -0
- package/dist/actions/unwrapToken/formatSecurityEngine.js +34 -0
- package/dist/actions/unwrapToken/parseAction.d.ts +2 -0
- package/dist/actions/unwrapToken/parseAction.js +17 -0
- package/dist/actions/verifyAddress/fetchData.d.ts +2 -0
- package/dist/actions/verifyAddress/fetchData.js +12 -0
- package/dist/actions/verifyAddress/formatSecurityEngine.d.ts +2 -0
- package/dist/actions/verifyAddress/formatSecurityEngine.js +24 -0
- package/dist/actions/verifyAddress/parseAction.d.ts +2 -0
- package/dist/actions/verifyAddress/parseAction.js +9 -0
- package/dist/actions/wrapToken/fetchData.d.ts +2 -0
- package/dist/actions/wrapToken/fetchData.js +19 -0
- package/dist/actions/wrapToken/formatSecurityEngine.d.ts +2 -0
- package/dist/actions/wrapToken/formatSecurityEngine.js +34 -0
- package/dist/actions/wrapToken/parseAction.d.ts +2 -0
- package/dist/actions/wrapToken/parseAction.js +17 -0
- package/dist/fetchActionRequiredData.d.ts +2 -0
- package/dist/fetchActionRequiredData.js +87 -0
- package/dist/formatSecurityEngineContext.d.ts +2 -0
- package/dist/formatSecurityEngineContext.js +89 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/dist/parseAction.d.ts +4 -0
- package/dist/parseAction.js +66 -0
- package/dist/types/actionRequireData.d.ts +158 -0
- package/dist/types/actionRequireData.js +1 -0
- package/dist/types/fetchActionRequiredData.d.ts +24 -0
- package/dist/types/fetchActionRequiredData.js +1 -0
- package/dist/types/formatSecurityEngineContext.d.ts +40 -0
- package/dist/types/formatSecurityEngineContext.js +1 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.js +5 -0
- package/dist/types/parseAction.d.ts +26 -0
- package/dist/types/parseAction.js +1 -0
- package/dist/types/parsedActionData.d.ts +161 -0
- package/dist/types/parsedActionData.js +1 -0
- package/dist/types/walletProvider.d.ts +79 -0
- package/dist/types/walletProvider.js +1 -0
- package/dist/utils/calcSlippageTolerance.d.ts +1 -0
- package/dist/utils/calcSlippageTolerance.js +12 -0
- package/dist/utils/calcUSDValueChange.d.ts +1 -0
- package/dist/utils/calcUSDValueChange.js +12 -0
- package/dist/utils/getProtocol.d.ts +6 -0
- package/dist/utils/getProtocol.js +7 -0
- package/dist/utils/isSameAddress.d.ts +4 -0
- package/dist/utils/isSameAddress.js +8 -0
- package/dist/utils/keyring.d.ts +10 -0
- package/dist/utils/keyring.js +10 -0
- package/dist/utils/parseTextAction.d.ts +2 -0
- package/dist/utils/parseTextAction.js +9 -0
- package/dist/utils/parseTypedDataAction.d.ts +2 -0
- package/dist/utils/parseTypedDataAction.js +25 -0
- package/dist/utils/waitQueueFinished.d.ts +2 -0
- package/dist/utils/waitQueueFinished.js +8 -0
- package/package.json +56 -0
package/README.md
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import PQueue from 'p-queue';
|
|
11
|
+
import { waitQueueFinished } from '../../utils/waitQueueFinished';
|
|
12
|
+
export const fetchDataApproveNFT = (options, likeAction) => __awaiter(void 0, void 0, void 0, function* () {
|
|
13
|
+
if (options.type !== 'transaction') {
|
|
14
|
+
return {};
|
|
15
|
+
}
|
|
16
|
+
const queue = new PQueue();
|
|
17
|
+
const { sender, apiProvider, chainId, actionData } = options;
|
|
18
|
+
const action = likeAction || actionData.approveNFT;
|
|
19
|
+
if (!action) {
|
|
20
|
+
return {};
|
|
21
|
+
}
|
|
22
|
+
const result = {
|
|
23
|
+
isEOA: false,
|
|
24
|
+
contract: null,
|
|
25
|
+
riskExposure: 0,
|
|
26
|
+
rank: null,
|
|
27
|
+
hasInteraction: false,
|
|
28
|
+
bornAt: 0,
|
|
29
|
+
protocol: null,
|
|
30
|
+
isDanger: false,
|
|
31
|
+
tokenBalance: '0',
|
|
32
|
+
};
|
|
33
|
+
queue.add(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
34
|
+
const contractInfo = yield apiProvider.getContractInfo(action.spender, chainId);
|
|
35
|
+
if (!contractInfo) {
|
|
36
|
+
result.isEOA = true;
|
|
37
|
+
result.rank = null;
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
result.rank = contractInfo.credit.rank_at;
|
|
41
|
+
result.riskExposure = contractInfo.top_nft_spend_usd_value;
|
|
42
|
+
result.bornAt = contractInfo.create_at;
|
|
43
|
+
result.isDanger =
|
|
44
|
+
contractInfo.is_danger.auto || contractInfo.is_danger.edit;
|
|
45
|
+
result.protocol = contractInfo.protocol;
|
|
46
|
+
}
|
|
47
|
+
if (result.isEOA) {
|
|
48
|
+
queue.add(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
49
|
+
const { desc } = yield apiProvider.addrDesc(action.spender);
|
|
50
|
+
result.bornAt = desc.born_at;
|
|
51
|
+
}));
|
|
52
|
+
}
|
|
53
|
+
}));
|
|
54
|
+
queue.add(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
55
|
+
const hasInteraction = yield apiProvider.hasInteraction(sender, chainId, action.spender);
|
|
56
|
+
result.hasInteraction = hasInteraction.has_interaction;
|
|
57
|
+
}));
|
|
58
|
+
yield waitQueueFinished(queue);
|
|
59
|
+
return result;
|
|
60
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
export const formatSecurityEngineApproveNFT = (options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
11
|
+
if (options.type !== 'transaction' && options.type !== 'typed_data') {
|
|
12
|
+
return {};
|
|
13
|
+
}
|
|
14
|
+
const { actionData, requireData, chainId, provider } = options;
|
|
15
|
+
if (!actionData.approveNFT || !chainId) {
|
|
16
|
+
return {};
|
|
17
|
+
}
|
|
18
|
+
const data = requireData;
|
|
19
|
+
const { spender } = actionData.approveNFT;
|
|
20
|
+
return {
|
|
21
|
+
nftApprove: {
|
|
22
|
+
chainId,
|
|
23
|
+
spender,
|
|
24
|
+
isEOA: data.isEOA,
|
|
25
|
+
riskExposure: data.riskExposure,
|
|
26
|
+
deployDays: provider.getTimeSpan(Math.floor(Date.now() / 1000) - data.bornAt).d,
|
|
27
|
+
hasInteracted: data.hasInteraction,
|
|
28
|
+
isDanger: !!data.isDanger,
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { fetchDataApproveNFT } from '../approveNFT/fetchData';
|
|
11
|
+
export const fetchDataApproveNFTCollection = (options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
12
|
+
if (options.type !== 'transaction') {
|
|
13
|
+
return {};
|
|
14
|
+
}
|
|
15
|
+
if (!options.actionData.approveNFTCollection) {
|
|
16
|
+
return {};
|
|
17
|
+
}
|
|
18
|
+
return fetchDataApproveNFT(options, options.actionData.approveNFTCollection);
|
|
19
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
export const formatSecurityEngineApproveNFTCollection = (options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
11
|
+
if (options.type !== 'transaction') {
|
|
12
|
+
return {};
|
|
13
|
+
}
|
|
14
|
+
const { actionData, requireData, chainId, provider } = options;
|
|
15
|
+
if (!actionData.approveNFTCollection || !chainId) {
|
|
16
|
+
return {};
|
|
17
|
+
}
|
|
18
|
+
const data = requireData;
|
|
19
|
+
const { spender } = actionData.approveNFTCollection;
|
|
20
|
+
return {
|
|
21
|
+
collectionApprove: {
|
|
22
|
+
chainId,
|
|
23
|
+
spender,
|
|
24
|
+
isEOA: data.isEOA,
|
|
25
|
+
riskExposure: data.riskExposure,
|
|
26
|
+
deployDays: provider.getTimeSpan(Math.floor(Date.now() / 1000) - data.bornAt).d,
|
|
27
|
+
hasInteracted: data.hasInteraction,
|
|
28
|
+
isDanger: !!data.isDanger,
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { FetchActionRequiredData } from '../../types';
|
|
2
|
+
import { ApproveAction } from '@rabby-wallet/rabby-api/dist/types';
|
|
3
|
+
export declare const fetchDataApproveToken: FetchActionRequiredData<{
|
|
4
|
+
spender: ApproveAction['spender'];
|
|
5
|
+
token?: ApproveAction['token'];
|
|
6
|
+
}>;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import PQueue from 'p-queue';
|
|
11
|
+
import { waitQueueFinished } from '../../utils/waitQueueFinished';
|
|
12
|
+
export const fetchDataApproveToken = (options, likeAction) => __awaiter(void 0, void 0, void 0, function* () {
|
|
13
|
+
const queue = new PQueue();
|
|
14
|
+
const { sender, apiProvider, chainId, actionData } = options;
|
|
15
|
+
const action = likeAction || actionData.approveToken;
|
|
16
|
+
if (!action || !chainId) {
|
|
17
|
+
return {};
|
|
18
|
+
}
|
|
19
|
+
const { spender, token } = action;
|
|
20
|
+
const result = {
|
|
21
|
+
isEOA: false,
|
|
22
|
+
contract: null,
|
|
23
|
+
riskExposure: 0,
|
|
24
|
+
rank: null,
|
|
25
|
+
hasInteraction: false,
|
|
26
|
+
bornAt: 0,
|
|
27
|
+
protocol: null,
|
|
28
|
+
isDanger: false,
|
|
29
|
+
token: Object.assign(Object.assign({}, token), { amount: 0, raw_amount_hex_str: '0x0' }),
|
|
30
|
+
};
|
|
31
|
+
queue.add(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
32
|
+
const contractInfo = yield apiProvider.getContractInfo(spender, chainId);
|
|
33
|
+
if (!contractInfo) {
|
|
34
|
+
result.isEOA = true;
|
|
35
|
+
result.rank = null;
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
result.rank = contractInfo.credit.rank_at;
|
|
39
|
+
result.riskExposure = contractInfo.spend_usd_value;
|
|
40
|
+
result.bornAt = contractInfo.create_at;
|
|
41
|
+
result.isDanger =
|
|
42
|
+
contractInfo.is_danger.auto || contractInfo.is_danger.edit;
|
|
43
|
+
result.protocol = contractInfo.protocol;
|
|
44
|
+
}
|
|
45
|
+
if (result.isEOA) {
|
|
46
|
+
queue.add(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
47
|
+
const { desc } = yield apiProvider.addrDesc(spender);
|
|
48
|
+
result.bornAt = desc.born_at;
|
|
49
|
+
}));
|
|
50
|
+
}
|
|
51
|
+
}));
|
|
52
|
+
if (token) {
|
|
53
|
+
queue.add(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
54
|
+
const t = yield apiProvider.getToken(sender, chainId, token.id);
|
|
55
|
+
result.token = t;
|
|
56
|
+
}));
|
|
57
|
+
}
|
|
58
|
+
queue.add(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
59
|
+
const hasInteraction = yield apiProvider.hasInteraction(sender, chainId, spender);
|
|
60
|
+
result.hasInteraction = hasInteraction.has_interaction;
|
|
61
|
+
}));
|
|
62
|
+
yield waitQueueFinished(queue);
|
|
63
|
+
return result;
|
|
64
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
export const formatSecurityEngineApproveToken = (options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
11
|
+
if (options.type !== 'transaction') {
|
|
12
|
+
return {};
|
|
13
|
+
}
|
|
14
|
+
const { actionData, requireData, chainId, provider } = options;
|
|
15
|
+
if (!actionData.approveToken || !chainId) {
|
|
16
|
+
return {};
|
|
17
|
+
}
|
|
18
|
+
const data = requireData;
|
|
19
|
+
const { spender } = actionData.approveToken;
|
|
20
|
+
return {
|
|
21
|
+
tokenApprove: {
|
|
22
|
+
chainId,
|
|
23
|
+
spender,
|
|
24
|
+
isEOA: data.isEOA,
|
|
25
|
+
riskExposure: data.riskExposure,
|
|
26
|
+
deployDays: provider.getTimeSpan(Math.floor(Date.now() / 1000) - data.bornAt).d,
|
|
27
|
+
hasInteracted: data.hasInteraction,
|
|
28
|
+
isDanger: !!data.isDanger,
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export const parseActionApproveToken = (options) => {
|
|
2
|
+
const { data } = options;
|
|
3
|
+
if ((data === null || data === void 0 ? void 0 : data.type) !== 'approve_token') {
|
|
4
|
+
return {};
|
|
5
|
+
}
|
|
6
|
+
const { spender, token } = data.data;
|
|
7
|
+
return {
|
|
8
|
+
approveToken: {
|
|
9
|
+
spender,
|
|
10
|
+
token,
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { fetchDataCommon } from '../common/fetchData';
|
|
11
|
+
export const fetchDataAssetOrder = (options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
12
|
+
let action;
|
|
13
|
+
if (options.type === 'transaction' && options.actionData.assetOrder) {
|
|
14
|
+
action = {
|
|
15
|
+
receiver: options.tx.to,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
if (options.type === 'typed_data' &&
|
|
19
|
+
options.actionData.assetOrder &&
|
|
20
|
+
options.actionData.contractId) {
|
|
21
|
+
action = {
|
|
22
|
+
receiver: options.actionData.contractId,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
if (!action || !options.chainId) {
|
|
26
|
+
return {};
|
|
27
|
+
}
|
|
28
|
+
return fetchDataCommon(options, action);
|
|
29
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
export const formatSecurityEngineAssetOrder = (options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
11
|
+
if (options.type !== 'transaction' && options.type !== 'typed_data') {
|
|
12
|
+
return {};
|
|
13
|
+
}
|
|
14
|
+
const { actionData, requireData, chainId, provider } = options;
|
|
15
|
+
if (!actionData.assetOrder) {
|
|
16
|
+
return {};
|
|
17
|
+
}
|
|
18
|
+
const { takers, receiver, receiveNFTList, receiveTokenList } = actionData.assetOrder;
|
|
19
|
+
const data = requireData;
|
|
20
|
+
return {
|
|
21
|
+
assetOrder: {
|
|
22
|
+
specificBuyer: takers[0],
|
|
23
|
+
from: data.sender,
|
|
24
|
+
receiver: receiver || '',
|
|
25
|
+
chainId,
|
|
26
|
+
id: data.id,
|
|
27
|
+
hasReceiveAssets: receiveNFTList.length + receiveTokenList.length > 0,
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export const parseActionAssetOrder = (options) => {
|
|
2
|
+
const { data } = options;
|
|
3
|
+
if ((data === null || data === void 0 ? void 0 : data.type) !== 'swap_order') {
|
|
4
|
+
return {};
|
|
5
|
+
}
|
|
6
|
+
const { pay_token_list, pay_nft_list, receive_nft_list, receive_token_list, receiver, takers, expire_at, } = data.data;
|
|
7
|
+
return {
|
|
8
|
+
assetOrder: {
|
|
9
|
+
payTokenList: pay_token_list,
|
|
10
|
+
payNFTList: pay_nft_list,
|
|
11
|
+
receiveNFTList: receive_nft_list,
|
|
12
|
+
receiveTokenList: receive_token_list,
|
|
13
|
+
receiver,
|
|
14
|
+
takers,
|
|
15
|
+
expireAt: expire_at,
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import PQueue from 'p-queue';
|
|
11
|
+
import { waitQueueFinished } from '../../utils/waitQueueFinished';
|
|
12
|
+
export const fetchDataBatchPermit2 = (options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
13
|
+
if (options.type !== 'typed_data') {
|
|
14
|
+
return {};
|
|
15
|
+
}
|
|
16
|
+
const { actionData, apiProvider, sender, chainId } = options;
|
|
17
|
+
if (!actionData.batchPermit2 || !chainId) {
|
|
18
|
+
return {};
|
|
19
|
+
}
|
|
20
|
+
const queue = new PQueue();
|
|
21
|
+
const tokens = actionData.batchPermit2.token_list;
|
|
22
|
+
const spender = actionData.batchPermit2.spender;
|
|
23
|
+
const result = {
|
|
24
|
+
isEOA: false,
|
|
25
|
+
contract: null,
|
|
26
|
+
riskExposure: 0,
|
|
27
|
+
rank: null,
|
|
28
|
+
hasInteraction: false,
|
|
29
|
+
bornAt: 0,
|
|
30
|
+
protocol: null,
|
|
31
|
+
isDanger: false,
|
|
32
|
+
tokens: tokens.map((token) => (Object.assign(Object.assign({}, token), { amount: 0, raw_amount_hex_str: '0x0' }))),
|
|
33
|
+
};
|
|
34
|
+
queue.add(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
35
|
+
const contractInfo = yield apiProvider.getContractInfo(spender, chainId);
|
|
36
|
+
if (!contractInfo) {
|
|
37
|
+
result.isEOA = true;
|
|
38
|
+
result.rank = null;
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
result.rank = contractInfo.credit.rank_at;
|
|
42
|
+
result.riskExposure = contractInfo.spend_usd_value;
|
|
43
|
+
result.bornAt = contractInfo.create_at;
|
|
44
|
+
result.isDanger =
|
|
45
|
+
contractInfo.is_danger.auto || contractInfo.is_danger.edit;
|
|
46
|
+
result.protocol = contractInfo.protocol;
|
|
47
|
+
}
|
|
48
|
+
if (result.isEOA) {
|
|
49
|
+
queue.add(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
50
|
+
const { desc } = yield apiProvider.addrDesc(spender);
|
|
51
|
+
result.bornAt = desc.born_at;
|
|
52
|
+
}));
|
|
53
|
+
}
|
|
54
|
+
}));
|
|
55
|
+
queue.add(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
56
|
+
const list = yield Promise.all(tokens.map((token) => apiProvider.getToken(sender, chainId, token.id)));
|
|
57
|
+
result.tokens = list;
|
|
58
|
+
}));
|
|
59
|
+
queue.add(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
60
|
+
const hasInteraction = yield apiProvider.hasInteraction(sender, chainId, spender);
|
|
61
|
+
result.hasInteraction = hasInteraction.has_interaction;
|
|
62
|
+
}));
|
|
63
|
+
yield waitQueueFinished(queue);
|
|
64
|
+
return result;
|
|
65
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
export const formatSecurityEngineBatchPermit2 = (options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
11
|
+
if (options.type !== 'typed_data') {
|
|
12
|
+
return {};
|
|
13
|
+
}
|
|
14
|
+
const { actionData, requireData, chainId, provider } = options;
|
|
15
|
+
if (!actionData.batchPermit2) {
|
|
16
|
+
return {};
|
|
17
|
+
}
|
|
18
|
+
const data = requireData;
|
|
19
|
+
return {
|
|
20
|
+
batchPermit2: {
|
|
21
|
+
spender: actionData.batchPermit2.spender,
|
|
22
|
+
isEOA: data.isEOA,
|
|
23
|
+
riskExposure: data.riskExposure,
|
|
24
|
+
deployDays: provider.getTimeSpan(Math.floor(Date.now() / 1000) - data.bornAt).d,
|
|
25
|
+
hasInteracted: data.hasInteraction,
|
|
26
|
+
isDanger: !!data.isDanger,
|
|
27
|
+
chainId,
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export const parseActionBatchPermit2 = (options) => {
|
|
2
|
+
const { data } = options;
|
|
3
|
+
if ((data === null || data === void 0 ? void 0 : data.type) !== 'permit2_approve_token_list') {
|
|
4
|
+
return {};
|
|
5
|
+
}
|
|
6
|
+
return {
|
|
7
|
+
batchPermit2: Object.assign(Object.assign({}, data.data), { sig_expire_at: data.expire_at }),
|
|
8
|
+
};
|
|
9
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { fetchDataCommon } from '../common/fetchData';
|
|
11
|
+
export const fetchDataBatchSellNFT = (options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
12
|
+
if (options.type !== 'typed_data') {
|
|
13
|
+
return {};
|
|
14
|
+
}
|
|
15
|
+
if (!options.actionData.contractId || !options.actionData.batchSellNFT) {
|
|
16
|
+
return {};
|
|
17
|
+
}
|
|
18
|
+
return fetchDataCommon(options, {
|
|
19
|
+
receiver: options.actionData.contractId,
|
|
20
|
+
});
|
|
21
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
export const formatSecurityEngineBatchSellNFT = (options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
11
|
+
if (options.type !== 'typed_data') {
|
|
12
|
+
return {};
|
|
13
|
+
}
|
|
14
|
+
const { actionData, requireData, chainId, provider } = options;
|
|
15
|
+
if (!actionData.batchSellNFT) {
|
|
16
|
+
return {};
|
|
17
|
+
}
|
|
18
|
+
const receiveTokenIsFake = actionData.batchSellNFT.receive_token.is_verified === false;
|
|
19
|
+
const receiveTokenIsScam = receiveTokenIsFake
|
|
20
|
+
? false
|
|
21
|
+
: !!actionData.batchSellNFT.receive_token.is_suspicious;
|
|
22
|
+
return {
|
|
23
|
+
batchSellNFT: {
|
|
24
|
+
specificBuyer: actionData.batchSellNFT.takers[0],
|
|
25
|
+
from: actionData.sender,
|
|
26
|
+
receiver: actionData.batchSellNFT.receiver,
|
|
27
|
+
receiveTokenHasFake: receiveTokenIsFake,
|
|
28
|
+
receiveTokenHasScam: receiveTokenIsScam,
|
|
29
|
+
chainId,
|
|
30
|
+
id: actionData.contractId,
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
});
|