Skip to content

Commit 0c25fb7

Browse files
authored
Update resource ID to contain metadata about chain type (#109)
1 parent 83657e8 commit 0c25fb7

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

packages/anchors/src/Anchor.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,12 @@ class Anchor implements IAnchor {
182182
}
183183

184184
public async createResourceId(): Promise<string> {
185-
return toHex(this.contract.address + toHex((await this.signer.getChainId()), 4).substr(2), 32);
185+
return toHex(
186+
this.contract.address
187+
+ toHex(1, 2).substr(2)
188+
+ toHex((await this.signer.getChainId()), 4).substr(2),
189+
32
190+
);
186191
}
187192

188193
public async setHandler(handlerAddress: string) {

packages/anchors/src/VAnchor.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,11 @@ export class VAnchor implements IAnchor {
238238
}
239239

240240
public async createResourceId(): Promise<string> {
241-
return toHex(this.contract.address + toHex((await this.signer.getChainId()), 4).substr(2), 32);
241+
return toHex(
242+
this.contract.address
243+
+ toHex(1, 2).substr(2)
244+
+ toHex((await this.signer.getChainId()), 4).substr(2),
245+
32);
242246
}
243247

244248
public async setVerifier(verifierAddress: string) {

0 commit comments

Comments
 (0)