ox 0.14.17 → 0.14.18
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/CHANGELOG.md +6 -0
- package/_cjs/tempo/VirtualAddress.js +70 -0
- package/_cjs/tempo/VirtualAddress.js.map +1 -0
- package/_cjs/tempo/VirtualMaster.js +99 -0
- package/_cjs/tempo/VirtualMaster.js.map +1 -0
- package/_cjs/tempo/index.js +3 -1
- package/_cjs/tempo/index.js.map +1 -1
- package/_cjs/version.js +1 -1
- package/_esm/tempo/VirtualAddress.js +154 -0
- package/_esm/tempo/VirtualAddress.js.map +1 -0
- package/_esm/tempo/VirtualMaster.js +200 -0
- package/_esm/tempo/VirtualMaster.js.map +1 -0
- package/_esm/tempo/index.js +52 -0
- package/_esm/tempo/index.js.map +1 -1
- package/_esm/version.js +1 -1
- package/_types/core/RpcSchema.d.ts +0 -2
- package/_types/core/RpcSchema.d.ts.map +1 -1
- package/_types/tempo/VirtualAddress.d.ts +129 -0
- package/_types/tempo/VirtualAddress.d.ts.map +1 -0
- package/_types/tempo/VirtualMaster.d.ts +155 -0
- package/_types/tempo/VirtualMaster.d.ts.map +1 -0
- package/_types/tempo/index.d.ts +52 -0
- package/_types/tempo/index.d.ts.map +1 -1
- package/_types/version.d.ts +1 -1
- package/core/RpcSchema.ts +0 -2
- package/package.json +11 -1
- package/tempo/VirtualAddress/package.json +6 -0
- package/tempo/VirtualAddress.test.ts +88 -0
- package/tempo/VirtualAddress.ts +201 -0
- package/tempo/VirtualMaster/package.json +6 -0
- package/tempo/VirtualMaster.test.ts +127 -0
- package/tempo/VirtualMaster.ts +303 -0
- package/tempo/e2e.test.ts +0 -2
- package/tempo/index.ts +52 -0
- package/version.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# ox
|
|
2
2
|
|
|
3
|
+
## 0.14.18
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#221](https://github.com/wevm/ox/pull/221) [`3b84126`](https://github.com/wevm/ox/commit/3b841266704b2e2bc24359462bafd8acd7a16ec9) Thanks [@tmm](https://github.com/tmm)! - Added [TIP-1022](https://docs.tempo.xyz/protocol/tips/tip-1022) virtual address utilities to `ox/tempo`, including `VirtualAddress` helpers for formatting and parsing virtual addresses and `VirtualMaster` helpers for deriving registration hashes, validating salts, and mining bounded salt ranges.
|
|
8
|
+
|
|
3
9
|
## 0.14.17
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InvalidMagicError = exports.magic = void 0;
|
|
4
|
+
exports.from = from;
|
|
5
|
+
exports.isVirtual = isVirtual;
|
|
6
|
+
exports.parse = parse;
|
|
7
|
+
exports.validate = validate;
|
|
8
|
+
const Address = require("../core/Address.js");
|
|
9
|
+
const Bytes = require("../core/Bytes.js");
|
|
10
|
+
const Errors = require("../core/Errors.js");
|
|
11
|
+
const Hex = require("../core/Hex.js");
|
|
12
|
+
const TempoAddress = require("./TempoAddress.js");
|
|
13
|
+
exports.magic = '0xfdfdfdfdfdfdfdfdfdfd';
|
|
14
|
+
function from(value) {
|
|
15
|
+
return Address.from(Hex.concat(toFixedHex(value.masterId, 4), exports.magic, toFixedHex(value.userTag, 6)));
|
|
16
|
+
}
|
|
17
|
+
function isVirtual(address) {
|
|
18
|
+
try {
|
|
19
|
+
const resolved = resolveAddress(address);
|
|
20
|
+
return Hex.slice(resolved, 4, 14).toLowerCase() === exports.magic;
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function parse(address) {
|
|
27
|
+
const resolved = resolveAddress(address);
|
|
28
|
+
if (Hex.slice(resolved, 4, 14).toLowerCase() !== exports.magic)
|
|
29
|
+
throw new InvalidMagicError({ address: resolved });
|
|
30
|
+
return {
|
|
31
|
+
masterId: Hex.slice(resolved, 0, 4),
|
|
32
|
+
userTag: Hex.slice(resolved, 14, 20),
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function validate(address) {
|
|
36
|
+
try {
|
|
37
|
+
parse(address);
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
class InvalidMagicError extends Errors.BaseError {
|
|
45
|
+
constructor({ address }) {
|
|
46
|
+
super(`Address "${address}" does not contain the TIP-1022 virtual address marker.`);
|
|
47
|
+
Object.defineProperty(this, "name", {
|
|
48
|
+
enumerable: true,
|
|
49
|
+
configurable: true,
|
|
50
|
+
writable: true,
|
|
51
|
+
value: 'VirtualAddress.InvalidMagicError'
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
exports.InvalidMagicError = InvalidMagicError;
|
|
56
|
+
function resolveAddress(address) {
|
|
57
|
+
const resolved = TempoAddress.resolve(address);
|
|
58
|
+
Address.assert(resolved, { strict: false });
|
|
59
|
+
return resolved;
|
|
60
|
+
}
|
|
61
|
+
function toFixedHex(value, size) {
|
|
62
|
+
if (typeof value === 'number' || typeof value === 'bigint')
|
|
63
|
+
return Hex.fromNumber(value, { size });
|
|
64
|
+
if (typeof value === 'string') {
|
|
65
|
+
Hex.assert(value, { strict: true });
|
|
66
|
+
return Hex.padLeft(value, size);
|
|
67
|
+
}
|
|
68
|
+
return Hex.fromBytes(Bytes.padLeft(value, size));
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=VirtualAddress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VirtualAddress.js","sourceRoot":"","sources":["../../tempo/VirtualAddress.ts"],"names":[],"mappings":";;;AAoCA,oBAQC;AA2CD,8BAOC;AAsBD,sBAUC;AAwCD,4BAOC;AA7KD,8CAA6C;AAC7C,0CAAyC;AAC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;IACd,CAAC;AACH,CAAC;AAGD,MAAa,iBAAkB,SAAQ,MAAM,CAAC,SAAS;IAGrD,YAAY,EAAE,OAAO,EAAuB;QAC1C,KAAK,CACH,YAAY,OAAO,yDAAyD,CAC7E,CAAA;QALe;;;;mBAAO,kCAAkC;WAAA;IAM3D,CAAC;CACF;AARD,8CAQC;AAED,SAAS,cAAc,CAAC,OAAe;IACrC,MAAM,QAAQ,GAAG,YAAY,CAAC,OAAO,CAAC,OAA+B,CAAC,CAAA;IACtE,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAA;IAC3C,OAAO,QAAQ,CAAA;AACjB,CAAC;AAED,SAAS,UAAU,CAAC,KAAW,EAAE,IAAY;IAC3C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,QAAQ;QACxD,OAAO,GAAG,CAAC,UAAU,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,CAAA;IACxC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAA;QACnC,OAAO,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;IACjC,CAAC;IACD,OAAO,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAA;AAClD,CAAC"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getRegistrationHash = getRegistrationHash;
|
|
4
|
+
exports.getMasterId = getMasterId;
|
|
5
|
+
exports.validateSalt = validateSalt;
|
|
6
|
+
exports.mineSalt = mineSalt;
|
|
7
|
+
const Address = require("../core/Address.js");
|
|
8
|
+
const Bytes = require("../core/Bytes.js");
|
|
9
|
+
const Errors = require("../core/Errors.js");
|
|
10
|
+
const Hash = require("../core/Hash.js");
|
|
11
|
+
const Hex = require("../core/Hex.js");
|
|
12
|
+
const TempoAddress = require("./TempoAddress.js");
|
|
13
|
+
const VirtualAddress = require("./VirtualAddress.js");
|
|
14
|
+
const tip20Prefix = '0x20c000000000000000000000';
|
|
15
|
+
const zeroAddress = '0x0000000000000000000000000000000000000000';
|
|
16
|
+
function getRegistrationHash(value) {
|
|
17
|
+
return Hash.keccak256(Hex.concat(resolveAddress(value.address), toFixedHex(value.salt, 32)));
|
|
18
|
+
}
|
|
19
|
+
function getMasterId(value) {
|
|
20
|
+
return Hex.slice(getRegistrationHash(value), 4, 8);
|
|
21
|
+
}
|
|
22
|
+
function validateSalt(value) {
|
|
23
|
+
try {
|
|
24
|
+
return hasProofOfWork(Hash.keccak256(Hex.concat(resolveAddress(value.address), toFixedHex(value.salt, 32)), { as: 'Bytes' }));
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function mineSalt(value) {
|
|
31
|
+
assertCount(value.count);
|
|
32
|
+
const address = resolveAddress(value.address);
|
|
33
|
+
const addressBytes = Bytes.fromHex(address);
|
|
34
|
+
const saltBytes = toFixedBytes(value.start ?? 0n, 32);
|
|
35
|
+
const input = new Uint8Array(addressBytes.length + saltBytes.length);
|
|
36
|
+
input.set(addressBytes);
|
|
37
|
+
for (let i = 0; i < value.count; i++) {
|
|
38
|
+
input.set(saltBytes, addressBytes.length);
|
|
39
|
+
const registrationHash = Hash.keccak256(input, { as: 'Bytes' });
|
|
40
|
+
if (hasProofOfWork(registrationHash)) {
|
|
41
|
+
return {
|
|
42
|
+
masterId: Hex.fromBytes(registrationHash.subarray(4, 8)),
|
|
43
|
+
registrationHash: Hex.fromBytes(registrationHash),
|
|
44
|
+
salt: Hex.fromBytes(saltBytes),
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
if (i < value.count - 1 && !increment(saltBytes))
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
function hasProofOfWork(hash) {
|
|
53
|
+
return hash[0] === 0 && hash[1] === 0 && hash[2] === 0 && hash[3] === 0;
|
|
54
|
+
}
|
|
55
|
+
function assertCount(count) {
|
|
56
|
+
if (Number.isSafeInteger(count) && count > 0)
|
|
57
|
+
return;
|
|
58
|
+
throw new Errors.BaseError(`Count "${count}" is invalid. Expected a positive safe integer.`);
|
|
59
|
+
}
|
|
60
|
+
function increment(bytes) {
|
|
61
|
+
for (let i = bytes.length - 1; i >= 0; i--) {
|
|
62
|
+
const value = bytes[i];
|
|
63
|
+
if (value === 0xff) {
|
|
64
|
+
bytes[i] = 0;
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
bytes[i] = value + 1;
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
function resolveAddress(address) {
|
|
73
|
+
const resolved = TempoAddress.resolve(address);
|
|
74
|
+
Address.assert(resolved, { strict: false });
|
|
75
|
+
assertValidMasterAddress(resolved);
|
|
76
|
+
return resolved;
|
|
77
|
+
}
|
|
78
|
+
function assertValidMasterAddress(address) {
|
|
79
|
+
const normalized = address.toLowerCase();
|
|
80
|
+
if (normalized === zeroAddress)
|
|
81
|
+
throw new Errors.BaseError('Virtual master address cannot be the zero address.');
|
|
82
|
+
if (VirtualAddress.isVirtual(address))
|
|
83
|
+
throw new Errors.BaseError('Virtual master address cannot itself be a virtual address.');
|
|
84
|
+
if (normalized.startsWith(tip20Prefix))
|
|
85
|
+
throw new Errors.BaseError('Virtual master address cannot be a TIP-20 token address.');
|
|
86
|
+
}
|
|
87
|
+
function toFixedBytes(value, size) {
|
|
88
|
+
return Bytes.fromHex(toFixedHex(value, size));
|
|
89
|
+
}
|
|
90
|
+
function toFixedHex(value, size) {
|
|
91
|
+
if (typeof value === 'number' || typeof value === 'bigint')
|
|
92
|
+
return Hex.fromNumber(value, { size });
|
|
93
|
+
if (typeof value === 'string') {
|
|
94
|
+
Hex.assert(value, { strict: true });
|
|
95
|
+
return Hex.padLeft(value, size);
|
|
96
|
+
}
|
|
97
|
+
return Hex.fromBytes(Bytes.padLeft(value, size));
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=VirtualMaster.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VirtualMaster.js","sourceRoot":"","sources":["../../tempo/VirtualMaster.ts"],"names":[],"mappings":";;AAyCA,kDAIC;AAkDD,kCAEC;AA+BD,oCAWC;AAmCD,4BA4BC;AA1MD,8CAA6C;AAC7C,0CAAyC;AACzC,4CAA2C;AAC3C,wCAAuC;AACvC,sCAAqC;AACrC,kDAAiD;AACjD,sDAAqD;AAErD,MAAM,WAAW,GAAG,4BAA4B,CAAA;AAChD,MAAM,WAAW,GAAG,4CAA4C,CAAA;AAgChE,SAAgB,mBAAmB,CAAC,KAAgC;IAClE,OAAO,IAAI,CAAC,SAAS,CACnB,GAAG,CAAC,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,UAAU,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CACtE,CAAA;AACH,CAAC;AAkDD,SAAgB,WAAW,CAAC,KAAwB;IAClD,OAAO,GAAG,CAAC,KAAK,CAAC,mBAAmB,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;AACpD,CAAC;AA+BD,SAAgB,YAAY,CAAC,KAAyB;IACpD,IAAI,CAAC;QACH,OAAO,cAAc,CACnB,IAAI,CAAC,SAAS,CACZ,GAAG,CAAC,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,UAAU,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EACrE,EAAE,EAAE,EAAE,OAAO,EAAE,CAChB,CACF,CAAA;I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E,CAAA;IAExC,IAAI,UAAU,KAAK,WAAW;QAC5B,MAAM,IAAI,MAAM,CAAC,SAAS,CACxB,oDAAoD,CACrD,CAAA;IAEH,IAAI,cAAc,CAAC,SAAS,CAAC,OAAO,CAAC;QACnC,MAAM,IAAI,MAAM,CAAC,SAAS,CACxB,4DAA4D,CAC7D,CAAA;IAEH,IAAI,UAAU,CAAC,UAAU,CAAC,WAAW,CAAC;QACpC,MAAM,IAAI,MAAM,CAAC,SAAS,CACxB,0DAA0D,CAC3D,CAAA;AACL,CAAC;AAED,SAAS,YAAY,CAAC,KAAW,EAAE,IAAY;IAC7C,OAAO,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAA;AAC/C,CAAC;AAED,SAAS,UAAU,CAAC,KAAW,EAAE,IAAY;IAC3C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,QAAQ;QACxD,OAAO,GAAG,CAAC,UAAU,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,CAAA;IACxC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAA;QACnC,OAAO,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;IACjC,CAAC;IACD,OAAO,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAA;AAClD,CAAC"}
|
package/_cjs/tempo/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ZoneRpcAuthentication = exports.ZoneId = exports.TxEnvelopeTempo = exports.TransactionRequest = exports.TransactionReceipt = exports.Transaction = exports.TokenRole = exports.TokenId = exports.Tick = exports.TempoAddress = exports.SignatureEnvelope = exports.RpcSchemaTempo = exports.PoolId = exports.Period = exports.KeyAuthorization = exports.AuthorizationTempo = void 0;
|
|
3
|
+
exports.ZoneRpcAuthentication = exports.ZoneId = exports.VirtualMaster = exports.VirtualAddress = exports.TxEnvelopeTempo = exports.TransactionRequest = exports.TransactionReceipt = exports.Transaction = exports.TokenRole = exports.TokenId = exports.Tick = exports.TempoAddress = exports.SignatureEnvelope = exports.RpcSchemaTempo = exports.PoolId = exports.Period = exports.KeyAuthorization = exports.AuthorizationTempo = void 0;
|
|
4
4
|
exports.AuthorizationTempo = require("./AuthorizationTempo.js");
|
|
5
5
|
exports.KeyAuthorization = require("./KeyAuthorization.js");
|
|
6
6
|
exports.Period = require("./Period.js");
|
|
@@ -15,6 +15,8 @@ exports.Transaction = require("./Transaction.js");
|
|
|
15
15
|
exports.TransactionReceipt = require("./TransactionReceipt.js");
|
|
16
16
|
exports.TransactionRequest = require("./TransactionRequest.js");
|
|
17
17
|
exports.TxEnvelopeTempo = require("./TxEnvelopeTempo.js");
|
|
18
|
+
exports.VirtualAddress = require("./VirtualAddress.js");
|
|
19
|
+
exports.VirtualMaster = require("./VirtualMaster.js");
|
|
18
20
|
exports.ZoneId = require("./ZoneId.js");
|
|
19
21
|
exports.ZoneRpcAuthentication = require("./ZoneRpcAuthentication.js");
|
|
20
22
|
//# sourceMappingURL=index.js.map
|
package/_cjs/tempo/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../tempo/index.ts"],"names":[],"mappings":";;;AAoCA,gEAA6D;AAwC7D,4DAAyD;AA6BzD,wCAAqC;AAsBrC,wCAAqC;AAmBrC,wDAAqD;AAuBrD,8DAA2D;AAmB3D,oDAAiD;AAoBjD,oCAAiC;AAqBjC,0CAAuC;AAkBvC,8CAA2C;AAkD3C,kDAA+C;AAuB/C,gEAA6D;AAqB7D,gEAA6D;AA6B7D,0DAAuD;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../tempo/index.ts"],"names":[],"mappings":";;;AAoCA,gEAA6D;AAwC7D,4DAAyD;AA6BzD,wCAAqC;AAsBrC,wCAAqC;AAmBrC,wDAAqD;AAuBrD,8DAA2D;AAmB3D,oDAAiD;AAoBjD,oCAAiC;AAqBjC,0CAAuC;AAkBvC,8CAA2C;AAkD3C,kDAA+C;AAuB/C,gEAA6D;AAqB7D,gEAA6D;AA6B7D,0DAAuD;AA4BvD,wDAAqD;AAwBrD,sDAAmD;AAoBnD,wCAAqC;AAmCrC,sEAAmE"}
|
package/_cjs/version.js
CHANGED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import * as Address from '../core/Address.js';
|
|
2
|
+
import * as Bytes from '../core/Bytes.js';
|
|
3
|
+
import * as Errors from '../core/Errors.js';
|
|
4
|
+
import * as Hex from '../core/Hex.js';
|
|
5
|
+
import * as TempoAddress from './TempoAddress.js';
|
|
6
|
+
/** Fixed 10-byte marker used by TIP-1022 virtual addresses. */
|
|
7
|
+
export const magic = '0xfdfdfdfdfdfdfdfdfdfd';
|
|
8
|
+
/**
|
|
9
|
+
* Builds a TIP-1022 virtual address from a `masterId` and `userTag`.
|
|
10
|
+
*
|
|
11
|
+
* [TIP-1022](https://docs.tempo.xyz/protocol/tips/tip-1022)
|
|
12
|
+
*
|
|
13
|
+
* TIP-1022 encodes virtual addresses as:
|
|
14
|
+
* `[4-byte masterId][10-byte VIRTUAL_MAGIC][6-byte userTag]`
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts twoslash
|
|
18
|
+
* import { VirtualAddress } from 'ox/tempo'
|
|
19
|
+
*
|
|
20
|
+
* const address = VirtualAddress.from({
|
|
21
|
+
* masterId: '0x58e21090',
|
|
22
|
+
* userTag: '0x010203040506',
|
|
23
|
+
* })
|
|
24
|
+
*
|
|
25
|
+
* address
|
|
26
|
+
* // @log: '0x58e21090fdfdfdfdfdfdfdfdfdfd010203040506'
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @param value - The virtual address parts.
|
|
30
|
+
* @returns The virtual address.
|
|
31
|
+
*/
|
|
32
|
+
export function from(value) {
|
|
33
|
+
return Address.from(Hex.concat(toFixedHex(value.masterId, 4), magic, toFixedHex(value.userTag, 6)));
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Checks whether an address matches the TIP-1022 virtual address format.
|
|
37
|
+
*
|
|
38
|
+
* [TIP-1022](https://docs.tempo.xyz/protocol/tips/tip-1022)
|
|
39
|
+
*
|
|
40
|
+
* This only checks the reserved byte layout, not whether the `masterId`
|
|
41
|
+
* is registered onchain.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```ts twoslash
|
|
45
|
+
* import { VirtualAddress } from 'ox/tempo'
|
|
46
|
+
*
|
|
47
|
+
* const isVirtual = VirtualAddress.isVirtual(
|
|
48
|
+
* '0x58e21090fdfdfdfdfdfdfdfdfdfd010203040506',
|
|
49
|
+
* )
|
|
50
|
+
*
|
|
51
|
+
* isVirtual
|
|
52
|
+
* // @log: true
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* @param address - Address to check.
|
|
56
|
+
* @returns `true` if the address matches the virtual-address layout.
|
|
57
|
+
*/
|
|
58
|
+
export function isVirtual(address) {
|
|
59
|
+
try {
|
|
60
|
+
const resolved = resolveAddress(address);
|
|
61
|
+
return Hex.slice(resolved, 4, 14).toLowerCase() === magic;
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Parses a TIP-1022 virtual address into its `masterId` and `userTag` parts.
|
|
69
|
+
*
|
|
70
|
+
* [TIP-1022](https://docs.tempo.xyz/protocol/tips/tip-1022)
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```ts twoslash
|
|
74
|
+
* import { VirtualAddress } from 'ox/tempo'
|
|
75
|
+
*
|
|
76
|
+
* const parsed = VirtualAddress.parse(
|
|
77
|
+
* '0x58e21090fdfdfdfdfdfdfdfdfdfd010203040506',
|
|
78
|
+
* )
|
|
79
|
+
*
|
|
80
|
+
* parsed
|
|
81
|
+
* // @log: { masterId: '0x58e21090', userTag: '0x010203040506' }
|
|
82
|
+
* ```
|
|
83
|
+
*
|
|
84
|
+
* @param address - The virtual address to parse.
|
|
85
|
+
* @returns The decoded virtual address components.
|
|
86
|
+
*/
|
|
87
|
+
export function parse(address) {
|
|
88
|
+
const resolved = resolveAddress(address);
|
|
89
|
+
if (Hex.slice(resolved, 4, 14).toLowerCase() !== magic)
|
|
90
|
+
throw new InvalidMagicError({ address: resolved });
|
|
91
|
+
return {
|
|
92
|
+
masterId: Hex.slice(resolved, 0, 4),
|
|
93
|
+
userTag: Hex.slice(resolved, 14, 20),
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Validates that an address matches the TIP-1022 virtual address format.
|
|
98
|
+
*
|
|
99
|
+
* [TIP-1022](https://docs.tempo.xyz/protocol/tips/tip-1022)
|
|
100
|
+
*
|
|
101
|
+
* This only validates the reserved byte layout, not whether the `masterId`
|
|
102
|
+
* resolves to a registered master onchain.
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* ```ts twoslash
|
|
106
|
+
* import { VirtualAddress } from 'ox/tempo'
|
|
107
|
+
*
|
|
108
|
+
* const valid = VirtualAddress.validate(
|
|
109
|
+
* '0x58e21090fdfdfdfdfdfdfdfdfdfd010203040506',
|
|
110
|
+
* )
|
|
111
|
+
*
|
|
112
|
+
* valid
|
|
113
|
+
* // @log: true
|
|
114
|
+
* ```
|
|
115
|
+
*
|
|
116
|
+
* @param address - Address to validate.
|
|
117
|
+
* @returns `true` if the address has a valid virtual-address layout.
|
|
118
|
+
*/
|
|
119
|
+
export function validate(address) {
|
|
120
|
+
try {
|
|
121
|
+
parse(address);
|
|
122
|
+
return true;
|
|
123
|
+
}
|
|
124
|
+
catch {
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
/** Thrown when an address does not contain the TIP-1022 virtual marker. */
|
|
129
|
+
export class InvalidMagicError extends Errors.BaseError {
|
|
130
|
+
constructor({ address }) {
|
|
131
|
+
super(`Address "${address}" does not contain the TIP-1022 virtual address marker.`);
|
|
132
|
+
Object.defineProperty(this, "name", {
|
|
133
|
+
enumerable: true,
|
|
134
|
+
configurable: true,
|
|
135
|
+
writable: true,
|
|
136
|
+
value: 'VirtualAddress.InvalidMagicError'
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
function resolveAddress(address) {
|
|
141
|
+
const resolved = TempoAddress.resolve(address);
|
|
142
|
+
Address.assert(resolved, { strict: false });
|
|
143
|
+
return resolved;
|
|
144
|
+
}
|
|
145
|
+
function toFixedHex(value, size) {
|
|
146
|
+
if (typeof value === 'number' || typeof value === 'bigint')
|
|
147
|
+
return Hex.fromNumber(value, { size });
|
|
148
|
+
if (typeof value === 'string') {
|
|
149
|
+
Hex.assert(value, { strict: true });
|
|
150
|
+
return Hex.padLeft(value, size);
|
|
151
|
+
}
|
|
152
|
+
return Hex.fromBytes(Bytes.padLeft(value, size));
|
|
153
|
+
}
|
|
154
|
+
//# sourceMappingURL=VirtualAddress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VirtualAddress.js","sourceRoot":"","sources":["../../tempo/VirtualAddress.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAA;AAC7C,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAA;AACzC,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAA;AAC3C,OAAO,KAAK,GAAG,MAAM,gBAAgB,CAAA;AACrC,OAAO,KAAK,YAAY,MAAM,mBAAmB,CAAA;AAEjD,+DAA+D;AAC/D,MAAM,CAAC,MAAM,KAAK,GAAG,wBAAiC,CAAA;AAK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AA;QACd,OAAO,IAAI,CAAA;IACb,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAA;IACd,CAAC;AACH,CAAC;AAED,2EAA2E;AAC3E,MAAM,OAAO,iBAAkB,SAAQ,MAAM,CAAC,SAAS;IAGrD,YAAY,EAAE,OAAO,EAAuB;QAC1C,KAAK,CACH,YAAY,OAAO,yDAAyD,CAC7E,CAAA;QALe;;;;mBAAO,kCAAkC;WAAA;IAM3D,CAAC;CACF;AAED,SAAS,cAAc,CAAC,OAAe;IACrC,MAAM,QAAQ,GAAG,YAAY,CAAC,OAAO,CAAC,OAA+B,CAAC,CAAA;IACtE,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAA;IAC3C,OAAO,QAAQ,CAAA;AACjB,CAAC;AAED,SAAS,UAAU,CAAC,KAAW,EAAE,IAAY;IAC3C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,QAAQ;QACxD,OAAO,GAAG,CAAC,UAAU,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,CAAA;IACxC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAA;QACnC,OAAO,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;IACjC,CAAC;IACD,OAAO,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAA;AAClD,CAAC"}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import * as Address from '../core/Address.js';
|
|
2
|
+
import * as Bytes from '../core/Bytes.js';
|
|
3
|
+
import * as Errors from '../core/Errors.js';
|
|
4
|
+
import * as Hash from '../core/Hash.js';
|
|
5
|
+
import * as Hex from '../core/Hex.js';
|
|
6
|
+
import * as TempoAddress from './TempoAddress.js';
|
|
7
|
+
import * as VirtualAddress from './VirtualAddress.js';
|
|
8
|
+
const tip20Prefix = '0x20c000000000000000000000';
|
|
9
|
+
const zeroAddress = '0x0000000000000000000000000000000000000000';
|
|
10
|
+
/**
|
|
11
|
+
* Computes the TIP-1022 registration hash for a master address and salt.
|
|
12
|
+
*
|
|
13
|
+
* [TIP-1022](https://docs.tempo.xyz/protocol/tips/tip-1022)
|
|
14
|
+
*
|
|
15
|
+
* The registration hash is `keccak256(masterAddress || salt)` where `salt`
|
|
16
|
+
* is encoded as a 32-byte value.
|
|
17
|
+
*
|
|
18
|
+
* Master addresses must satisfy TIP-1022 registration constraints: they cannot
|
|
19
|
+
* be the zero address, another virtual address, or a TIP-20 token address.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts twoslash
|
|
23
|
+
* import { VirtualMaster } from 'ox/tempo'
|
|
24
|
+
*
|
|
25
|
+
* const hash = VirtualMaster.getRegistrationHash({
|
|
26
|
+
* address: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
|
|
27
|
+
* salt: '0x00000000000000000000000000000000000000000000000000000000abf52baf',
|
|
28
|
+
* })
|
|
29
|
+
*
|
|
30
|
+
* hash
|
|
31
|
+
* // @log: '0x0000000058e21090d8f4bee424b90cddc2378aefa1bbbfa1443631a929ae966d'
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* @param value - Master address and salt.
|
|
35
|
+
* @returns The registration hash.
|
|
36
|
+
*/
|
|
37
|
+
export function getRegistrationHash(value) {
|
|
38
|
+
return Hash.keccak256(Hex.concat(resolveAddress(value.address), toFixedHex(value.salt, 32)));
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Derives the 4-byte TIP-1022 `masterId` from a master address and salt.
|
|
42
|
+
*
|
|
43
|
+
* [TIP-1022](https://docs.tempo.xyz/protocol/tips/tip-1022)
|
|
44
|
+
*
|
|
45
|
+
* This returns bytes `[4:8]` of the registration hash, regardless of whether the
|
|
46
|
+
* salt satisfies the proof-of-work requirement.
|
|
47
|
+
*
|
|
48
|
+
* Master addresses must satisfy TIP-1022 registration constraints: they cannot
|
|
49
|
+
* be the zero address, another virtual address, or a TIP-20 token address.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```ts twoslash
|
|
53
|
+
* import { VirtualMaster } from 'ox/tempo'
|
|
54
|
+
*
|
|
55
|
+
* const masterId = VirtualMaster.getMasterId({
|
|
56
|
+
* address: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
|
|
57
|
+
* salt: '0x00000000000000000000000000000000000000000000000000000000abf52baf',
|
|
58
|
+
* })
|
|
59
|
+
*
|
|
60
|
+
* masterId
|
|
61
|
+
* // @log: '0x58e21090'
|
|
62
|
+
* ```
|
|
63
|
+
*
|
|
64
|
+
* @param value - Master address and salt.
|
|
65
|
+
* @returns The derived master identifier.
|
|
66
|
+
*/
|
|
67
|
+
export function getMasterId(value) {
|
|
68
|
+
return Hex.slice(getRegistrationHash(value), 4, 8);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Validates that a salt satisfies the TIP-1022 32-bit proof-of-work requirement.
|
|
72
|
+
*
|
|
73
|
+
* [TIP-1022](https://docs.tempo.xyz/protocol/tips/tip-1022)
|
|
74
|
+
*
|
|
75
|
+
* Returns `false` for invalid master addresses, including the zero address,
|
|
76
|
+
* virtual addresses, and TIP-20 token addresses.
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```ts twoslash
|
|
80
|
+
* import { VirtualMaster } from 'ox/tempo'
|
|
81
|
+
*
|
|
82
|
+
* const valid = VirtualMaster.validateSalt({
|
|
83
|
+
* address: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
|
|
84
|
+
* salt: '0x00000000000000000000000000000000000000000000000000000000abf52baf',
|
|
85
|
+
* })
|
|
86
|
+
*
|
|
87
|
+
* valid
|
|
88
|
+
* // @log: true
|
|
89
|
+
* ```
|
|
90
|
+
*
|
|
91
|
+
* @param value - Master address and salt.
|
|
92
|
+
* @returns `true` if the first 4 bytes of the registration hash are zero.
|
|
93
|
+
*/
|
|
94
|
+
export function validateSalt(value) {
|
|
95
|
+
try {
|
|
96
|
+
return hasProofOfWork(Hash.keccak256(Hex.concat(resolveAddress(value.address), toFixedHex(value.salt, 32)), { as: 'Bytes' }));
|
|
97
|
+
}
|
|
98
|
+
catch {
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Searches a bounded range of salts for the first value that satisfies TIP-1022 PoW.
|
|
104
|
+
*
|
|
105
|
+
* [TIP-1022](https://docs.tempo.xyz/protocol/tips/tip-1022)
|
|
106
|
+
*
|
|
107
|
+
* This is intentionally a small, deterministic primitive. It does not coordinate
|
|
108
|
+
* workers or async execution. Callers that need large searches can shard ranges
|
|
109
|
+
* externally.
|
|
110
|
+
*
|
|
111
|
+
* Master addresses must satisfy TIP-1022 registration constraints: they cannot
|
|
112
|
+
* be the zero address, another virtual address, or a TIP-20 token address.
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* ```ts twoslash
|
|
116
|
+
* import { VirtualMaster } from 'ox/tempo'
|
|
117
|
+
*
|
|
118
|
+
* const result = VirtualMaster.mineSalt({
|
|
119
|
+
* address: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
|
|
120
|
+
* start: 0xabf52ba0n,
|
|
121
|
+
* count: 16,
|
|
122
|
+
* })
|
|
123
|
+
*
|
|
124
|
+
* result?.salt
|
|
125
|
+
* // @log: '0x00000000000000000000000000000000000000000000000000000000abf52baf'
|
|
126
|
+
* ```
|
|
127
|
+
*
|
|
128
|
+
* @param value - Search range parameters.
|
|
129
|
+
* @returns The first matching salt in the range, if any.
|
|
130
|
+
*/
|
|
131
|
+
export function mineSalt(value) {
|
|
132
|
+
assertCount(value.count);
|
|
133
|
+
const address = resolveAddress(value.address);
|
|
134
|
+
const addressBytes = Bytes.fromHex(address);
|
|
135
|
+
const saltBytes = toFixedBytes(value.start ?? 0n, 32);
|
|
136
|
+
const input = new Uint8Array(addressBytes.length + saltBytes.length);
|
|
137
|
+
input.set(addressBytes);
|
|
138
|
+
for (let i = 0; i < value.count; i++) {
|
|
139
|
+
input.set(saltBytes, addressBytes.length);
|
|
140
|
+
const registrationHash = Hash.keccak256(input, { as: 'Bytes' });
|
|
141
|
+
if (hasProofOfWork(registrationHash)) {
|
|
142
|
+
return {
|
|
143
|
+
masterId: Hex.fromBytes(registrationHash.subarray(4, 8)),
|
|
144
|
+
registrationHash: Hex.fromBytes(registrationHash),
|
|
145
|
+
salt: Hex.fromBytes(saltBytes),
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
if (i < value.count - 1 && !increment(saltBytes))
|
|
149
|
+
break;
|
|
150
|
+
}
|
|
151
|
+
return undefined;
|
|
152
|
+
}
|
|
153
|
+
function hasProofOfWork(hash) {
|
|
154
|
+
return hash[0] === 0 && hash[1] === 0 && hash[2] === 0 && hash[3] === 0;
|
|
155
|
+
}
|
|
156
|
+
function assertCount(count) {
|
|
157
|
+
if (Number.isSafeInteger(count) && count > 0)
|
|
158
|
+
return;
|
|
159
|
+
throw new Errors.BaseError(`Count "${count}" is invalid. Expected a positive safe integer.`);
|
|
160
|
+
}
|
|
161
|
+
function increment(bytes) {
|
|
162
|
+
for (let i = bytes.length - 1; i >= 0; i--) {
|
|
163
|
+
const value = bytes[i];
|
|
164
|
+
if (value === 0xff) {
|
|
165
|
+
bytes[i] = 0;
|
|
166
|
+
continue;
|
|
167
|
+
}
|
|
168
|
+
bytes[i] = value + 1;
|
|
169
|
+
return true;
|
|
170
|
+
}
|
|
171
|
+
return false;
|
|
172
|
+
}
|
|
173
|
+
function resolveAddress(address) {
|
|
174
|
+
const resolved = TempoAddress.resolve(address);
|
|
175
|
+
Address.assert(resolved, { strict: false });
|
|
176
|
+
assertValidMasterAddress(resolved);
|
|
177
|
+
return resolved;
|
|
178
|
+
}
|
|
179
|
+
function assertValidMasterAddress(address) {
|
|
180
|
+
const normalized = address.toLowerCase();
|
|
181
|
+
if (normalized === zeroAddress)
|
|
182
|
+
throw new Errors.BaseError('Virtual master address cannot be the zero address.');
|
|
183
|
+
if (VirtualAddress.isVirtual(address))
|
|
184
|
+
throw new Errors.BaseError('Virtual master address cannot itself be a virtual address.');
|
|
185
|
+
if (normalized.startsWith(tip20Prefix))
|
|
186
|
+
throw new Errors.BaseError('Virtual master address cannot be a TIP-20 token address.');
|
|
187
|
+
}
|
|
188
|
+
function toFixedBytes(value, size) {
|
|
189
|
+
return Bytes.fromHex(toFixedHex(value, size));
|
|
190
|
+
}
|
|
191
|
+
function toFixedHex(value, size) {
|
|
192
|
+
if (typeof value === 'number' || typeof value === 'bigint')
|
|
193
|
+
return Hex.fromNumber(value, { size });
|
|
194
|
+
if (typeof value === 'string') {
|
|
195
|
+
Hex.assert(value, { strict: true });
|
|
196
|
+
return Hex.padLeft(value, size);
|
|
197
|
+
}
|
|
198
|
+
return Hex.fromBytes(Bytes.padLeft(value, size));
|
|
199
|
+
}
|
|
200
|
+
//# sourceMappingURL=VirtualMaster.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VirtualMaster.js","sourceRoot":"","sources":["../../tempo/VirtualMaster.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAA;AAC7C,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAA;AACzC,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAA;AAC3C,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAA;AACvC,OAAO,KAAK,GAAG,MAAM,gBAAgB,CAAA;AACrC,OAAO,KAAK,YAAY,MAAM,mBAAmB,CAAA;AACjD,OAAO,KAAK,cAAc,MAAM,qBAAqB,CAAA;AAErD,MAAM,WAAW,GAAG,4BAA4B,CAAA;AAChD,MAAM,WAAW,GAAG,4CAA4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O,CAAC,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAA;AAC/C,CAAC;AAED,SAAS,UAAU,CAAC,KAAW,EAAE,IAAY;IAC3C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,QAAQ;QACxD,OAAO,GAAG,CAAC,UAAU,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,CAAA;IACxC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAA;QACnC,OAAO,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;IACjC,CAAC;IACD,OAAO,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAA;AAClD,CAAC"}
|
package/_esm/tempo/index.js
CHANGED
|
@@ -363,6 +363,58 @@ export * as TransactionRequest from './TransactionRequest.js';
|
|
|
363
363
|
* @category Reference
|
|
364
364
|
*/
|
|
365
365
|
export * as TxEnvelopeTempo from './TxEnvelopeTempo.js';
|
|
366
|
+
/**
|
|
367
|
+
* TIP-1022 virtual address encoding and parsing utilities.
|
|
368
|
+
*
|
|
369
|
+
* [TIP-1022](https://docs.tempo.xyz/protocol/tips/tip-1022)
|
|
370
|
+
*
|
|
371
|
+
* Virtual addresses reserve the following 20-byte layout:
|
|
372
|
+
* `[4-byte masterId][10-byte VIRTUAL_MAGIC][6-byte userTag]`.
|
|
373
|
+
* These helpers only operate on the reserved byte layout and do not query
|
|
374
|
+
* onchain registration state.
|
|
375
|
+
*
|
|
376
|
+
* @example
|
|
377
|
+
* ```ts twoslash
|
|
378
|
+
* import { TempoAddress, VirtualAddress } from 'ox/tempo'
|
|
379
|
+
*
|
|
380
|
+
* const masterId = '0x58e21090' // derived when the master registers
|
|
381
|
+
* const userTag = '0x010203040506' // operator-defined deposit identifier
|
|
382
|
+
*
|
|
383
|
+
* const address = VirtualAddress.from({
|
|
384
|
+
* masterId,
|
|
385
|
+
* userTag,
|
|
386
|
+
* })
|
|
387
|
+
*
|
|
388
|
+
* const tempoAddress = TempoAddress.format(address) // optional display format
|
|
389
|
+
* ```
|
|
390
|
+
*
|
|
391
|
+
* @category Reference
|
|
392
|
+
*/
|
|
393
|
+
export * as VirtualAddress from './VirtualAddress.js';
|
|
394
|
+
/**
|
|
395
|
+
* TIP-1022 master registration utilities.
|
|
396
|
+
*
|
|
397
|
+
* [TIP-1022](https://docs.tempo.xyz/protocol/tips/tip-1022)
|
|
398
|
+
*
|
|
399
|
+
* These utilities expose deterministic hashing and bounded salt mining helpers for
|
|
400
|
+
* `registerVirtualMaster(bytes32 salt)` without introducing any extra hashing dependency.
|
|
401
|
+
*
|
|
402
|
+
* @example
|
|
403
|
+
* ```ts twoslash
|
|
404
|
+
* import { VirtualMaster } from 'ox/tempo'
|
|
405
|
+
*
|
|
406
|
+
* const registration = {
|
|
407
|
+
* address: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
|
|
408
|
+
* salt: '0x00000000000000000000000000000000000000000000000000000000abf52baf',
|
|
409
|
+
* }
|
|
410
|
+
*
|
|
411
|
+
* const registrationHash = VirtualMaster.getRegistrationHash(registration) // keccak256(address || salt)
|
|
412
|
+
* const masterId = VirtualMaster.getMasterId(registration) // bytes [4:8] of the hash
|
|
413
|
+
* ```
|
|
414
|
+
*
|
|
415
|
+
* @category Reference
|
|
416
|
+
*/
|
|
417
|
+
export * as VirtualMaster from './VirtualMaster.js';
|
|
366
418
|
/**
|
|
367
419
|
* Zone ID utilities for converting between zone IDs and zone chain IDs.
|
|
368
420
|
*
|
package/_esm/tempo/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../tempo/index.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;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