@dedot/contracts 0.18.2 → 0.18.4
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.
|
@@ -46,6 +46,16 @@ class ConstructorTxExecutor extends index_js_2.DeployerExecutor {
|
|
|
46
46
|
(0, utils_1.assert)(onChain, 'The deployment transaction has not yet been included in the best chain block or finalized.');
|
|
47
47
|
(0, utils_1.assert)(!dispatchError, 'The deployment transaction failed to execute. Refer to the dispatch error for more information.');
|
|
48
48
|
if (this.registry.isRevive()) {
|
|
49
|
+
// Try to get address from events first
|
|
50
|
+
try {
|
|
51
|
+
const event = client.events.revive.Instantiated.find(events);
|
|
52
|
+
if (event) {
|
|
53
|
+
// @ts-ignore
|
|
54
|
+
return event.palletEvent.data.contract;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
catch { }
|
|
58
|
+
// Fallback to calculate the address if event not found
|
|
49
59
|
if (salt) {
|
|
50
60
|
let code;
|
|
51
61
|
if ((0, utils_1.isPvm)(this.code)) {
|
|
@@ -34,10 +34,20 @@ class SolConstructorTxExecutor extends index_js_2.SolDeployerExecutor {
|
|
|
34
34
|
let deployerAddress, deployerNonce;
|
|
35
35
|
const calculateContractAddress = async (result) => {
|
|
36
36
|
(0, utils_1.assert)(deployerAddress, 'Deployer address Not Found');
|
|
37
|
-
const { status, dispatchError } = result;
|
|
37
|
+
const { status, dispatchError, events } = result;
|
|
38
38
|
const onChain = status.type === 'BestChainBlockIncluded' || status.type === 'Finalized';
|
|
39
39
|
(0, utils_1.assert)(onChain, 'The deployment transaction has not yet been included in the best chain block or finalized.');
|
|
40
40
|
(0, utils_1.assert)(!dispatchError, 'The deployment transaction failed to execute. Refer to the dispatch error for more information.');
|
|
41
|
+
// Try to get address from events first
|
|
42
|
+
try {
|
|
43
|
+
const event = client.events.revive.Instantiated.find(events);
|
|
44
|
+
if (event) {
|
|
45
|
+
// @ts-ignore
|
|
46
|
+
return event.palletEvent.data.contract;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
catch { }
|
|
50
|
+
// Fallback to calculate the address if event not found
|
|
41
51
|
if (salt) {
|
|
42
52
|
let code;
|
|
43
53
|
if ((0, utils_1.isPvm)(this.code)) {
|
|
@@ -43,6 +43,16 @@ export class ConstructorTxExecutor extends DeployerExecutor {
|
|
|
43
43
|
assert(onChain, 'The deployment transaction has not yet been included in the best chain block or finalized.');
|
|
44
44
|
assert(!dispatchError, 'The deployment transaction failed to execute. Refer to the dispatch error for more information.');
|
|
45
45
|
if (this.registry.isRevive()) {
|
|
46
|
+
// Try to get address from events first
|
|
47
|
+
try {
|
|
48
|
+
const event = client.events.revive.Instantiated.find(events);
|
|
49
|
+
if (event) {
|
|
50
|
+
// @ts-ignore
|
|
51
|
+
return event.palletEvent.data.contract;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
catch { }
|
|
55
|
+
// Fallback to calculate the address if event not found
|
|
46
56
|
if (salt) {
|
|
47
57
|
let code;
|
|
48
58
|
if (isPvm(this.code)) {
|
|
@@ -31,10 +31,20 @@ export class SolConstructorTxExecutor extends SolDeployerExecutor {
|
|
|
31
31
|
let deployerAddress, deployerNonce;
|
|
32
32
|
const calculateContractAddress = async (result) => {
|
|
33
33
|
assert(deployerAddress, 'Deployer address Not Found');
|
|
34
|
-
const { status, dispatchError } = result;
|
|
34
|
+
const { status, dispatchError, events } = result;
|
|
35
35
|
const onChain = status.type === 'BestChainBlockIncluded' || status.type === 'Finalized';
|
|
36
36
|
assert(onChain, 'The deployment transaction has not yet been included in the best chain block or finalized.');
|
|
37
37
|
assert(!dispatchError, 'The deployment transaction failed to execute. Refer to the dispatch error for more information.');
|
|
38
|
+
// Try to get address from events first
|
|
39
|
+
try {
|
|
40
|
+
const event = client.events.revive.Instantiated.find(events);
|
|
41
|
+
if (event) {
|
|
42
|
+
// @ts-ignore
|
|
43
|
+
return event.palletEvent.data.contract;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
catch { }
|
|
47
|
+
// Fallback to calculate the address if event not found
|
|
38
48
|
if (salt) {
|
|
39
49
|
let code;
|
|
40
50
|
if (isPvm(this.code)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dedot/contracts",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.4",
|
|
4
4
|
"description": "Delightful ink! Contract APIs",
|
|
5
5
|
"author": "Tung Vu <tung@dedot.dev>",
|
|
6
6
|
"homepage": "https://dedot.dev",
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
"test": "npx vitest --watch=false"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@dedot/api": "0.18.
|
|
22
|
-
"@dedot/codecs": "0.18.
|
|
23
|
-
"@dedot/types": "0.18.
|
|
24
|
-
"@dedot/utils": "0.18.
|
|
21
|
+
"@dedot/api": "0.18.4",
|
|
22
|
+
"@dedot/codecs": "0.18.4",
|
|
23
|
+
"@dedot/types": "0.18.4",
|
|
24
|
+
"@dedot/utils": "0.18.4",
|
|
25
25
|
"viem": "^2.37.7"
|
|
26
26
|
},
|
|
27
27
|
"publishConfig": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"node": ">=18"
|
|
33
33
|
},
|
|
34
34
|
"license": "Apache-2.0",
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "ccfe55a98b0a7244b7fc0974c269f2c90b2a1f4d",
|
|
36
36
|
"module": "./index.js",
|
|
37
37
|
"types": "./index.d.ts",
|
|
38
38
|
"exports": {
|