@getpara/aa-rhinestone 3.20.0 → 3.22.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/dist/action.js +30 -2
- package/package.json +11 -10
package/dist/action.js
CHANGED
|
@@ -3,9 +3,12 @@ import {
|
|
|
3
3
|
SmartAccountError,
|
|
4
4
|
wrapProviderError,
|
|
5
5
|
ensureExternalWalletChain,
|
|
6
|
-
resolveSigner
|
|
6
|
+
resolveSigner,
|
|
7
|
+
waitForDeployedCode
|
|
7
8
|
} from "@getpara/viem-v2-integration/aa";
|
|
8
9
|
import { createPublicClient, http } from "viem";
|
|
10
|
+
const DEPLOYMENT_VISIBILITY_ATTEMPTS = 60;
|
|
11
|
+
const DEPLOYMENT_VISIBILITY_INTERVAL_MS = 500;
|
|
9
12
|
async function createRhinestoneSmartAccount(params) {
|
|
10
13
|
const { para, chain, rpcUrl, rhinestoneApiKey, pimlicoApiKey } = params;
|
|
11
14
|
const viemAccount = resolveSigner(para, params);
|
|
@@ -29,6 +32,30 @@ async function createRhinestoneSmartAccount(params) {
|
|
|
29
32
|
}
|
|
30
33
|
});
|
|
31
34
|
const accountAddress = rhinestoneAccount.getAddress();
|
|
35
|
+
const deployAndWaitUntilVisible = async () => {
|
|
36
|
+
await rhinestoneAccount.deploy(chain);
|
|
37
|
+
const isVisible = await waitForDeployedCode(publicClient, {
|
|
38
|
+
address: accountAddress,
|
|
39
|
+
attempts: DEPLOYMENT_VISIBILITY_ATTEMPTS,
|
|
40
|
+
intervalMs: DEPLOYMENT_VISIBILITY_INTERVAL_MS
|
|
41
|
+
});
|
|
42
|
+
if (isVisible) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
throw new SmartAccountError({
|
|
46
|
+
code: "RECEIPT_TIMEOUT",
|
|
47
|
+
message: `Rhinestone account deployment was not visible at ${accountAddress}`,
|
|
48
|
+
provider: "RHINESTONE"
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
let deploymentPromise;
|
|
52
|
+
const ensureAccountDeployment = () => {
|
|
53
|
+
deploymentPromise ?? (deploymentPromise = deployAndWaitUntilVisible().catch((error) => {
|
|
54
|
+
deploymentPromise = void 0;
|
|
55
|
+
throw error;
|
|
56
|
+
}));
|
|
57
|
+
return deploymentPromise;
|
|
58
|
+
};
|
|
32
59
|
const sendBatchTransaction = async (calls) => {
|
|
33
60
|
await ensureExternalWalletChain(params.signer, chain, "RHINESTONE");
|
|
34
61
|
if (!chain) {
|
|
@@ -39,13 +66,14 @@ async function createRhinestoneSmartAccount(params) {
|
|
|
39
66
|
});
|
|
40
67
|
}
|
|
41
68
|
try {
|
|
69
|
+
await ensureAccountDeployment();
|
|
42
70
|
const userOpResult = await rhinestoneAccount.sendUserOperation({
|
|
43
71
|
chain,
|
|
44
72
|
calls: calls.map((c) => ({ to: c.to, value: c.value || BigInt(0), data: c.data || "0x" }))
|
|
45
73
|
});
|
|
46
74
|
const result = await rhinestoneAccount.waitForExecution(userOpResult);
|
|
47
75
|
const txHash = result.receipt.transactionHash;
|
|
48
|
-
return publicClient.
|
|
76
|
+
return await publicClient.waitForTransactionReceipt({ hash: txHash });
|
|
49
77
|
} catch (error) {
|
|
50
78
|
throw wrapProviderError(error, "RHINESTONE");
|
|
51
79
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpara/aa-rhinestone",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.22.0",
|
|
4
4
|
"description": "Rhinestone smart account integration for Para",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -17,24 +17,25 @@
|
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
19
|
"scripts": {
|
|
20
|
-
"build": "rm -rf dist &&
|
|
21
|
-
"
|
|
22
|
-
"
|
|
20
|
+
"build": "rm -rf dist && node ./scripts/build.mjs && yarn build:types",
|
|
21
|
+
"test": "vitest run --coverage",
|
|
22
|
+
"build:types": "tsc --emitDeclarationOnly",
|
|
23
|
+
"typecheck": "tsc --noEmit"
|
|
23
24
|
},
|
|
24
25
|
"dependencies": {
|
|
25
|
-
"@getpara/viem-v2-integration": "3.
|
|
26
|
+
"@getpara/viem-v2-integration": "3.22.0",
|
|
26
27
|
"@rhinestone/module-sdk": "0.4.0",
|
|
27
|
-
"@rhinestone/sdk": "
|
|
28
|
-
"permissionless": "^0.2.12"
|
|
28
|
+
"@rhinestone/sdk": "~1.2.16"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"viem": "
|
|
31
|
+
"viem": "^2.38.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"typescript": "^5.8.3"
|
|
34
|
+
"typescript": "^5.8.3",
|
|
35
|
+
"viem": "^2.39.0"
|
|
35
36
|
},
|
|
36
37
|
"publishConfig": {
|
|
37
38
|
"access": "public"
|
|
38
39
|
},
|
|
39
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "4ca50a0fc70e11370595f16daad0f1ac4da0edbc"
|
|
40
41
|
}
|