@rabby-wallet/rabby-action 0.1.2-beta.0 → 0.1.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/actions/approveNFT/fetchData.js +0 -5
- package/dist/actions/approveNFT/formatSecurityEngine.js +0 -1
- package/dist/actions/approveNFTCollection/formatSecurityEngine.js +0 -1
- package/dist/actions/approveToken/fetchData.js +0 -5
- package/dist/actions/approveToken/formatSecurityEngine.js +0 -1
- package/dist/actions/batchPermit2/fetchData.js +0 -5
- package/dist/actions/batchPermit2/formatSecurityEngine.js +0 -1
- package/dist/actions/common/fetchData.js +0 -5
- package/dist/actions/contractCall/fetchData.js +2 -5
- package/dist/actions/contractCall/formatSecurityEngine.js +1 -0
- package/dist/actions/permit/formatSecurityEngine.js +0 -1
- package/dist/actions/permit2/formatSecurityEngine.js +0 -1
- package/dist/actions/swap/fetchData.js +0 -5
- package/dist/types/actionRequireData.d.ts +1 -5
- package/package.json +4 -4
|
@@ -21,7 +21,6 @@ export const fetchDataApproveNFT = (options, likeAction) => __awaiter(void 0, vo
|
|
|
21
21
|
contract: null,
|
|
22
22
|
riskExposure: 0,
|
|
23
23
|
rank: null,
|
|
24
|
-
hasInteraction: false,
|
|
25
24
|
bornAt: 0,
|
|
26
25
|
protocol: null,
|
|
27
26
|
isDanger: false,
|
|
@@ -48,10 +47,6 @@ export const fetchDataApproveNFT = (options, likeAction) => __awaiter(void 0, vo
|
|
|
48
47
|
}));
|
|
49
48
|
}
|
|
50
49
|
}));
|
|
51
|
-
queue.add(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
52
|
-
const hasInteraction = yield apiProvider.hasInteraction(sender, chainId, action.spender);
|
|
53
|
-
result.hasInteraction = hasInteraction.has_interaction;
|
|
54
|
-
}));
|
|
55
50
|
yield waitQueueFinished(queue);
|
|
56
51
|
return result;
|
|
57
52
|
});
|
|
@@ -21,7 +21,6 @@ export const formatSecurityEngineApproveNFT = (options) => __awaiter(void 0, voi
|
|
|
21
21
|
isEOA: data.isEOA,
|
|
22
22
|
riskExposure: data.riskExposure,
|
|
23
23
|
deployDays: provider.getTimeSpan(Math.floor(Date.now() / 1000) - data.bornAt).d,
|
|
24
|
-
hasInteracted: data.hasInteraction,
|
|
25
24
|
isDanger: !!data.isDanger,
|
|
26
25
|
},
|
|
27
26
|
};
|
|
@@ -21,7 +21,6 @@ export const formatSecurityEngineApproveNFTCollection = (options) => __awaiter(v
|
|
|
21
21
|
isEOA: data.isEOA,
|
|
22
22
|
riskExposure: data.riskExposure,
|
|
23
23
|
deployDays: provider.getTimeSpan(Math.floor(Date.now() / 1000) - data.bornAt).d,
|
|
24
|
-
hasInteracted: data.hasInteraction,
|
|
25
24
|
isDanger: !!data.isDanger,
|
|
26
25
|
},
|
|
27
26
|
};
|
|
@@ -22,7 +22,6 @@ export const fetchDataApproveToken = (options, likeAction) => __awaiter(void 0,
|
|
|
22
22
|
contract: null,
|
|
23
23
|
riskExposure: 0,
|
|
24
24
|
rank: null,
|
|
25
|
-
hasInteraction: false,
|
|
26
25
|
bornAt: 0,
|
|
27
26
|
protocol: null,
|
|
28
27
|
isDanger: false,
|
|
@@ -55,10 +54,6 @@ export const fetchDataApproveToken = (options, likeAction) => __awaiter(void 0,
|
|
|
55
54
|
result.token = t;
|
|
56
55
|
}));
|
|
57
56
|
}
|
|
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
57
|
yield waitQueueFinished(queue);
|
|
63
58
|
return result;
|
|
64
59
|
});
|
|
@@ -21,7 +21,6 @@ export const formatSecurityEngineApproveToken = (options) => __awaiter(void 0, v
|
|
|
21
21
|
isEOA: data.isEOA,
|
|
22
22
|
riskExposure: data.riskExposure,
|
|
23
23
|
deployDays: provider.getTimeSpan(Math.floor(Date.now() / 1000) - data.bornAt).d,
|
|
24
|
-
hasInteracted: data.hasInteraction,
|
|
25
24
|
isDanger: !!data.isDanger,
|
|
26
25
|
},
|
|
27
26
|
};
|
|
@@ -25,7 +25,6 @@ export const fetchDataBatchPermit2 = (options) => __awaiter(void 0, void 0, void
|
|
|
25
25
|
contract: null,
|
|
26
26
|
riskExposure: 0,
|
|
27
27
|
rank: null,
|
|
28
|
-
hasInteraction: false,
|
|
29
28
|
bornAt: 0,
|
|
30
29
|
protocol: null,
|
|
31
30
|
isDanger: false,
|
|
@@ -56,10 +55,6 @@ export const fetchDataBatchPermit2 = (options) => __awaiter(void 0, void 0, void
|
|
|
56
55
|
const list = yield Promise.all(tokens.map((token) => apiProvider.getToken(sender, chainId, token.id)));
|
|
57
56
|
result.tokens = list;
|
|
58
57
|
}));
|
|
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
58
|
yield waitQueueFinished(queue);
|
|
64
59
|
return result;
|
|
65
60
|
});
|
|
@@ -22,7 +22,6 @@ export const formatSecurityEngineBatchPermit2 = (options) => __awaiter(void 0, v
|
|
|
22
22
|
isEOA: data.isEOA,
|
|
23
23
|
riskExposure: data.riskExposure,
|
|
24
24
|
deployDays: provider.getTimeSpan(Math.floor(Date.now() / 1000) - data.bornAt).d,
|
|
25
|
-
hasInteracted: data.hasInteraction,
|
|
26
25
|
isDanger: !!data.isDanger,
|
|
27
26
|
chainId,
|
|
28
27
|
},
|
|
@@ -26,7 +26,6 @@ export const fetchDataCommon = (options, likeAction) => __awaiter(void 0, void 0
|
|
|
26
26
|
id: receiver,
|
|
27
27
|
protocol: null,
|
|
28
28
|
bornAt: 0,
|
|
29
|
-
hasInteraction: false,
|
|
30
29
|
rank: null,
|
|
31
30
|
unexpectedAddr: null,
|
|
32
31
|
receiverInWallet: false,
|
|
@@ -53,10 +52,6 @@ export const fetchDataCommon = (options, likeAction) => __awaiter(void 0, void 0
|
|
|
53
52
|
result.bornAt = desc.born_at;
|
|
54
53
|
}));
|
|
55
54
|
}
|
|
56
|
-
queue.add(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
57
|
-
const hasInteraction = yield apiProvider.hasInteraction(sender, chainId, receiver);
|
|
58
|
-
result.hasInteraction = hasInteraction.has_interaction;
|
|
59
|
-
}));
|
|
60
55
|
if (actionData.contractCall || actionData.common) {
|
|
61
56
|
const chain = walletProvider.findChain({
|
|
62
57
|
serverId: chainId,
|
|
@@ -25,7 +25,6 @@ export const fetchDataContractCall = (options) => __awaiter(void 0, void 0, void
|
|
|
25
25
|
const result = {
|
|
26
26
|
contract: null,
|
|
27
27
|
rank: null,
|
|
28
|
-
hasInteraction: false,
|
|
29
28
|
bornAt: 0,
|
|
30
29
|
protocol: null,
|
|
31
30
|
call: contractCall,
|
|
@@ -34,6 +33,7 @@ export const fetchDataContractCall = (options) => __awaiter(void 0, void 0, void
|
|
|
34
33
|
nativeTokenSymbol: (chain === null || chain === void 0 ? void 0 : chain.nativeTokenSymbol) || 'ETH',
|
|
35
34
|
unexpectedAddr: null,
|
|
36
35
|
receiverInWallet: false,
|
|
36
|
+
isDanger: false,
|
|
37
37
|
};
|
|
38
38
|
queue.add(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
39
39
|
const contractInfo = yield apiProvider.getContractInfo(contractCall.contract.id, chainId);
|
|
@@ -42,6 +42,7 @@ export const fetchDataContractCall = (options) => __awaiter(void 0, void 0, void
|
|
|
42
42
|
}
|
|
43
43
|
else {
|
|
44
44
|
result.rank = contractInfo.credit.rank_at;
|
|
45
|
+
result.isDanger = !!(contractInfo.is_danger.auto || contractInfo.is_danger.edit);
|
|
45
46
|
}
|
|
46
47
|
}));
|
|
47
48
|
queue.add(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -54,10 +55,6 @@ export const fetchDataContractCall = (options) => __awaiter(void 0, void 0, void
|
|
|
54
55
|
}
|
|
55
56
|
result.protocol = getProtocol(desc.protocol, chainId);
|
|
56
57
|
}));
|
|
57
|
-
queue.add(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
58
|
-
const hasInteraction = yield apiProvider.hasInteraction(sender, chainId, contractCall.contract.id);
|
|
59
|
-
result.hasInteraction = hasInteraction.has_interaction;
|
|
60
|
-
}));
|
|
61
58
|
queue.add(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
62
59
|
var _a, _b;
|
|
63
60
|
const addr = (_a = actionData.common) === null || _a === void 0 ? void 0 : _a.receiver;
|
|
@@ -22,7 +22,6 @@ export const formatSecurityEnginePermit = (options) => __awaiter(void 0, void 0,
|
|
|
22
22
|
isEOA: data.isEOA,
|
|
23
23
|
riskExposure: data.riskExposure,
|
|
24
24
|
deployDays: provider.getTimeSpan(Math.floor(Date.now() / 1000) - data.bornAt).d,
|
|
25
|
-
hasInteracted: data.hasInteraction,
|
|
26
25
|
isDanger: !!data.isDanger,
|
|
27
26
|
chainId,
|
|
28
27
|
},
|
|
@@ -22,7 +22,6 @@ export const formatSecurityEnginePermit2 = (options) => __awaiter(void 0, void 0
|
|
|
22
22
|
isEOA: data.isEOA,
|
|
23
23
|
riskExposure: data.riskExposure,
|
|
24
24
|
deployDays: provider.getTimeSpan(Math.floor(Date.now() / 1000) - data.bornAt).d,
|
|
25
|
-
hasInteracted: data.hasInteraction,
|
|
26
25
|
isDanger: !!data.isDanger,
|
|
27
26
|
chainId,
|
|
28
27
|
},
|
|
@@ -32,7 +32,6 @@ export const fetchDataSwap = (options, likeSwapAction) => __awaiter(void 0, void
|
|
|
32
32
|
id,
|
|
33
33
|
protocol: null,
|
|
34
34
|
bornAt: 0,
|
|
35
|
-
hasInteraction: false,
|
|
36
35
|
rank: null,
|
|
37
36
|
sender,
|
|
38
37
|
receiverInWallet,
|
|
@@ -48,10 +47,6 @@ export const fetchDataSwap = (options, likeSwapAction) => __awaiter(void 0, void
|
|
|
48
47
|
result.protocol = contractInfo.protocol;
|
|
49
48
|
}
|
|
50
49
|
}));
|
|
51
|
-
queue.add(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
52
|
-
const hasInteraction = yield apiProvider.hasInteraction(sender, chainId, id);
|
|
53
|
-
result.hasInteraction = hasInteraction.has_interaction;
|
|
54
|
-
}));
|
|
55
50
|
yield waitQueueFinished(queue);
|
|
56
51
|
return result;
|
|
57
52
|
});
|
|
@@ -7,7 +7,6 @@ export interface SwapRequireData {
|
|
|
7
7
|
logo_url: string;
|
|
8
8
|
} | null;
|
|
9
9
|
bornAt: number;
|
|
10
|
-
hasInteraction: boolean;
|
|
11
10
|
rank: number | null;
|
|
12
11
|
sender: string;
|
|
13
12
|
receiverInWallet: boolean;
|
|
@@ -50,7 +49,6 @@ export interface ApproveTokenRequireData {
|
|
|
50
49
|
contract: Record<string, ContractDesc> | null;
|
|
51
50
|
riskExposure: number;
|
|
52
51
|
rank: number | null;
|
|
53
|
-
hasInteraction: boolean;
|
|
54
52
|
bornAt: number;
|
|
55
53
|
protocol: {
|
|
56
54
|
id: string;
|
|
@@ -68,7 +66,6 @@ export interface WrapTokenRequireData {
|
|
|
68
66
|
logo_url: string;
|
|
69
67
|
} | null;
|
|
70
68
|
bornAt: number;
|
|
71
|
-
hasInteraction: boolean;
|
|
72
69
|
rank: number | null;
|
|
73
70
|
sender: string;
|
|
74
71
|
receiverInWallet: boolean;
|
|
@@ -77,7 +74,6 @@ export interface ContractCallRequireData {
|
|
|
77
74
|
id: string;
|
|
78
75
|
contract: Record<string, ContractDesc> | null;
|
|
79
76
|
rank: number | null;
|
|
80
|
-
hasInteraction: boolean;
|
|
81
77
|
bornAt: number;
|
|
82
78
|
protocol: {
|
|
83
79
|
name: string;
|
|
@@ -88,6 +84,7 @@ export interface ContractCallRequireData {
|
|
|
88
84
|
nativeTokenSymbol: string;
|
|
89
85
|
unexpectedAddr: ReceiverData | null;
|
|
90
86
|
receiverInWallet: boolean;
|
|
87
|
+
isDanger?: boolean;
|
|
91
88
|
}
|
|
92
89
|
export type ApproveNFTRequireData = Omit<ApproveTokenRequireData, 'token'> & {
|
|
93
90
|
tokenBalance: string;
|
|
@@ -140,7 +137,6 @@ export interface ContractRequireData {
|
|
|
140
137
|
logo_url: string;
|
|
141
138
|
} | null;
|
|
142
139
|
bornAt: number;
|
|
143
|
-
hasInteraction: boolean;
|
|
144
140
|
rank: number | null;
|
|
145
141
|
unexpectedAddr: ReceiverData | null;
|
|
146
142
|
receiverInWallet: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rabby-wallet/rabby-action",
|
|
3
|
-
"version": "0.1.2
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"@babel/preset-env": "^7.19.1",
|
|
14
14
|
"@debank/common": "^0.3.60",
|
|
15
15
|
"@rabby-wallet/rabby-api": "0.7.28",
|
|
16
|
-
"@rabby-wallet/rabby-security-engine": "2.0.7
|
|
16
|
+
"@rabby-wallet/rabby-security-engine": "2.0.7",
|
|
17
17
|
"@types/jest": "^29.0.3",
|
|
18
18
|
"@types/lodash": "^4.14.185",
|
|
19
19
|
"@types/node": "^18.7.18",
|
|
@@ -24,12 +24,12 @@
|
|
|
24
24
|
"jest-environment-jsdom": "^29.7.0",
|
|
25
25
|
"jest-mock-axios": "^4.7.0-beta",
|
|
26
26
|
"lint-staged": ">=10",
|
|
27
|
+
"p-queue": "7.3.0",
|
|
27
28
|
"prettier": "^2.7.1",
|
|
28
29
|
"rimraf": "^3.0.2",
|
|
29
30
|
"ts-jest": "^29.2.4",
|
|
30
31
|
"ts-node": "^10.9.1",
|
|
31
|
-
"typescript": "^5.5.4"
|
|
32
|
-
"p-queue": "7.3.0"
|
|
32
|
+
"typescript": "^5.5.4"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
35
35
|
"test": "jest",
|