@gauntlet-xyz/sdk 1.0.3 → 1.0.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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type Hex } from 'viem';
|
|
2
2
|
/**
|
|
3
3
|
* Encode an ERC-8021 builder code as a calldata suffix.
|
|
4
|
-
* Format: codesLength (1 byte) +
|
|
4
|
+
* Format: utf8-encoded builder code + codesLength (1 byte) + schemaId (1 byte) + ERC marker (16 bytes)
|
|
5
5
|
*
|
|
6
6
|
* @see https://eips.ethereum.org/EIPS/eip-8021
|
|
7
7
|
*/
|
|
@@ -4,7 +4,7 @@ const ERC8021_MARKER = '80218021802180218021802180218021';
|
|
|
4
4
|
const ERC8021_SCHEMA_ID = '00'; // Schema 0: simple ASCII codes
|
|
5
5
|
/**
|
|
6
6
|
* Encode an ERC-8021 builder code as a calldata suffix.
|
|
7
|
-
* Format: codesLength (1 byte) +
|
|
7
|
+
* Format: utf8-encoded builder code + codesLength (1 byte) + schemaId (1 byte) + ERC marker (16 bytes)
|
|
8
8
|
*
|
|
9
9
|
* @see https://eips.ethereum.org/EIPS/eip-8021
|
|
10
10
|
*/
|
|
@@ -12,6 +12,6 @@ export function encodeBuilderCode(builderCode) {
|
|
|
12
12
|
const codeHex = toHex(builderCode).slice(2); // UTF-8 hex without 0x prefix
|
|
13
13
|
const codeByteLen = codeHex.length / 2;
|
|
14
14
|
const codeLengthHex = codeByteLen.toString(16).padStart(2, '0');
|
|
15
|
-
return `0x${
|
|
15
|
+
return `0x${codeHex}${codeLengthHex}${ERC8021_SCHEMA_ID}${ERC8021_MARKER}`;
|
|
16
16
|
}
|
|
17
17
|
//# sourceMappingURL=erc8021.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"erc8021.js","sourceRoot":"","sources":["../../src/attribution/erc8021.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAY,MAAM,MAAM,CAAC;AAEvC,mDAAmD;AACnD,MAAM,cAAc,GAAG,kCAA2C,CAAC;AACnE,MAAM,iBAAiB,GAAG,IAAa,CAAC,CAAC,+BAA+B;AAExE;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,WAAmB;IACnD,MAAM,OAAO,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,8BAA8B;IAC3E,MAAM,WAAW,GAAG,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;IACvC,MAAM,aAAa,GAAG,WAAW,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAChE,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"erc8021.js","sourceRoot":"","sources":["../../src/attribution/erc8021.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAY,MAAM,MAAM,CAAC;AAEvC,mDAAmD;AACnD,MAAM,cAAc,GAAG,kCAA2C,CAAC;AACnE,MAAM,iBAAiB,GAAG,IAAa,CAAC,CAAC,+BAA+B;AAExE;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,WAAmB;IACnD,MAAM,OAAO,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,8BAA8B;IAC3E,MAAM,WAAW,GAAG,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;IACvC,MAAM,aAAa,GAAG,WAAW,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAChE,OAAO,KAAK,OAAO,GAAG,aAAa,GAAG,iBAAiB,GAAG,cAAc,EAAS,CAAC;AACpF,CAAC"}
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@ const ERC8021_SCHEMA_ID = '00' as const; // Schema 0: simple ASCII codes
|
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Encode an ERC-8021 builder code as a calldata suffix.
|
|
9
|
-
* Format: codesLength (1 byte) +
|
|
9
|
+
* Format: utf8-encoded builder code + codesLength (1 byte) + schemaId (1 byte) + ERC marker (16 bytes)
|
|
10
10
|
*
|
|
11
11
|
* @see https://eips.ethereum.org/EIPS/eip-8021
|
|
12
12
|
*/
|
|
@@ -14,5 +14,5 @@ export function encodeBuilderCode(builderCode: string): Hex {
|
|
|
14
14
|
const codeHex = toHex(builderCode).slice(2); // UTF-8 hex without 0x prefix
|
|
15
15
|
const codeByteLen = codeHex.length / 2;
|
|
16
16
|
const codeLengthHex = codeByteLen.toString(16).padStart(2, '0');
|
|
17
|
-
return `0x${
|
|
17
|
+
return `0x${codeHex}${codeLengthHex}${ERC8021_SCHEMA_ID}${ERC8021_MARKER}` as Hex;
|
|
18
18
|
}
|