tempo.ts 0.10.5 → 0.11.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/CHANGELOG.md +30 -0
- package/README.md +0 -41
- package/dist/viem/Account.d.ts +8 -3
- package/dist/viem/Account.d.ts.map +1 -1
- package/dist/viem/Account.js +9 -2
- package/dist/viem/Account.js.map +1 -1
- package/dist/viem/Actions/amm.d.ts +1 -1
- package/dist/viem/Actions/amm.d.ts.map +1 -1
- package/dist/viem/Actions/amm.js +1 -2
- package/dist/viem/Actions/amm.js.map +1 -1
- package/dist/viem/Actions/dex.d.ts +0 -35
- package/dist/viem/Actions/dex.d.ts.map +1 -1
- package/dist/viem/Actions/dex.js +0 -43
- package/dist/viem/Actions/dex.js.map +1 -1
- package/dist/viem/Actions/fee.d.ts +1 -1
- package/dist/viem/Actions/fee.d.ts.map +1 -1
- package/dist/viem/Actions/fee.js +1 -1
- package/dist/viem/Actions/fee.js.map +1 -1
- package/dist/viem/Actions/nonce.d.ts.map +1 -1
- package/dist/viem/Actions/nonce.js +6 -4
- package/dist/viem/Actions/nonce.js.map +1 -1
- package/dist/viem/Actions/token.d.ts +1 -2
- package/dist/viem/Actions/token.d.ts.map +1 -1
- package/dist/viem/Actions/token.js +1 -2
- package/dist/viem/Actions/token.js.map +1 -1
- package/dist/viem/Chain.d.ts +34 -34
- package/dist/viem/Chain.d.ts.map +1 -1
- package/dist/viem/Chain.js +2 -0
- package/dist/viem/Chain.js.map +1 -1
- package/dist/viem/Formatters.d.ts.map +1 -1
- package/dist/viem/Formatters.js +5 -3
- package/dist/viem/Formatters.js.map +1 -1
- package/dist/viem/Transaction.d.ts +8 -5
- package/dist/viem/Transaction.d.ts.map +1 -1
- package/dist/viem/Transaction.js +13 -3
- package/dist/viem/Transaction.js.map +1 -1
- package/dist/viem/internal/types.d.ts +1 -1
- package/dist/viem/internal/types.d.ts.map +1 -1
- package/dist/wagmi/Actions/dex.d.ts +1 -45
- package/dist/wagmi/Actions/dex.d.ts.map +1 -1
- package/dist/wagmi/Actions/dex.js +0 -55
- package/dist/wagmi/Actions/dex.js.map +1 -1
- package/dist/wagmi/Connector.d.ts +1 -1
- package/dist/wagmi/Connector.d.ts.map +1 -1
- package/dist/wagmi/Connector.js +1 -2
- package/dist/wagmi/Connector.js.map +1 -1
- package/dist/wagmi/Hooks/dex.d.ts +3 -46
- package/dist/wagmi/Hooks/dex.d.ts.map +1 -1
- package/dist/wagmi/Hooks/dex.js +2 -54
- package/dist/wagmi/Hooks/dex.js.map +1 -1
- package/dist/wagmi/index.d.ts +1 -1
- package/dist/wagmi/index.d.ts.map +1 -1
- package/dist/wagmi/index.js +1 -1
- package/dist/wagmi/index.js.map +1 -1
- package/package.json +5 -23
- package/src/viem/Account.test.ts +1 -1
- package/src/viem/Account.ts +11 -2
- package/src/viem/Actions/account.ts +1 -1
- package/src/viem/Actions/amm.ts +1 -2
- package/src/viem/Actions/dex.test.ts +1 -195
- package/src/viem/Actions/dex.ts +0 -53
- package/src/viem/Actions/fee.test.ts +2 -2
- package/src/viem/Actions/fee.ts +1 -1
- package/src/viem/Actions/nonce.test.ts +27 -14
- package/src/viem/Actions/nonce.ts +6 -4
- package/src/viem/Actions/token.test.ts +18 -52
- package/src/viem/Actions/token.ts +1 -2
- package/src/viem/Chain.ts +3 -1
- package/src/viem/Decorator.ts +0 -30
- package/src/viem/Formatters.ts +9 -3
- package/src/viem/Transaction.ts +23 -7
- package/src/viem/e2e.test.ts +19 -0
- package/src/viem/index.ts +12 -1
- package/src/viem/internal/types.ts +1 -1
- package/src/wagmi/Actions/dex.test.ts +0 -26
- package/src/wagmi/Actions/dex.ts +1 -111
- package/src/wagmi/Actions/nonce.test.ts +8 -4
- package/src/wagmi/Actions/token.test.ts +2 -2
- package/src/wagmi/Connector.ts +1 -2
- package/src/wagmi/Hooks/dex.test.ts +0 -26
- package/src/wagmi/Hooks/dex.ts +1 -88
- package/src/wagmi/Hooks/nonce.test.ts +3 -3
- package/src/wagmi/index.ts +4 -1
- package/dist/chains.d.ts +0 -73
- package/dist/chains.d.ts.map +0 -1
- package/dist/chains.js +0 -51
- package/dist/chains.js.map +0 -1
- package/dist/ox/AuthorizationTempo.d.ts +0 -450
- package/dist/ox/AuthorizationTempo.d.ts.map +0 -1
- package/dist/ox/AuthorizationTempo.js +0 -433
- package/dist/ox/AuthorizationTempo.js.map +0 -1
- package/dist/ox/KeyAuthorization.d.ts +0 -356
- package/dist/ox/KeyAuthorization.d.ts.map +0 -1
- package/dist/ox/KeyAuthorization.js +0 -359
- package/dist/ox/KeyAuthorization.js.map +0 -1
- package/dist/ox/Order.d.ts +0 -92
- package/dist/ox/Order.d.ts.map +0 -1
- package/dist/ox/Order.js +0 -88
- package/dist/ox/Order.js.map +0 -1
- package/dist/ox/OrdersFilters.d.ts +0 -72
- package/dist/ox/OrdersFilters.d.ts.map +0 -1
- package/dist/ox/OrdersFilters.js +0 -100
- package/dist/ox/OrdersFilters.js.map +0 -1
- package/dist/ox/Pagination.d.ts +0 -128
- package/dist/ox/Pagination.d.ts.map +0 -1
- package/dist/ox/Pagination.js +0 -78
- package/dist/ox/Pagination.js.map +0 -1
- package/dist/ox/PoolId.d.ts +0 -18
- package/dist/ox/PoolId.d.ts.map +0 -1
- package/dist/ox/PoolId.js +0 -13
- package/dist/ox/PoolId.js.map +0 -1
- package/dist/ox/RpcSchema.d.ts +0 -32
- package/dist/ox/RpcSchema.d.ts.map +0 -1
- package/dist/ox/RpcSchema.js +0 -2
- package/dist/ox/RpcSchema.js.map +0 -1
- package/dist/ox/SignatureEnvelope.d.ts +0 -260
- package/dist/ox/SignatureEnvelope.d.ts.map +0 -1
- package/dist/ox/SignatureEnvelope.js +0 -477
- package/dist/ox/SignatureEnvelope.js.map +0 -1
- package/dist/ox/Tick.d.ts +0 -115
- package/dist/ox/Tick.d.ts.map +0 -1
- package/dist/ox/Tick.js +0 -127
- package/dist/ox/Tick.js.map +0 -1
- package/dist/ox/TokenId.d.ts +0 -25
- package/dist/ox/TokenId.d.ts.map +0 -1
- package/dist/ox/TokenId.js +0 -41
- package/dist/ox/TokenId.js.map +0 -1
- package/dist/ox/TokenRole.d.ts +0 -11
- package/dist/ox/TokenRole.d.ts.map +0 -1
- package/dist/ox/TokenRole.js +0 -22
- package/dist/ox/TokenRole.js.map +0 -1
- package/dist/ox/Transaction.d.ts +0 -201
- package/dist/ox/Transaction.d.ts.map +0 -1
- package/dist/ox/Transaction.js +0 -167
- package/dist/ox/Transaction.js.map +0 -1
- package/dist/ox/TransactionEnvelopeTempo.d.ts +0 -470
- package/dist/ox/TransactionEnvelopeTempo.d.ts.map +0 -1
- package/dist/ox/TransactionEnvelopeTempo.js +0 -547
- package/dist/ox/TransactionEnvelopeTempo.js.map +0 -1
- package/dist/ox/TransactionReceipt.d.ts +0 -155
- package/dist/ox/TransactionReceipt.d.ts.map +0 -1
- package/dist/ox/TransactionReceipt.js +0 -136
- package/dist/ox/TransactionReceipt.js.map +0 -1
- package/dist/ox/TransactionRequest.d.ts +0 -76
- package/dist/ox/TransactionRequest.d.ts.map +0 -1
- package/dist/ox/TransactionRequest.js +0 -93
- package/dist/ox/TransactionRequest.js.map +0 -1
- package/dist/ox/index.d.ts +0 -14
- package/dist/ox/index.d.ts.map +0 -1
- package/dist/ox/index.js +0 -14
- package/dist/ox/index.js.map +0 -1
- package/dist/prool/Instance.d.ts +0 -101
- package/dist/prool/Instance.d.ts.map +0 -1
- package/dist/prool/Instance.js +0 -136
- package/dist/prool/Instance.js.map +0 -1
- package/dist/prool/chain.json +0 -238
- package/dist/prool/index.d.ts +0 -2
- package/dist/prool/index.d.ts.map +0 -1
- package/dist/prool/index.js +0 -2
- package/dist/prool/index.js.map +0 -1
- package/dist/viem/Actions/account.d.ts +0 -40
- package/dist/viem/Actions/account.d.ts.map +0 -1
- package/dist/viem/Actions/account.js +0 -86
- package/dist/viem/Actions/account.js.map +0 -1
- package/dist/viem/Actions/index.d.ts +0 -10
- package/dist/viem/Actions/index.d.ts.map +0 -1
- package/dist/viem/Actions/index.js +0 -10
- package/dist/viem/Actions/index.js.map +0 -1
- package/dist/viem/Decorator.d.ts +0 -2810
- package/dist/viem/Decorator.d.ts.map +0 -1
- package/dist/viem/Decorator.js +0 -138
- package/dist/viem/Decorator.js.map +0 -1
- package/dist/viem/P256.d.ts +0 -2
- package/dist/viem/P256.d.ts.map +0 -1
- package/dist/viem/P256.js +0 -2
- package/dist/viem/P256.js.map +0 -1
- package/dist/viem/Secp256k1.d.ts +0 -2
- package/dist/viem/Secp256k1.d.ts.map +0 -1
- package/dist/viem/Secp256k1.js +0 -2
- package/dist/viem/Secp256k1.js.map +0 -1
- package/dist/viem/TokenIds.d.ts +0 -2
- package/dist/viem/TokenIds.d.ts.map +0 -1
- package/dist/viem/TokenIds.js +0 -2
- package/dist/viem/TokenIds.js.map +0 -1
- package/dist/viem/index.d.ts +0 -17
- package/dist/viem/index.d.ts.map +0 -1
- package/dist/viem/index.js +0 -17
- package/dist/viem/index.js.map +0 -1
- package/src/ox/AuthorizationTempo.test.ts +0 -1256
- package/src/ox/AuthorizationTempo.ts +0 -648
- package/src/ox/KeyAuthorization.test.ts +0 -1332
- package/src/ox/KeyAuthorization.ts +0 -540
- package/src/ox/Order.test.ts +0 -78
- package/src/ox/Order.ts +0 -125
- package/src/ox/OrdersFilters.test.ts +0 -182
- package/src/ox/OrdersFilters.ts +0 -125
- package/src/ox/Pagination.test.ts +0 -162
- package/src/ox/Pagination.ts +0 -164
- package/src/ox/PoolId.test.ts +0 -33
- package/src/ox/PoolId.ts +0 -27
- package/src/ox/RpcSchema.ts +0 -35
- package/src/ox/SignatureEnvelope.test.ts +0 -1876
- package/src/ox/SignatureEnvelope.ts +0 -791
- package/src/ox/Tick.test.ts +0 -281
- package/src/ox/Tick.ts +0 -181
- package/src/ox/TokenId.test.ts +0 -40
- package/src/ox/TokenId.ts +0 -50
- package/src/ox/TokenRole.test.ts +0 -16
- package/src/ox/TokenRole.ts +0 -27
- package/src/ox/Transaction.test.ts +0 -523
- package/src/ox/Transaction.ts +0 -332
- package/src/ox/TransactionEnvelopeTempo.test.ts +0 -1352
- package/src/ox/TransactionEnvelopeTempo.ts +0 -905
- package/src/ox/TransactionReceipt.ts +0 -190
- package/src/ox/TransactionRequest.ts +0 -147
- package/src/ox/e2e.test.ts +0 -1393
- package/src/ox/index.ts +0 -13
- package/src/prool/Instance.test.ts +0 -43
- package/src/prool/Instance.ts +0 -247
- package/src/prool/chain.json +0 -238
- package/src/prool/index.ts +0 -1
- package/src/viem/Actions/__snapshots__/dex.test.ts.snap +0 -850
- package/src/wagmi/Actions/__snapshots__/dex.test.ts.snap +0 -310
- package/src/wagmi/Hooks/__snapshots__/dex.test.ts.snap +0 -457
package/dist/ox/Tick.js
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import * as Errors from 'ox/Errors';
|
|
2
|
-
/**
|
|
3
|
-
* Minimum allowed tick value.
|
|
4
|
-
*/
|
|
5
|
-
export const minTick = -2000;
|
|
6
|
-
/**
|
|
7
|
-
* Maximum allowed tick value.
|
|
8
|
-
*/
|
|
9
|
-
export const maxTick = 2000;
|
|
10
|
-
/**
|
|
11
|
-
* Price scaling factor (5 decimal places for 0.1 bps precision).
|
|
12
|
-
*
|
|
13
|
-
* @description
|
|
14
|
-
* The DEX uses a tick-based pricing system where:
|
|
15
|
-
* - Tick size: 0.1 bps (basis points)
|
|
16
|
-
* - Price range: ±2% from 1.0 (ticks from -2000 to +2000)
|
|
17
|
-
*/
|
|
18
|
-
export const priceScale = 100_000;
|
|
19
|
-
/**
|
|
20
|
-
* Converts a tick to a price string.
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* ```ts
|
|
24
|
-
* import { Tick } from 'tempo.ts/viem'
|
|
25
|
-
*
|
|
26
|
-
* // Tick 0 = price of 1.0
|
|
27
|
-
* const price1 = Tick.toPrice(0) // "1"
|
|
28
|
-
*
|
|
29
|
-
* // Tick 100 = price of 1.001 (0.1% higher)
|
|
30
|
-
* const price2 = Tick.toPrice(100) // "1.001"
|
|
31
|
-
*
|
|
32
|
-
* // Tick -100 = price of 0.999 (0.1% lower)
|
|
33
|
-
* const price3 = Tick.toPrice(-100) // "0.999"
|
|
34
|
-
* ```
|
|
35
|
-
*
|
|
36
|
-
* @param tick - The tick value (range: -2000 to +2000).
|
|
37
|
-
* @returns The price as a string with exact decimal representation.
|
|
38
|
-
* @throws {TickOutOfBoundsError} If tick is out of bounds.
|
|
39
|
-
*/
|
|
40
|
-
export function toPrice(tick) {
|
|
41
|
-
if (tick < minTick || tick > maxTick) {
|
|
42
|
-
throw new TickOutOfBoundsError({ tick });
|
|
43
|
-
}
|
|
44
|
-
// Use integer arithmetic to avoid floating point errors
|
|
45
|
-
const price = priceScale + tick;
|
|
46
|
-
const whole = Math.floor(price / priceScale);
|
|
47
|
-
let decimal = (price % priceScale).toString().padStart(5, '0');
|
|
48
|
-
decimal = decimal.replace(/0+$/, '');
|
|
49
|
-
if (decimal.length === 0)
|
|
50
|
-
return whole.toString();
|
|
51
|
-
return `${whole}.${decimal}`;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Converts a price string to a tick.
|
|
55
|
-
*
|
|
56
|
-
* @example
|
|
57
|
-
* ```ts
|
|
58
|
-
* import { Tick } from 'tempo.ts/viem'
|
|
59
|
-
*
|
|
60
|
-
* // Price of 1.0 = tick 0
|
|
61
|
-
* const tick1 = Tick.fromPrice('1.0') // 0
|
|
62
|
-
* const tick2 = Tick.fromPrice('1.00000') // 0
|
|
63
|
-
*
|
|
64
|
-
* // Price of 1.001 = tick 100
|
|
65
|
-
* const tick3 = Tick.fromPrice('1.001') // 100
|
|
66
|
-
*
|
|
67
|
-
* // Price of 0.999 = tick -100
|
|
68
|
-
* const tick4 = Tick.fromPrice('0.999') // -100
|
|
69
|
-
* ```
|
|
70
|
-
*
|
|
71
|
-
* @param price - The price as a string (e.g., "1.001", "0.999").
|
|
72
|
-
* @returns The tick value.
|
|
73
|
-
* @throws {InvalidPriceTypeError} If the price is not a string.
|
|
74
|
-
* @throws {InvalidPriceFormatError} If the price format is invalid.
|
|
75
|
-
* @throws {PriceOutOfBoundsError} If the resulting tick is out of bounds.
|
|
76
|
-
*/
|
|
77
|
-
export function fromPrice(price) {
|
|
78
|
-
const priceStr = price.trim();
|
|
79
|
-
if (!/^-?\d+(\.\d+)?$/.test(priceStr))
|
|
80
|
-
throw new InvalidPriceFormatError({ price });
|
|
81
|
-
// Parse price using string manipulation to avoid float precision issues
|
|
82
|
-
const [w, d = '0'] = priceStr.split('.');
|
|
83
|
-
const whole = BigInt(w);
|
|
84
|
-
// Pad or truncate decimal to exactly 5 digits
|
|
85
|
-
const decimal = BigInt(d.padEnd(5, '0').slice(0, 5));
|
|
86
|
-
// Calculate price
|
|
87
|
-
const priceInt = whole * BigInt(priceScale) + decimal;
|
|
88
|
-
// Calculate tick
|
|
89
|
-
const tick = Number(priceInt - BigInt(priceScale));
|
|
90
|
-
if (tick < minTick || tick > maxTick)
|
|
91
|
-
throw new PriceOutOfBoundsError({ price, tick });
|
|
92
|
-
return tick;
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Error thrown when a tick value is out of the allowed bounds.
|
|
96
|
-
*/
|
|
97
|
-
export class TickOutOfBoundsError extends Errors.BaseError {
|
|
98
|
-
name = 'Tick.TickOutOfBoundsError';
|
|
99
|
-
constructor(options) {
|
|
100
|
-
super(`Tick ${options.tick} is out of bounds.`, {
|
|
101
|
-
metaMessages: [`Tick must be between ${minTick} and ${maxTick}.`],
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* Error thrown when a price string has an invalid format.
|
|
107
|
-
*/
|
|
108
|
-
export class InvalidPriceFormatError extends Errors.BaseError {
|
|
109
|
-
name = 'Tick.InvalidPriceFormatError';
|
|
110
|
-
constructor(options) {
|
|
111
|
-
super(`Invalid price format: "${options.price}".`, {
|
|
112
|
-
metaMessages: ['Price must be a decimal number string (e.g., "1.001").'],
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Error thrown when a price string results in an out-of-bounds tick.
|
|
118
|
-
*/
|
|
119
|
-
export class PriceOutOfBoundsError extends Errors.BaseError {
|
|
120
|
-
name = 'Tick.PriceOutOfBoundsError';
|
|
121
|
-
constructor(options) {
|
|
122
|
-
super(`Price "${options.price}" results in tick ${options.tick} which is out of bounds.`, {
|
|
123
|
-
metaMessages: [`Tick must be between ${minTick} and ${maxTick}.`],
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
//# sourceMappingURL=Tick.js.map
|
package/dist/ox/Tick.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Tick.js","sourceRoot":"","sources":["../../src/ox/Tick.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,WAAW,CAAA;AAEnC;;GAEG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,IAAI,CAAA;AAE5B;;GAEG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,CAAA;AAE3B;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,OAAO,CAAA;AAOjC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,OAAO,CAAC,IAAkB;IACxC,IAAI,IAAI,GAAG,OAAO,IAAI,IAAI,GAAG,OAAO,EAAE,CAAC;QACrC,MAAM,IAAI,oBAAoB,CAAC,EAAE,IAAI,EAAE,CAAC,CAAA;IAC1C,CAAC;IACD,wDAAwD;IACxD,MAAM,KAAK,GAAG,UAAU,GAAG,IAAI,CAAA;IAC/B,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,UAAU,CAAC,CAAA;IAE5C,IAAI,OAAO,GAAG,CAAC,KAAK,GAAG,UAAU,CAAC,CAAC,QAAQ,EAAE,CAAC,QA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oBAAqB,SAAQ,MAAM,CAAC,SAAS;IACtC,IAAI,GAAG,2BAA2B,CAAA;IAEpD,YAAY,OAAqC;QAC/C,KAAK,CAAC,QAAQ,OAAO,CAAC,IAAI,oBAAoB,EAAE;YAC9C,YAAY,EAAE,CAAC,wBAAwB,OAAO,QAAQ,OAAO,GAAG,CAAC;SAClE,CAAC,CAAA;IACJ,CAAC;CACF;AAQD;;GAEG;AACH,MAAM,OAAO,uBAAwB,SAAQ,MAAM,CAAC,SAAS;IACzC,IAAI,GAAG,8BAA8B,CAAA;IAEvD,YAAY,OAAwC;QAClD,KAAK,CAAC,0BAA0B,OAAO,CAAC,KAAK,IAAI,EAAE;YACjD,YAAY,EAAE,CAAC,wDAAwD,CAAC;SACzE,CAAC,CAAA;IACJ,CAAC;CACF;AAQD;;GAEG;AACH,MAAM,OAAO,qBAAsB,SAAQ,MAAM,CAAC,SAAS;IACvC,IAAI,GAAG,4BAA4B,CAAA;IAErD,YAAY,OAAsC;QAChD,KAAK,CACH,UAAU,OAAO,CAAC,KAAK,qBAAqB,OAAO,CAAC,IAAI,0BAA0B,EAClF;YACE,YAAY,EAAE,CAAC,wBAAwB,OAAO,QAAQ,OAAO,GAAG,CAAC;SAClE,CACF,CAAA;IACH,CAAC;CACF"}
|
package/dist/ox/TokenId.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import * as Address from 'ox/Address';
|
|
2
|
-
export type TokenId = bigint;
|
|
3
|
-
export type TokenIdOrAddress = TokenId | Address.Address;
|
|
4
|
-
/**
|
|
5
|
-
* Converts a token ID or address to a token ID.
|
|
6
|
-
*
|
|
7
|
-
* @param tokenIdOrAddress - The token ID or address.
|
|
8
|
-
* @returns The token ID.
|
|
9
|
-
*/
|
|
10
|
-
export declare function from(tokenIdOrAddress: TokenIdOrAddress | number): TokenId;
|
|
11
|
-
/**
|
|
12
|
-
* Converts a TIP20 token address to a token ID.
|
|
13
|
-
*
|
|
14
|
-
* @param address - The token address.
|
|
15
|
-
* @returns The token ID.
|
|
16
|
-
*/
|
|
17
|
-
export declare function fromAddress(address: Address.Address): TokenId;
|
|
18
|
-
/**
|
|
19
|
-
* Converts a TIP20 token ID to an address.
|
|
20
|
-
*
|
|
21
|
-
* @param tokenId - The token ID.
|
|
22
|
-
* @returns The address.
|
|
23
|
-
*/
|
|
24
|
-
export declare function toAddress(tokenId: TokenIdOrAddress): Address.Address;
|
|
25
|
-
//# sourceMappingURL=TokenId.d.ts.map
|
package/dist/ox/TokenId.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TokenId.d.ts","sourceRoot":"","sources":["../../src/ox/TokenId.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,YAAY,CAAA;AAKrC,MAAM,MAAM,OAAO,GAAG,MAAM,CAAA;AAC5B,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,OAAO,CAAC,OAAO,CAAA;AAExD;;;;;GAKG;AACH,wBAAgB,IAAI,CAAC,gBAAgB,EAAE,gBAAgB,GAAG,MAAM,GAAG,OAAO,CAOzE;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,GAAG,OAAO,CAI7D;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAQpE"}
|
package/dist/ox/TokenId.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import * as Address from 'ox/Address';
|
|
2
|
-
import * as Hex from 'ox/Hex';
|
|
3
|
-
const tip20Prefix = '0x20c0';
|
|
4
|
-
/**
|
|
5
|
-
* Converts a token ID or address to a token ID.
|
|
6
|
-
*
|
|
7
|
-
* @param tokenIdOrAddress - The token ID or address.
|
|
8
|
-
* @returns The token ID.
|
|
9
|
-
*/
|
|
10
|
-
export function from(tokenIdOrAddress) {
|
|
11
|
-
if (typeof tokenIdOrAddress === 'bigint' ||
|
|
12
|
-
typeof tokenIdOrAddress === 'number')
|
|
13
|
-
return BigInt(tokenIdOrAddress);
|
|
14
|
-
return fromAddress(tokenIdOrAddress);
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Converts a TIP20 token address to a token ID.
|
|
18
|
-
*
|
|
19
|
-
* @param address - The token address.
|
|
20
|
-
* @returns The token ID.
|
|
21
|
-
*/
|
|
22
|
-
export function fromAddress(address) {
|
|
23
|
-
if (!address.toLowerCase().startsWith(tip20Prefix))
|
|
24
|
-
throw new Error('invalid tip20 address.');
|
|
25
|
-
return Hex.toBigInt(Hex.slice(address, tip20Prefix.length));
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Converts a TIP20 token ID to an address.
|
|
29
|
-
*
|
|
30
|
-
* @param tokenId - The token ID.
|
|
31
|
-
* @returns The address.
|
|
32
|
-
*/
|
|
33
|
-
export function toAddress(tokenId) {
|
|
34
|
-
if (typeof tokenId === 'string') {
|
|
35
|
-
Address.assert(tokenId);
|
|
36
|
-
return tokenId;
|
|
37
|
-
}
|
|
38
|
-
const tokenIdHex = Hex.fromNumber(tokenId, { size: 18 });
|
|
39
|
-
return Hex.concat(tip20Prefix, tokenIdHex);
|
|
40
|
-
}
|
|
41
|
-
//# sourceMappingURL=TokenId.js.map
|
package/dist/ox/TokenId.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TokenId.js","sourceRoot":"","sources":["../../src/ox/TokenId.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,YAAY,CAAA;AACrC,OAAO,KAAK,GAAG,MAAM,QAAQ,CAAA;AAE7B,MAAM,WAAW,GAAG,QAAQ,CAAA;AAK5B;;;;;GAKG;AACH,MAAM,UAAU,IAAI,CAAC,gBAA2C;IAC9D,IACE,OAAO,gBAAgB,KAAK,QAAQ;QACpC,OAAO,gBAAgB,KAAK,QAAQ;QAEpC,OAAO,MAAM,CAAC,gBAAgB,CAAC,CAAA;IACjC,OAAO,WAAW,CAAC,gBAAgB,CAAC,CAAA;AACtC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAC,OAAwB;IAClD,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC;QAChD,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAA;IAC3C,OAAO,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC,CAAA;AAC7D,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAC,OAAyB;IACjD,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QAChC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;QACvB,OAAO,OAAO,CAAA;IAChB,CAAC;IAED,MAAM,UAAU,GAAG,GAAG,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAA;IACxD,OAAO,GAAG,CAAC,MAAM,CAAC,WAAW,EAAE,UAAU,CAAC,CAAA;AAC5C,CAAC"}
|
package/dist/ox/TokenRole.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export declare const roles: readonly ["defaultAdmin", "pause", "unpause", "issuer", "burnBlocked"];
|
|
2
|
-
export type TokenRole = (typeof roles)[number];
|
|
3
|
-
export declare const toPreHashed: {
|
|
4
|
-
readonly defaultAdmin: "DEFAULT_ADMIN_ROLE";
|
|
5
|
-
readonly pause: "PAUSE_ROLE";
|
|
6
|
-
readonly unpause: "UNPAUSE_ROLE";
|
|
7
|
-
readonly issuer: "ISSUER_ROLE";
|
|
8
|
-
readonly burnBlocked: "BURN_BLOCKED_ROLE";
|
|
9
|
-
};
|
|
10
|
-
export declare function serialize(role: TokenRole): `0x${string}`;
|
|
11
|
-
//# sourceMappingURL=TokenRole.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TokenRole.d.ts","sourceRoot":"","sources":["../../src/ox/TokenRole.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,KAAK,wEAMR,CAAA;AACV,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,KAAK,CAAC,CAAC,MAAM,CAAC,CAAA;AAE9C,eAAO,MAAM,WAAW;;;;;;CAMsB,CAAA;AAE9C,wBAAgB,SAAS,CAAC,IAAI,EAAE,SAAS,iBAMxC"}
|
package/dist/ox/TokenRole.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import * as Hash from 'ox/Hash';
|
|
2
|
-
import * as Hex from 'ox/Hex';
|
|
3
|
-
export const roles = [
|
|
4
|
-
'defaultAdmin',
|
|
5
|
-
'pause',
|
|
6
|
-
'unpause',
|
|
7
|
-
'issuer',
|
|
8
|
-
'burnBlocked',
|
|
9
|
-
];
|
|
10
|
-
export const toPreHashed = {
|
|
11
|
-
defaultAdmin: 'DEFAULT_ADMIN_ROLE',
|
|
12
|
-
pause: 'PAUSE_ROLE',
|
|
13
|
-
unpause: 'UNPAUSE_ROLE',
|
|
14
|
-
issuer: 'ISSUER_ROLE',
|
|
15
|
-
burnBlocked: 'BURN_BLOCKED_ROLE',
|
|
16
|
-
};
|
|
17
|
-
export function serialize(role) {
|
|
18
|
-
if (role === 'defaultAdmin')
|
|
19
|
-
return '0x0000000000000000000000000000000000000000000000000000000000000000';
|
|
20
|
-
return Hash.keccak256(Hex.fromString(toPreHashed[role] ?? role));
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=TokenRole.js.map
|
package/dist/ox/TokenRole.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TokenRole.js","sourceRoot":"","sources":["../../src/ox/TokenRole.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,SAAS,CAAA;AAC/B,OAAO,KAAK,GAAG,MAAM,QAAQ,CAAA;AAE7B,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,cAAc;IACd,OAAO;IACP,SAAS;IACT,QAAQ;IACR,aAAa;CACL,CAAA;AAGV,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,YAAY,EAAE,oBAAoB;IAClC,KAAK,EAAE,YAAY;IACnB,OAAO,EAAE,cAAc;IACvB,MAAM,EAAE,aAAa;IACrB,WAAW,EAAE,mBAAmB;CACY,CAAA;AAE9C,MAAM,UAAU,SAAS,CAAC,IAAe;IACvC,IAAI,IAAI,KAAK,cAAc;QACzB,OAAO,oEAAoE,CAAA;IAC7E,OAAO,IAAI,CAAC,SAAS,CACnB,GAAG,CAAC,UAAU,CAAC,WAAW,CAAC,IAAgC,CAAC,IAAI,IAAI,CAAC,CACtE,CAAA;AACH,CAAC"}
|
package/dist/ox/Transaction.d.ts
DELETED
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
import type * as AccessList from 'ox/AccessList';
|
|
2
|
-
import type * as Address from 'ox/Address';
|
|
3
|
-
import type * as Errors from 'ox/Errors';
|
|
4
|
-
import * as Hex from 'ox/Hex';
|
|
5
|
-
import * as ox_Transaction from 'ox/Transaction';
|
|
6
|
-
import type { Compute, OneOf, UnionCompute } from '../internal/types.js';
|
|
7
|
-
import * as AuthorizationTempo from './AuthorizationTempo.js';
|
|
8
|
-
import * as KeyAuthorization from './KeyAuthorization.js';
|
|
9
|
-
import * as SignatureEnvelope from './SignatureEnvelope.js';
|
|
10
|
-
import type { Call } from './TransactionEnvelopeTempo.js';
|
|
11
|
-
/**
|
|
12
|
-
* A Transaction as defined in the [Execution API specification](https://github.com/ethereum/execution-apis/blob/main/src/schemas/transaction.yaml).
|
|
13
|
-
*/
|
|
14
|
-
export type Transaction<pending extends boolean = false, bigintType = bigint, numberType = number> = UnionCompute<OneOf<Tempo<pending, bigintType, numberType> | ox_Transaction.Transaction<pending, bigintType, numberType>>>;
|
|
15
|
-
/**
|
|
16
|
-
* An RPC Transaction as defined in the [Execution API specification](https://github.com/ethereum/execution-apis/blob/main/src/schemas/transaction.yaml).
|
|
17
|
-
*/
|
|
18
|
-
export type Rpc<pending extends boolean = false> = UnionCompute<OneOf<TempoRpc<pending> | ox_Transaction.Rpc<pending>>>;
|
|
19
|
-
/**
|
|
20
|
-
* Native account abstraction transaction.
|
|
21
|
-
*/
|
|
22
|
-
export type Tempo<pending extends boolean = false, bigintType = bigint, numberType = number, type extends string = 'tempo'> = Compute<Omit<ox_Transaction.Base<type, pending, bigintType, numberType>, 'input' | 'to' | 'value' | 'v' | 'r' | 's' | 'yParity'> & {
|
|
23
|
-
/** EIP-2930 Access List. */
|
|
24
|
-
accessList: AccessList.AccessList;
|
|
25
|
-
/** EIP-7702 Authorization list for the transaction. */
|
|
26
|
-
authorizationList?: AuthorizationTempo.ListSigned<bigintType, numberType> | undefined;
|
|
27
|
-
/** Array of calls to execute. */
|
|
28
|
-
calls: readonly Call<bigintType>[];
|
|
29
|
-
/** Fee payer signature. */
|
|
30
|
-
feePayerSignature?: {
|
|
31
|
-
/** ECDSA signature r. */
|
|
32
|
-
r: bigintType;
|
|
33
|
-
/** ECDSA signature s. */
|
|
34
|
-
s: bigintType;
|
|
35
|
-
/** ECDSA signature yParity. */
|
|
36
|
-
yParity: numberType;
|
|
37
|
-
/** @deprecated ECDSA signature v (for backwards compatibility). */
|
|
38
|
-
v?: numberType | undefined;
|
|
39
|
-
} | undefined;
|
|
40
|
-
/** Fee token preference. */
|
|
41
|
-
feeToken: Address.Address;
|
|
42
|
-
/** Effective gas price paid by the sender in wei. */
|
|
43
|
-
gasPrice?: bigintType | undefined;
|
|
44
|
-
/** Key authorization for provisioning a new access key. */
|
|
45
|
-
keyAuthorization?: KeyAuthorization.KeyAuthorization<true, bigintType, numberType> | undefined;
|
|
46
|
-
/** Total fee per gas in wei (gasPrice/baseFeePerGas + maxPriorityFeePerGas). */
|
|
47
|
-
maxFeePerGas: bigintType;
|
|
48
|
-
/** Max priority fee per gas (in wei). */
|
|
49
|
-
maxPriorityFeePerGas: bigintType;
|
|
50
|
-
/** Nonce key for 2D nonce system (192 bits). */
|
|
51
|
-
nonceKey?: bigintType | undefined;
|
|
52
|
-
/** Sender signature. */
|
|
53
|
-
signature: SignatureEnvelope.SignatureEnvelope<bigintType, numberType>;
|
|
54
|
-
/** Transaction can only be included in a block before this timestamp. */
|
|
55
|
-
validBefore?: numberType | undefined;
|
|
56
|
-
/** Transaction can only be included in a block after this timestamp. */
|
|
57
|
-
validAfter?: numberType | undefined;
|
|
58
|
-
}>;
|
|
59
|
-
/**
|
|
60
|
-
* Native account abstraction transaction in RPC format.
|
|
61
|
-
*/
|
|
62
|
-
export type TempoRpc<pending extends boolean = false> = Compute<Omit<Tempo<pending, Hex.Hex, Hex.Hex, ToRpcType['tempo']>, 'authorizationList' | 'calls' | 'keyAuthorization' | 'signature'> & {
|
|
63
|
-
aaAuthorizationList?: AuthorizationTempo.ListRpc | undefined;
|
|
64
|
-
calls: readonly {
|
|
65
|
-
input?: Hex.Hex | undefined;
|
|
66
|
-
to?: Hex.Hex | undefined;
|
|
67
|
-
value?: Hex.Hex | undefined;
|
|
68
|
-
}[] | undefined;
|
|
69
|
-
keyAuthorization?: KeyAuthorization.Rpc | undefined;
|
|
70
|
-
signature: SignatureEnvelope.SignatureEnvelopeRpc;
|
|
71
|
-
}>;
|
|
72
|
-
/** Type to RPC Type mapping. */
|
|
73
|
-
export declare const toRpcType: {
|
|
74
|
-
readonly tempo: "0x76";
|
|
75
|
-
readonly legacy: "0x0";
|
|
76
|
-
readonly eip2930: "0x1";
|
|
77
|
-
readonly eip1559: "0x2";
|
|
78
|
-
readonly eip4844: "0x3";
|
|
79
|
-
readonly eip7702: "0x4";
|
|
80
|
-
};
|
|
81
|
-
/** Type to RPC Type mapping. */
|
|
82
|
-
export type ToRpcType = typeof toRpcType & {
|
|
83
|
-
[type: string]: `0x${string}`;
|
|
84
|
-
};
|
|
85
|
-
/** RPC Type to Type mapping. */
|
|
86
|
-
export declare const fromRpcType: {
|
|
87
|
-
readonly '0x76': "tempo";
|
|
88
|
-
readonly '0x0': "legacy";
|
|
89
|
-
readonly '0x1': "eip2930";
|
|
90
|
-
readonly '0x2': "eip1559";
|
|
91
|
-
readonly '0x3': "eip4844";
|
|
92
|
-
readonly '0x4': "eip7702";
|
|
93
|
-
};
|
|
94
|
-
/** RPC Type to Type mapping. */
|
|
95
|
-
export type FromRpcType = typeof fromRpcType & {
|
|
96
|
-
[type: `0x${string}`]: string;
|
|
97
|
-
};
|
|
98
|
-
/**
|
|
99
|
-
* Converts an {@link ox#Transaction.Rpc} to an {@link ox#Transaction.Transaction}.
|
|
100
|
-
*
|
|
101
|
-
* @example
|
|
102
|
-
* ```ts twoslash
|
|
103
|
-
* import { Transaction } from 'ox/tempo'
|
|
104
|
-
*
|
|
105
|
-
* const transaction = Transaction.fromRpc({
|
|
106
|
-
* hash: '0x353fdfc38a2f26115daadee9f5b8392ce62b84f410957967e2ed56b35338cdd0',
|
|
107
|
-
* nonce: '0x357',
|
|
108
|
-
* blockHash:
|
|
109
|
-
* '0xc350d807505fb835650f0013632c5515592987ba169bbc6626d9fc54d91f0f0b',
|
|
110
|
-
* blockNumber: '0x12f296f',
|
|
111
|
-
* calls: [
|
|
112
|
-
* {
|
|
113
|
-
* input: '0xdeadbeef',
|
|
114
|
-
* to: '0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad',
|
|
115
|
-
* value: '0x9b6e64a8ec60000',
|
|
116
|
-
* },
|
|
117
|
-
* ],
|
|
118
|
-
* feeToken: '0x20c0000000000000000000000000000000000000',
|
|
119
|
-
* transactionIndex: '0x2',
|
|
120
|
-
* from: '0x814e5e0e31016b9a7f138c76b7e7b2bb5c1ab6a6',
|
|
121
|
-
* value: '0x9b6e64a8ec60000',
|
|
122
|
-
* gas: '0x43f5d',
|
|
123
|
-
* maxFeePerGas: '0x2ca6ae494',
|
|
124
|
-
* maxPriorityFeePerGas: '0x41cc3c0',
|
|
125
|
-
* input:
|
|
126
|
-
* '0x3593564c000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000006643504700000000000000000000000000000000000000000000000000000000000000040b080604000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002800000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000009b6e64a8ec600000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000009b6e64a8ec60000000000000000000000000000000000000000000000000000019124bb5ae978c000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000c56c7a0eaa804f854b536a5f3d5f49d2ec4b12b80000000000000000000000000000000000000000000000000000000000000060000000000000000000000000c56c7a0eaa804f854b536a5f3d5f49d2ec4b12b8000000000000000000000000000000fee13a103a10d593b9ae06b3e05f2e7e1c00000000000000000000000000000000000000000000000000000000000000190000000000000000000000000000000000000000000000000000000000000060000000000000000000000000c56c7a0eaa804f854b536a5f3d5f49d2ec4b12b800000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000190240001b9872b',
|
|
127
|
-
* signature: {
|
|
128
|
-
* r: '0x635dc2033e60185bb36709c29c75d64ea51dfbd91c32ef4be198e4ceb169fb4d',
|
|
129
|
-
* s: '0x50c2667ac4c771072746acfdcf1f1483336dcca8bd2df47cd83175dbe60f0540',
|
|
130
|
-
* type: 'secp256k1',
|
|
131
|
-
* yParity: '0x0',
|
|
132
|
-
* },
|
|
133
|
-
* chainId: '0x1',
|
|
134
|
-
* accessList: [],
|
|
135
|
-
* type: '0x76',
|
|
136
|
-
* })
|
|
137
|
-
* ```
|
|
138
|
-
*
|
|
139
|
-
* @param transaction - The RPC transaction to convert.
|
|
140
|
-
* @returns An instantiated {@link ox#Transaction.Transaction}.
|
|
141
|
-
*/
|
|
142
|
-
export declare function fromRpc<const transaction extends Rpc | null, pending extends boolean = false>(transaction: transaction | Rpc<pending> | null, _options?: fromRpc.Options<pending>): transaction extends Rpc<pending> ? Transaction<pending> : null;
|
|
143
|
-
export declare namespace fromRpc {
|
|
144
|
-
type Options<pending extends boolean = false> = {
|
|
145
|
-
pending?: pending | boolean | undefined;
|
|
146
|
-
};
|
|
147
|
-
type ErrorType = ox_Transaction.fromRpc.ErrorType | Errors.GlobalErrorType;
|
|
148
|
-
}
|
|
149
|
-
/**
|
|
150
|
-
* Converts an {@link ox#Transaction.Transaction} to an {@link ox#Transaction.Rpc}.
|
|
151
|
-
*
|
|
152
|
-
* @example
|
|
153
|
-
* ```ts twoslash
|
|
154
|
-
* import { Transaction } from 'ox/tempo'
|
|
155
|
-
*
|
|
156
|
-
* const transaction = Transaction.toRpc({
|
|
157
|
-
* accessList: [],
|
|
158
|
-
* blockHash:
|
|
159
|
-
* '0xc350d807505fb835650f0013632c5515592987ba169bbc6626d9fc54d91f0f0b',
|
|
160
|
-
* blockNumber: 19868015n,
|
|
161
|
-
* calls: [
|
|
162
|
-
* {
|
|
163
|
-
* data: '0xdeadbeef',
|
|
164
|
-
* to: '0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad',
|
|
165
|
-
* value: 700000000000000000n,
|
|
166
|
-
* },
|
|
167
|
-
* ],
|
|
168
|
-
* chainId: 1,
|
|
169
|
-
* feeToken: '0x20c0000000000000000000000000000000000000',
|
|
170
|
-
* from: '0x814e5e0e31016b9a7f138c76b7e7b2bb5c1ab6a6',
|
|
171
|
-
* gas: 278365n,
|
|
172
|
-
* hash: '0x353fdfc38a2f26115daadee9f5b8392ce62b84f410957967e2ed56b35338cdd0',
|
|
173
|
-
* input:
|
|
174
|
-
* '0x3593564c000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000006643504700000000000000000000000000000000000000000000000000000000000000040b080604000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002800000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000009b6e64a8ec600000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000009b6e64a8ec60000000000000000000000000000000000000000000000000000019124bb5ae978c000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000c56c7a0eaa804f854b536a5f3d5f49d2ec4b12b80000000000000000000000000000000000000000000000000000000000000060000000000000000000000000c56c7a0eaa804f854b536a5f3d5f49d2ec4b12b8000000000000000000000000000000fee13a103a10d593b9ae06b3e05f2e7e1c00000000000000000000000000000000000000000000000000000000000000190000000000000000000000000000000000000000000000000000000000000060000000000000000000000000c56c7a0eaa804f854b536a5f3d5f49d2ec4b12b800000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000190240001b9872b',
|
|
175
|
-
* maxFeePerGas: 11985937556n,
|
|
176
|
-
* maxPriorityFeePerGas: 68993984n,
|
|
177
|
-
* nonce: 855n,
|
|
178
|
-
* signature: {
|
|
179
|
-
* signature: {
|
|
180
|
-
* r: 44944627813007772897391531230081695102703289123332187696115181104739239197517n,
|
|
181
|
-
* s: 36528503505192438307355164441104001310566505351980369085208178712678799181120n,
|
|
182
|
-
* yParity: 0,
|
|
183
|
-
* },
|
|
184
|
-
* type: 'secp256k1',
|
|
185
|
-
* },
|
|
186
|
-
* transactionIndex: 2,
|
|
187
|
-
* type: 'tempo',
|
|
188
|
-
* })
|
|
189
|
-
* ```
|
|
190
|
-
*
|
|
191
|
-
* @param transaction - The transaction to convert.
|
|
192
|
-
* @returns An RPC-formatted transaction.
|
|
193
|
-
*/
|
|
194
|
-
export declare function toRpc<pending extends boolean = false>(transaction: Transaction<pending>, _options?: toRpc.Options<pending>): Rpc<pending>;
|
|
195
|
-
export declare namespace toRpc {
|
|
196
|
-
type Options<pending extends boolean = false> = {
|
|
197
|
-
pending?: pending | boolean | undefined;
|
|
198
|
-
};
|
|
199
|
-
type ErrorType = ox_Transaction.toRpc.ErrorType | Errors.GlobalErrorType;
|
|
200
|
-
}
|
|
201
|
-
//# sourceMappingURL=Transaction.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Transaction.d.ts","sourceRoot":"","sources":["../../src/ox/Transaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,UAAU,MAAM,eAAe,CAAA;AAChD,OAAO,KAAK,KAAK,OAAO,MAAM,YAAY,CAAA;AAC1C,OAAO,KAAK,KAAK,MAAM,MAAM,WAAW,CAAA;AACxC,OAAO,KAAK,GAAG,MAAM,QAAQ,CAAA;AAE7B,OAAO,KAAK,cAAc,MAAM,gBAAgB,CAAA;AAChD,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACxE,OAAO,KAAK,kBAAkB,MAAM,yBAAyB,CAAA;AAC7D,OAAO,KAAK,gBAAgB,MAAM,uBAAuB,CAAA;AACzD,OAAO,KAAK,iBAAiB,MAAM,wBAAwB,CAAA;AAC3D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAA;AAEzD;;GAEG;AACH,MAAM,MAAM,WAAW,CACrB,OAAO,SAAS,OAAO,GAAG,KAAK,EAC/B,UAAU,GAAG,MAAM,EACnB,UAAU,GAAG,MAAM,IACjB,YAAY,CACd,KAAK,CACD,KAAK,CAAC,OAAO,EAAE,U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E,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,GAChC,GAAG,CAAC,OAAO,CAAC,CAoCd;AAED,MAAM,CAAC,OAAO,WAAW,KAAK,CAAC;IAC7B,KAAK,OAAO,CAAC,OAAO,SAAS,OAAO,GAAG,KAAK,IAAI;QAC9C,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,SAAS,CAAA;KACxC,CAAA;IAED,KAAK,SAAS,GAAG,cAAc,CAAC,KAAK,CAAC,SAAS,GAAG,MAAM,CAAC,eAAe,CAAA;CACzE"}
|
package/dist/ox/Transaction.js
DELETED
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
import * as Hex from 'ox/Hex';
|
|
2
|
-
import * as Signature from 'ox/Signature';
|
|
3
|
-
import * as ox_Transaction from 'ox/Transaction';
|
|
4
|
-
import * as AuthorizationTempo from './AuthorizationTempo.js';
|
|
5
|
-
import * as KeyAuthorization from './KeyAuthorization.js';
|
|
6
|
-
import * as SignatureEnvelope from './SignatureEnvelope.js';
|
|
7
|
-
/** Type to RPC Type mapping. */
|
|
8
|
-
export const toRpcType = {
|
|
9
|
-
...ox_Transaction.toRpcType,
|
|
10
|
-
tempo: '0x76',
|
|
11
|
-
};
|
|
12
|
-
/** RPC Type to Type mapping. */
|
|
13
|
-
export const fromRpcType = {
|
|
14
|
-
...ox_Transaction.fromRpcType,
|
|
15
|
-
'0x76': 'tempo',
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* Converts an {@link ox#Transaction.Rpc} to an {@link ox#Transaction.Transaction}.
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* ```ts twoslash
|
|
22
|
-
* import { Transaction } from 'ox/tempo'
|
|
23
|
-
*
|
|
24
|
-
* const transaction = Transaction.fromRpc({
|
|
25
|
-
* hash: '0x353fdfc38a2f26115daadee9f5b8392ce62b84f410957967e2ed56b35338cdd0',
|
|
26
|
-
* nonce: '0x357',
|
|
27
|
-
* blockHash:
|
|
28
|
-
* '0xc350d807505fb835650f0013632c5515592987ba169bbc6626d9fc54d91f0f0b',
|
|
29
|
-
* blockNumber: '0x12f296f',
|
|
30
|
-
* calls: [
|
|
31
|
-
* {
|
|
32
|
-
* input: '0xdeadbeef',
|
|
33
|
-
* to: '0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad',
|
|
34
|
-
* value: '0x9b6e64a8ec60000',
|
|
35
|
-
* },
|
|
36
|
-
* ],
|
|
37
|
-
* feeToken: '0x20c0000000000000000000000000000000000000',
|
|
38
|
-
* transactionIndex: '0x2',
|
|
39
|
-
* from: '0x814e5e0e31016b9a7f138c76b7e7b2bb5c1ab6a6',
|
|
40
|
-
* value: '0x9b6e64a8ec60000',
|
|
41
|
-
* gas: '0x43f5d',
|
|
42
|
-
* maxFeePerGas: '0x2ca6ae494',
|
|
43
|
-
* maxPriorityFeePerGas: '0x41cc3c0',
|
|
44
|
-
* input:
|
|
45
|
-
* '0x3593564c000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000006643504700000000000000000000000000000000000000000000000000000000000000040b080604000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002800000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000009b6e64a8ec600000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000009b6e64a8ec60000000000000000000000000000000000000000000000000000019124bb5ae978c000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000c56c7a0eaa804f854b536a5f3d5f49d2ec4b12b80000000000000000000000000000000000000000000000000000000000000060000000000000000000000000c56c7a0eaa804f854b536a5f3d5f49d2ec4b12b8000000000000000000000000000000fee13a103a10d593b9ae06b3e05f2e7e1c00000000000000000000000000000000000000000000000000000000000000190000000000000000000000000000000000000000000000000000000000000060000000000000000000000000c56c7a0eaa804f854b536a5f3d5f49d2ec4b12b800000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000190240001b9872b',
|
|
46
|
-
* signature: {
|
|
47
|
-
* r: '0x635dc2033e60185bb36709c29c75d64ea51dfbd91c32ef4be198e4ceb169fb4d',
|
|
48
|
-
* s: '0x50c2667ac4c771072746acfdcf1f1483336dcca8bd2df47cd83175dbe60f0540',
|
|
49
|
-
* type: 'secp256k1',
|
|
50
|
-
* yParity: '0x0',
|
|
51
|
-
* },
|
|
52
|
-
* chainId: '0x1',
|
|
53
|
-
* accessList: [],
|
|
54
|
-
* type: '0x76',
|
|
55
|
-
* })
|
|
56
|
-
* ```
|
|
57
|
-
*
|
|
58
|
-
* @param transaction - The RPC transaction to convert.
|
|
59
|
-
* @returns An instantiated {@link ox#Transaction.Transaction}.
|
|
60
|
-
*/
|
|
61
|
-
export function fromRpc(transaction, _options = {}) {
|
|
62
|
-
if (!transaction)
|
|
63
|
-
return null;
|
|
64
|
-
const transaction_ = ox_Transaction.fromRpc(transaction);
|
|
65
|
-
transaction_.type = fromRpcType[transaction.type];
|
|
66
|
-
if (transaction.aaAuthorizationList) {
|
|
67
|
-
transaction_.authorizationList = AuthorizationTempo.fromRpcList(transaction.aaAuthorizationList);
|
|
68
|
-
delete transaction_.aaAuthorizationList;
|
|
69
|
-
}
|
|
70
|
-
if (transaction.calls)
|
|
71
|
-
transaction_.calls = transaction.calls.map((call) => ({
|
|
72
|
-
to: call.to,
|
|
73
|
-
value: call.value && call.value !== '0x' ? BigInt(call.value) : undefined,
|
|
74
|
-
// @ts-expect-error
|
|
75
|
-
data: call.input || call.data || '0x',
|
|
76
|
-
}));
|
|
77
|
-
if (transaction.feeToken)
|
|
78
|
-
transaction_.feeToken = transaction.feeToken;
|
|
79
|
-
if (transaction.nonceKey)
|
|
80
|
-
transaction_.nonceKey = BigInt(transaction.nonceKey);
|
|
81
|
-
if (transaction.signature)
|
|
82
|
-
transaction_.signature = SignatureEnvelope.fromRpc(transaction.signature);
|
|
83
|
-
if (transaction.validAfter)
|
|
84
|
-
transaction_.validAfter = Number(transaction.validAfter);
|
|
85
|
-
if (transaction.validBefore)
|
|
86
|
-
transaction_.validBefore = Number(transaction.validBefore);
|
|
87
|
-
if (transaction.keyAuthorization)
|
|
88
|
-
transaction_.keyAuthorization = KeyAuthorization.fromRpc(transaction.keyAuthorization);
|
|
89
|
-
if (transaction.feePayerSignature) {
|
|
90
|
-
transaction_.feePayerSignature = Signature.fromRpc(transaction.feePayerSignature);
|
|
91
|
-
transaction_.feePayerSignature.v = Signature.yParityToV(transaction_.feePayerSignature.yParity);
|
|
92
|
-
}
|
|
93
|
-
return transaction_;
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Converts an {@link ox#Transaction.Transaction} to an {@link ox#Transaction.Rpc}.
|
|
97
|
-
*
|
|
98
|
-
* @example
|
|
99
|
-
* ```ts twoslash
|
|
100
|
-
* import { Transaction } from 'ox/tempo'
|
|
101
|
-
*
|
|
102
|
-
* const transaction = Transaction.toRpc({
|
|
103
|
-
* accessList: [],
|
|
104
|
-
* blockHash:
|
|
105
|
-
* '0xc350d807505fb835650f0013632c5515592987ba169bbc6626d9fc54d91f0f0b',
|
|
106
|
-
* blockNumber: 19868015n,
|
|
107
|
-
* calls: [
|
|
108
|
-
* {
|
|
109
|
-
* data: '0xdeadbeef',
|
|
110
|
-
* to: '0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad',
|
|
111
|
-
* value: 700000000000000000n,
|
|
112
|
-
* },
|
|
113
|
-
* ],
|
|
114
|
-
* chainId: 1,
|
|
115
|
-
* feeToken: '0x20c0000000000000000000000000000000000000',
|
|
116
|
-
* from: '0x814e5e0e31016b9a7f138c76b7e7b2bb5c1ab6a6',
|
|
117
|
-
* gas: 278365n,
|
|
118
|
-
* hash: '0x353fdfc38a2f26115daadee9f5b8392ce62b84f410957967e2ed56b35338cdd0',
|
|
119
|
-
* input:
|
|
120
|
-
* '0x3593564c000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000006643504700000000000000000000000000000000000000000000000000000000000000040b080604000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002800000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000009b6e64a8ec600000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000009b6e64a8ec60000000000000000000000000000000000000000000000000000019124bb5ae978c000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000c56c7a0eaa804f854b536a5f3d5f49d2ec4b12b80000000000000000000000000000000000000000000000000000000000000060000000000000000000000000c56c7a0eaa804f854b536a5f3d5f49d2ec4b12b8000000000000000000000000000000fee13a103a10d593b9ae06b3e05f2e7e1c00000000000000000000000000000000000000000000000000000000000000190000000000000000000000000000000000000000000000000000000000000060000000000000000000000000c56c7a0eaa804f854b536a5f3d5f49d2ec4b12b800000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000190240001b9872b',
|
|
121
|
-
* maxFeePerGas: 11985937556n,
|
|
122
|
-
* maxPriorityFeePerGas: 68993984n,
|
|
123
|
-
* nonce: 855n,
|
|
124
|
-
* signature: {
|
|
125
|
-
* signature: {
|
|
126
|
-
* r: 44944627813007772897391531230081695102703289123332187696115181104739239197517n,
|
|
127
|
-
* s: 36528503505192438307355164441104001310566505351980369085208178712678799181120n,
|
|
128
|
-
* yParity: 0,
|
|
129
|
-
* },
|
|
130
|
-
* type: 'secp256k1',
|
|
131
|
-
* },
|
|
132
|
-
* transactionIndex: 2,
|
|
133
|
-
* type: 'tempo',
|
|
134
|
-
* })
|
|
135
|
-
* ```
|
|
136
|
-
*
|
|
137
|
-
* @param transaction - The transaction to convert.
|
|
138
|
-
* @returns An RPC-formatted transaction.
|
|
139
|
-
*/
|
|
140
|
-
export function toRpc(transaction, _options) {
|
|
141
|
-
const rpc = ox_Transaction.toRpc(transaction);
|
|
142
|
-
rpc.type = toRpcType[transaction.type];
|
|
143
|
-
if (transaction.authorizationList)
|
|
144
|
-
rpc.aaAuthorizationList = AuthorizationTempo.toRpcList(transaction.authorizationList);
|
|
145
|
-
if (transaction.calls)
|
|
146
|
-
rpc.calls = transaction.calls.map((call) => ({
|
|
147
|
-
to: call.to,
|
|
148
|
-
value: call.value ? Hex.fromNumber(call.value) : undefined,
|
|
149
|
-
data: call.data,
|
|
150
|
-
}));
|
|
151
|
-
if (transaction.feeToken)
|
|
152
|
-
rpc.feeToken = transaction.feeToken;
|
|
153
|
-
if (transaction.keyAuthorization)
|
|
154
|
-
rpc.keyAuthorization = KeyAuthorization.toRpc(transaction.keyAuthorization);
|
|
155
|
-
if (transaction.feePayerSignature) {
|
|
156
|
-
rpc.feePayerSignature = Signature.toRpc(transaction.feePayerSignature);
|
|
157
|
-
rpc.feePayerSignature.v = Hex.fromNumber(Signature.yParityToV(transaction.feePayerSignature?.yParity));
|
|
158
|
-
}
|
|
159
|
-
if (transaction.signature)
|
|
160
|
-
rpc.signature = SignatureEnvelope.toRpc(transaction.signature);
|
|
161
|
-
if (typeof transaction.validAfter === 'number')
|
|
162
|
-
rpc.validAfter = Hex.fromNumber(transaction.validAfter);
|
|
163
|
-
if (typeof transaction.validBefore === 'number')
|
|
164
|
-
rpc.validBefore = Hex.fromNumber(transaction.validBefore);
|
|
165
|
-
return rpc;
|
|
166
|
-
}
|
|
167
|
-
//# sourceMappingURL=Transaction.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Transaction.js","sourceRoot":"","sources":["../../src/ox/Transaction.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,GAAG,MAAM,QAAQ,CAAA;AAC7B,OAAO,KAAK,SAAS,MAAM,cAAc,CAAA;AACzC,OAAO,KAAK,cAAc,MAAM,gBAAgB,CAAA;AAEhD,OAAO,KAAK,kBAAkB,MAAM,yBAAyB,CAAA;AAC7D,OAAO,KAAK,gBAAgB,MAAM,uBAAuB,CAAA;AACzD,OAAO,KAAK,iBAAiB,MAAM,wBAAwB,CAAA;AAuG3D,gCAAgC;AAChC,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,GAAG,cAAc,CAAC,SAAS;IAC3B,KAAK,EAAE,MAAM;CACL,CAAA;AAOV,gCAAgC;AAChC,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,GAAG,cAAc,CAAC,WAAW;IAC7B,MAAM,EAAE,OAAO;CACP,CAAA;AAQV;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,MAAM,UAAU,OAAO,CAIrB,WAA8C,EAC9C,WAAqC,EAAE;IAEvC,IAAI,CAAC,WAAW;QAAE,OAAO,IAAa,CAAA;IAEtC,MAAM,YAAY,GAAG,cAAc,CAAC,OAAO,CACzC,WAA0C,CACnB,CAAA;IAEzB,YAAY,CAAC,IAAI,GAAG,WAAW,CAAC,WAAW,CAAC,IAAgC,CAAC,CAAA;IAE7E,IAAI,WAAW,CAAC,mBAAmB,EAAE,CAAC;QACpC,YAAY,CAAC,iBAAiB,GAAG,kBAAkB,CAAC,WAAW,CAC7D,WAAW,CAAC,mBAAmB,CAChC,CAAA;QACD,OAAQ,YAAoB,CAAC,mBAAmB,CAAA;IAClD,CAAC;IACD,IAAI,WAAW,CAAC,KAAK;QACnB,YAAY,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