ox 1.0.3 → 1.0.5
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 +18 -0
- package/dist/tempo/EarnShares.d.ts +179 -0
- package/dist/tempo/EarnShares.d.ts.map +1 -0
- package/dist/tempo/EarnShares.js +160 -0
- package/dist/tempo/EarnShares.js.map +1 -0
- package/dist/tempo/ZoneId.d.ts +35 -17
- package/dist/tempo/ZoneId.d.ts.map +1 -1
- package/dist/tempo/ZoneId.js +41 -16
- package/dist/tempo/ZoneId.js.map +1 -1
- package/dist/tempo/index.d.ts +27 -6
- package/dist/tempo/index.d.ts.map +1 -1
- package/dist/tempo/index.js +27 -6
- package/dist/tempo/index.js.map +1 -1
- package/package.json +6 -1
- package/src/tempo/EarnShares.test.ts +120 -0
- package/src/tempo/EarnShares.ts +235 -0
- package/src/tempo/ZoneId.test-d.ts +16 -0
- package/src/tempo/ZoneId.test.ts +48 -13
- package/src/tempo/ZoneId.ts +55 -19
- package/src/tempo/index.ts +27 -6
- package/src/version.ts +1 -1
- package/src/zod/tempo/_test/ZoneId.test.ts +2 -2
package/src/tempo/index.ts
CHANGED
|
@@ -68,6 +68,28 @@ export * as AuthorizationTempo from './AuthorizationTempo.js'
|
|
|
68
68
|
* @category Reference
|
|
69
69
|
*/
|
|
70
70
|
export * as Channel from './Channel.js'
|
|
71
|
+
/**
|
|
72
|
+
* Tempo Earn `VaultAdapter` share math: raw vault-share and venue-share conversions
|
|
73
|
+
* at the anchor rate, the dilution-correct fee-share formula, and the
|
|
74
|
+
* `minimumOutput` slippage floor.
|
|
75
|
+
*
|
|
76
|
+
* Conversions are fee-blind mirrors of the adapter's anchor arithmetic; use the
|
|
77
|
+
* adapter's `previewRedeem` for user-facing value.
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```ts twoslash
|
|
81
|
+
* import { EarnShares } from 'ox/tempo'
|
|
82
|
+
*
|
|
83
|
+
* const shareAmount = EarnShares.toAmount(
|
|
84
|
+
* { engineShares: 3n, shareSupply: 2n },
|
|
85
|
+
* 7n
|
|
86
|
+
* )
|
|
87
|
+
* // @log: 4n
|
|
88
|
+
* ```
|
|
89
|
+
*
|
|
90
|
+
* @category Reference
|
|
91
|
+
*/
|
|
92
|
+
export * as EarnShares from './EarnShares.js'
|
|
71
93
|
/**
|
|
72
94
|
* Tempo key authorization utilities for provisioning and signing access keys.
|
|
73
95
|
*
|
|
@@ -510,18 +532,17 @@ export * as VirtualMaster from './VirtualMaster.js'
|
|
|
510
532
|
/**
|
|
511
533
|
* Zone ID utilities for converting between zone IDs and zone chain IDs.
|
|
512
534
|
*
|
|
513
|
-
* Zone chain IDs
|
|
514
|
-
* `421_700_000 + zoneId`. This module provides helpers to convert between them.
|
|
535
|
+
* Zone chain IDs use the base and range assigned to their Tempo source chain.
|
|
515
536
|
*
|
|
516
537
|
* @example
|
|
517
538
|
* ```ts twoslash
|
|
518
539
|
* import { ZoneId } from 'ox/tempo'
|
|
519
540
|
*
|
|
520
|
-
* const zoneId = ZoneId.fromChainId(
|
|
521
|
-
* // @log:
|
|
541
|
+
* const zoneId = ZoneId.fromChainId(421_700_001)
|
|
542
|
+
* // @log: 1
|
|
522
543
|
*
|
|
523
|
-
* const chainId = ZoneId.toChainId(
|
|
524
|
-
* // @log:
|
|
544
|
+
* const chainId = ZoneId.toChainId(1)
|
|
545
|
+
* // @log: 421700001
|
|
525
546
|
* ```
|
|
526
547
|
*
|
|
527
548
|
* @category Reference
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** @internal */
|
|
2
|
-
export const version = '1.0.
|
|
2
|
+
export const version = '1.0.5'
|
|
@@ -11,7 +11,7 @@ describe('ZoneId', () => {
|
|
|
11
11
|
})
|
|
12
12
|
|
|
13
13
|
test('decodes and encodes chain ids', () => {
|
|
14
|
-
expect(z.decode(z_ZoneId.chainId,
|
|
15
|
-
expect(z.encode(z_ZoneId.chainId,
|
|
14
|
+
expect(z.decode(z_ZoneId.chainId, 421_700_001)).toMatchInlineSnapshot(`1`)
|
|
15
|
+
expect(z.encode(z_ZoneId.chainId, 1)).toMatchInlineSnapshot(`421700001`)
|
|
16
16
|
})
|
|
17
17
|
})
|