agoric 0.21.2-u12.0 → 0.22.0-u13.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 +26 -0
- package/package.json +18 -14
- package/src/chain-config.js +0 -1
- package/src/commands/inter.js +2 -17
- package/src/commands/oracle.js +27 -12
- package/src/commands/psm.js +1 -1
- package/src/commands/reserve.js +1 -1
- package/src/commands/vaults.js +3 -3
- package/src/follow.js +6 -3
- package/src/lib/rpc.js +13 -2
- package/src/lib/wallet.js +7 -42
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,32 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [0.22.0-u13.0](https://github.com/Agoric/agoric-sdk/compare/agoric@0.21.2-u12.0...agoric@0.22.0-u13.0) (2023-12-07)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### ⚠ BREAKING CHANGES
|
|
10
|
+
|
|
11
|
+
* restrict exports from 'agoric' package
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* **cosmos:** un-wire x/crisis ([#8582](https://github.com/Agoric/agoric-sdk/issues/8582)) ([19404a3](https://github.com/Agoric/agoric-sdk/commit/19404a3c5cd10d9c454f190b60cbf0aa715f605c))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* **agops:** fix continuing id lookup in oracle setPrice ([0ac9697](https://github.com/Agoric/agoric-sdk/commit/0ac969746c7337d45287fd040b636d27d296a062))
|
|
21
|
+
* **agoric:** print errors while following ([deab7e4](https://github.com/Agoric/agoric-sdk/commit/deab7e4065fe5dd6cc1a3c5bf8c0db861cb7856b))
|
|
22
|
+
* **casting:** dont crash on bad capdata ([3f01369](https://github.com/Agoric/agoric-sdk/commit/3f0136994c0b4033c872f9593cabb19bab05f01c))
|
|
23
|
+
* **cli:** handle not found error in vstorage requests ([8111c43](https://github.com/Agoric/agoric-sdk/commit/8111c4344bcaa6e06085020813e2431cba9d1632))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### Miscellaneous Chores
|
|
27
|
+
|
|
28
|
+
* restrict exports from 'agoric' package ([63c1abb](https://github.com/Agoric/agoric-sdk/commit/63c1abbfcb0710bdd0a22382eb4a683216a6c453))
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
6
32
|
### [0.21.2-u12.0](https://github.com/Agoric/agoric-sdk/compare/agoric@0.21.2-u11wf.0...agoric@0.21.2-u12.0) (2023-11-10)
|
|
7
33
|
|
|
8
34
|
**Note:** Version bump only for package agoric
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agoric",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.0-u13.0",
|
|
4
4
|
"description": "Manage the Agoric Javascript smart contract platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/main.js",
|
|
@@ -8,6 +8,10 @@
|
|
|
8
8
|
"agoric": "src/entrypoint.js",
|
|
9
9
|
"agops": "src/bin-agops.js"
|
|
10
10
|
},
|
|
11
|
+
"exports": {
|
|
12
|
+
"./src/entrypoint.js": "./src/entrypoint.js",
|
|
13
|
+
"./src/helpers.js": "./src/helpers.js"
|
|
14
|
+
},
|
|
11
15
|
"files": [
|
|
12
16
|
"src",
|
|
13
17
|
"exported.js"
|
|
@@ -24,7 +28,7 @@
|
|
|
24
28
|
"lint:eslint": "eslint ."
|
|
25
29
|
},
|
|
26
30
|
"devDependencies": {
|
|
27
|
-
"@agoric/deploy-script-support": "^0.10.4-
|
|
31
|
+
"@agoric/deploy-script-support": "^0.10.4-u13.0",
|
|
28
32
|
"ava": "^5.2.0",
|
|
29
33
|
"c8": "^7.13.0",
|
|
30
34
|
"dd-trace": "^3.3.0"
|
|
@@ -32,18 +36,18 @@
|
|
|
32
36
|
"dependencies": {
|
|
33
37
|
"@agoric/access-token": "^0.4.22-u11wf.0",
|
|
34
38
|
"@agoric/assert": "^0.6.1-u11wf.0",
|
|
35
|
-
"@agoric/cache": "^0.3.3-
|
|
36
|
-
"@agoric/casting": "^0.4.3-
|
|
39
|
+
"@agoric/cache": "^0.3.3-u13.0",
|
|
40
|
+
"@agoric/casting": "^0.4.3-u13.0",
|
|
37
41
|
"@agoric/cosmic-proto": "^0.3.0",
|
|
38
|
-
"@agoric/ertp": "^0.16.3-
|
|
39
|
-
"@agoric/inter-protocol": "^0.16.2-
|
|
40
|
-
"@agoric/internal": "^0.4.0-
|
|
41
|
-
"@agoric/smart-wallet": "^0.5.4-
|
|
42
|
-
"@agoric/store": "^0.9.3-
|
|
43
|
-
"@agoric/swingset-vat": "^0.32.3-
|
|
44
|
-
"@agoric/vats": "^0.15.2-
|
|
45
|
-
"@agoric/zoe": "^0.26.3-
|
|
46
|
-
"@agoric/zone": "^0.2.3-
|
|
42
|
+
"@agoric/ertp": "^0.16.3-u13.0",
|
|
43
|
+
"@agoric/inter-protocol": "^0.16.2-u13.0",
|
|
44
|
+
"@agoric/internal": "^0.4.0-u13.0",
|
|
45
|
+
"@agoric/smart-wallet": "^0.5.4-u13.0",
|
|
46
|
+
"@agoric/store": "^0.9.3-u13.0",
|
|
47
|
+
"@agoric/swingset-vat": "^0.32.3-u13.0",
|
|
48
|
+
"@agoric/vats": "^0.15.2-u13.0",
|
|
49
|
+
"@agoric/zoe": "^0.26.3-u13.0",
|
|
50
|
+
"@agoric/zone": "^0.2.3-u13.0",
|
|
47
51
|
"@confio/relayer": "^0.9.0",
|
|
48
52
|
"@cosmjs/crypto": "^0.30.1",
|
|
49
53
|
"@cosmjs/encoding": "^0.30.1",
|
|
@@ -87,5 +91,5 @@
|
|
|
87
91
|
"timeout": "2m",
|
|
88
92
|
"workerThreads": false
|
|
89
93
|
},
|
|
90
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "5a6cdeb0c18ae9700d706445acf402f8d1e873c3"
|
|
91
95
|
}
|
package/src/chain-config.js
CHANGED
|
@@ -235,7 +235,6 @@ export function finishCosmosGenesis({ genesisJson, exportedGenesisJson }) {
|
|
|
235
235
|
|
|
236
236
|
// Set the denomination for different modules.
|
|
237
237
|
genesis.app_state.mint.params.mint_denom = MINT_DENOM;
|
|
238
|
-
genesis.app_state.crisis.constant_fee.denom = MINT_DENOM;
|
|
239
238
|
genesis.app_state.gov.deposit_params.min_deposit = GOV_DEPOSIT_COINS;
|
|
240
239
|
genesis.app_state.gov.voting_params.voting_period = GOV_VOTING_PERIOD;
|
|
241
240
|
|
package/src/commands/inter.js
CHANGED
|
@@ -25,7 +25,6 @@ import {
|
|
|
25
25
|
import { getNetworkConfig } from '../lib/rpc.js';
|
|
26
26
|
import {
|
|
27
27
|
getCurrent,
|
|
28
|
-
makeParseAmount,
|
|
29
28
|
makeWalletUtils,
|
|
30
29
|
outputActionAndHint,
|
|
31
30
|
sendAction,
|
|
@@ -416,14 +415,7 @@ inter auction status
|
|
|
416
415
|
async ({ generateOnly, dryRun, ...opts }) => {
|
|
417
416
|
const tools = await tryMakeUtils();
|
|
418
417
|
|
|
419
|
-
const
|
|
420
|
-
tools.agoricNames,
|
|
421
|
-
msg => new InvalidArgumentError(msg),
|
|
422
|
-
);
|
|
423
|
-
const offer = Offers.auction.Bid(tools.agoricNames.brand, {
|
|
424
|
-
...opts,
|
|
425
|
-
parseAmount,
|
|
426
|
-
});
|
|
418
|
+
const offer = Offers.auction.Bid(tools.agoricNames, opts);
|
|
427
419
|
|
|
428
420
|
if (generateOnly) {
|
|
429
421
|
outputActionAndHint(
|
|
@@ -464,14 +456,7 @@ inter auction status
|
|
|
464
456
|
async ({ generateOnly, ...opts }) => {
|
|
465
457
|
const tools = await tryMakeUtils();
|
|
466
458
|
|
|
467
|
-
const
|
|
468
|
-
tools.agoricNames,
|
|
469
|
-
msg => new InvalidArgumentError(msg),
|
|
470
|
-
);
|
|
471
|
-
const offer = Offers.auction.Bid(tools.agoricNames.brand, {
|
|
472
|
-
...opts,
|
|
473
|
-
parseAmount,
|
|
474
|
-
});
|
|
459
|
+
const offer = Offers.auction.Bid(tools.agoricNames, opts);
|
|
475
460
|
if (generateOnly) {
|
|
476
461
|
outputActionAndHint(
|
|
477
462
|
{ method: 'executeOffer', offer },
|
package/src/commands/oracle.js
CHANGED
|
@@ -71,6 +71,11 @@ export const makeOracleCommand = (logger, io = {}) => {
|
|
|
71
71
|
env.AGORIC_KEYRING_BACKEND,
|
|
72
72
|
);
|
|
73
73
|
|
|
74
|
+
const normalizeAddress = literalOrName =>
|
|
75
|
+
normalizeAddressWithOptions(literalOrName, oracle.opts(), {
|
|
76
|
+
execFileSync,
|
|
77
|
+
});
|
|
78
|
+
|
|
74
79
|
const rpcTools = async () => {
|
|
75
80
|
// XXX pass fetch to getNetworkConfig() explicitly
|
|
76
81
|
const networkConfig = await getNetworkConfig(env);
|
|
@@ -162,7 +167,7 @@ export const makeOracleCommand = (logger, io = {}) => {
|
|
|
162
167
|
console.warn('Now execute the prepared offer');
|
|
163
168
|
});
|
|
164
169
|
|
|
165
|
-
const findOracleCap = async (from, readLatestHead) => {
|
|
170
|
+
const findOracleCap = async (instance, from, readLatestHead) => {
|
|
166
171
|
const current = await getCurrent(from, { readLatestHead });
|
|
167
172
|
|
|
168
173
|
const { offerToUsedInvitation: entries } = /** @type {any} */ (current);
|
|
@@ -170,8 +175,8 @@ export const makeOracleCommand = (logger, io = {}) => {
|
|
|
170
175
|
|
|
171
176
|
for (const [offerId, { value }] of entries) {
|
|
172
177
|
/** @type {{ description: string, instance: unknown }[]} */
|
|
173
|
-
const [{ description }] = value;
|
|
174
|
-
if (description === 'oracle invitation') {
|
|
178
|
+
const [{ description, instance: candidate }] = value;
|
|
179
|
+
if (description === 'oracle invitation' && candidate === instance) {
|
|
175
180
|
return offerId;
|
|
176
181
|
}
|
|
177
182
|
}
|
|
@@ -180,11 +185,22 @@ export const makeOracleCommand = (logger, io = {}) => {
|
|
|
180
185
|
oracle
|
|
181
186
|
.command('find-continuing-id')
|
|
182
187
|
.description('print id of specified oracle continuing invitation')
|
|
183
|
-
.requiredOption(
|
|
188
|
+
.requiredOption(
|
|
189
|
+
'--from <address>',
|
|
190
|
+
'wallet address literal or name',
|
|
191
|
+
normalizeAddress,
|
|
192
|
+
)
|
|
193
|
+
.requiredOption(
|
|
194
|
+
'--pair [brandIn.brandOut]',
|
|
195
|
+
'token pair (brandIn.brandOut)',
|
|
196
|
+
s => s.split('.'),
|
|
197
|
+
)
|
|
184
198
|
.action(async opts => {
|
|
185
|
-
const { readLatestHead } =
|
|
199
|
+
const { readLatestHead, lookupPriceAggregatorInstance } =
|
|
200
|
+
await rpcTools();
|
|
201
|
+
const instance = lookupPriceAggregatorInstance(opts.pair);
|
|
186
202
|
|
|
187
|
-
const offerId = await findOracleCap(opts.from, readLatestHead);
|
|
203
|
+
const offerId = await findOracleCap(instance, opts.from, readLatestHead);
|
|
188
204
|
if (!offerId) {
|
|
189
205
|
console.error('No continuing ids found');
|
|
190
206
|
}
|
|
@@ -212,11 +228,6 @@ export const makeOracleCommand = (logger, io = {}) => {
|
|
|
212
228
|
console.log(inspect(capDatas[0], { depth: 10, colors: true }));
|
|
213
229
|
});
|
|
214
230
|
|
|
215
|
-
/** @param {string} literalOrName */
|
|
216
|
-
const normalizeAddress = literalOrName =>
|
|
217
|
-
normalizeAddressWithOptions(literalOrName, oracle.opts(), {
|
|
218
|
-
execFileSync,
|
|
219
|
-
});
|
|
220
231
|
const show = (info, indent = false) =>
|
|
221
232
|
stdout.write(
|
|
222
233
|
`${JSON.stringify(info, bigintReplacer, indent ? 2 : undefined)}\n`,
|
|
@@ -250,7 +261,8 @@ export const makeOracleCommand = (logger, io = {}) => {
|
|
|
250
261
|
* }}
|
|
251
262
|
*/ { pair, keys, price },
|
|
252
263
|
) => {
|
|
253
|
-
const { readLatestHead, networkConfig } =
|
|
264
|
+
const { readLatestHead, networkConfig, lookupPriceAggregatorInstance } =
|
|
265
|
+
await rpcTools();
|
|
254
266
|
const wutil = await makeWalletUtils(
|
|
255
267
|
{ fetch, execFileSync, delay },
|
|
256
268
|
networkConfig,
|
|
@@ -308,9 +320,12 @@ export const makeOracleCommand = (logger, io = {}) => {
|
|
|
308
320
|
console.warn(err);
|
|
309
321
|
});
|
|
310
322
|
|
|
323
|
+
const instance = lookupPriceAggregatorInstance(pair);
|
|
324
|
+
|
|
311
325
|
console.error('pushPrice from each:', keyOrder);
|
|
312
326
|
for await (const from of keyOrder) {
|
|
313
327
|
const oracleAdminAcceptOfferId = await findOracleCap(
|
|
328
|
+
instance,
|
|
314
329
|
from,
|
|
315
330
|
readLatestHead,
|
|
316
331
|
);
|
package/src/commands/psm.js
CHANGED
|
@@ -159,7 +159,7 @@ export const makePsmCommand = logger => {
|
|
|
159
159
|
console.warn('running with options', opts);
|
|
160
160
|
const { agoricNames, lookupPsmInstance } = await rpcTools();
|
|
161
161
|
const instance = await lookupPsmInstance(opts.pair);
|
|
162
|
-
const offer = Offers.psm.swap(
|
|
162
|
+
const offer = Offers.psm.swap(agoricNames, instance, opts);
|
|
163
163
|
outputExecuteOfferAction(offer);
|
|
164
164
|
});
|
|
165
165
|
|
package/src/commands/reserve.js
CHANGED
|
@@ -32,7 +32,7 @@ export const makeReserveCommand = (_logger, io = {}) => {
|
|
|
32
32
|
async ({ collateralBrand, ...opts }) => {
|
|
33
33
|
const { agoricNames } = await makeRpcUtils({ fetch });
|
|
34
34
|
|
|
35
|
-
const offer = Offers.reserve.AddCollateral(agoricNames
|
|
35
|
+
const offer = Offers.reserve.AddCollateral(agoricNames, {
|
|
36
36
|
collateralBrandKey: collateralBrand,
|
|
37
37
|
...opts,
|
|
38
38
|
});
|
package/src/commands/vaults.js
CHANGED
|
@@ -65,7 +65,7 @@ export const makeVaultsCommand = logger => {
|
|
|
65
65
|
logger.warn('running with options', opts);
|
|
66
66
|
const { agoricNames } = await makeRpcUtils({ fetch });
|
|
67
67
|
|
|
68
|
-
const offer = Offers.vaults.OpenVault(agoricNames
|
|
68
|
+
const offer = Offers.vaults.OpenVault(agoricNames, {
|
|
69
69
|
giveCollateral: opts.giveCollateral,
|
|
70
70
|
wantMinted: opts.wantMinted,
|
|
71
71
|
offerId: opts.offerId,
|
|
@@ -106,7 +106,7 @@ export const makeVaultsCommand = logger => {
|
|
|
106
106
|
);
|
|
107
107
|
|
|
108
108
|
const offer = Offers.vaults.AdjustBalances(
|
|
109
|
-
agoricNames
|
|
109
|
+
agoricNames,
|
|
110
110
|
{
|
|
111
111
|
giveCollateral: opts.giveCollateral,
|
|
112
112
|
wantCollateral: opts.wantCollateral,
|
|
@@ -147,7 +147,7 @@ export const makeVaultsCommand = logger => {
|
|
|
147
147
|
);
|
|
148
148
|
|
|
149
149
|
const offer = Offers.vaults.CloseVault(
|
|
150
|
-
agoricNames
|
|
150
|
+
agoricNames,
|
|
151
151
|
{
|
|
152
152
|
giveMinted: opts.giveMinted,
|
|
153
153
|
offerId: opts.offerId,
|
package/src/follow.js
CHANGED
|
@@ -142,9 +142,12 @@ export default async function followerMain(progname, rawArgs, powers, opts) {
|
|
|
142
142
|
verbose && console.warn('Following', spec);
|
|
143
143
|
const castingSpec = makeCastingSpec(spec);
|
|
144
144
|
const follower = makeFollower(castingSpec, leader, followerOptions);
|
|
145
|
-
for await (const
|
|
146
|
-
|
|
147
|
-
|
|
145
|
+
for await (const obj of iterate(follower)) {
|
|
146
|
+
if ('error' in obj) {
|
|
147
|
+
console.error('Error following:', obj.error);
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
150
|
+
const { value, blockHeight, currentBlockHeight } = obj;
|
|
148
151
|
const blockHeightPrefix = opts.blockHeight ? `${blockHeight}:` : '';
|
|
149
152
|
const currentBlockHeightPrefix = opts.currentBlockHeight
|
|
150
153
|
? `${currentBlockHeight}:`
|
package/src/lib/rpc.js
CHANGED
|
@@ -79,9 +79,13 @@ export const makeVStorage = (powers, config = networkConfig) => {
|
|
|
79
79
|
result: { response },
|
|
80
80
|
} = data;
|
|
81
81
|
if (response?.code !== 0) {
|
|
82
|
-
|
|
82
|
+
/** @type {any} */
|
|
83
|
+
const err = Error(
|
|
83
84
|
`error code ${response?.code} reading ${kind} of ${path}: ${response.log}`,
|
|
84
85
|
);
|
|
86
|
+
err.code = response?.code;
|
|
87
|
+
err.codespace = response?.codespace;
|
|
88
|
+
throw err;
|
|
85
89
|
}
|
|
86
90
|
return data;
|
|
87
91
|
});
|
|
@@ -143,7 +147,14 @@ export const makeVStorage = (powers, config = networkConfig) => {
|
|
|
143
147
|
));
|
|
144
148
|
// console.debug('readAt returned', { blockHeight });
|
|
145
149
|
} catch (err) {
|
|
146
|
-
if (
|
|
150
|
+
if (
|
|
151
|
+
// CosmosSDK ErrNotFound; there is no data at the path
|
|
152
|
+
(err.codespace === 'sdk' && err.code === 38) ||
|
|
153
|
+
// CosmosSDK ErrUnknownRequest; misrepresentation of the same until
|
|
154
|
+
// https://github.com/Agoric/agoric-sdk/commit/dafc7c1708977aaa55e245dc09a73859cf1df192
|
|
155
|
+
// TODO remove after upgrade-12
|
|
156
|
+
err.message.match(/unknown request/)
|
|
157
|
+
) {
|
|
147
158
|
// console.error(err);
|
|
148
159
|
break;
|
|
149
160
|
}
|
package/src/lib/wallet.js
CHANGED
|
@@ -9,7 +9,6 @@ import { boardSlottingMarshaller, makeRpcUtils } from './rpc.js';
|
|
|
9
9
|
/** @typedef {import('@agoric/smart-wallet/src/smartWallet.js').CurrentWalletRecord} CurrentWalletRecord */
|
|
10
10
|
/** @typedef {import('@agoric/vats/tools/board-utils.js').AgoricNamesRemotes} AgoricNamesRemotes */
|
|
11
11
|
|
|
12
|
-
const { values } = Object;
|
|
13
12
|
const { Fail } = assert;
|
|
14
13
|
const marshaller = boardSlottingMarshaller();
|
|
15
14
|
|
|
@@ -113,6 +112,13 @@ export const coalesceWalletState = async (follower, invitationBrand) => {
|
|
|
113
112
|
// values with oldest last
|
|
114
113
|
const history = [];
|
|
115
114
|
for await (const followerElement of iterateReverse(follower)) {
|
|
115
|
+
if ('error' in followerElement) {
|
|
116
|
+
console.error(
|
|
117
|
+
'Skipping wallet update due to error:',
|
|
118
|
+
followerElement.error,
|
|
119
|
+
);
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
116
122
|
history.push(followerElement.value);
|
|
117
123
|
}
|
|
118
124
|
|
|
@@ -272,44 +278,3 @@ export const makeWalletUtils = async (
|
|
|
272
278
|
pollOffer,
|
|
273
279
|
};
|
|
274
280
|
};
|
|
275
|
-
|
|
276
|
-
/**
|
|
277
|
-
* @param {{
|
|
278
|
-
* brand: Record<string, Brand>,
|
|
279
|
-
* vbankAsset: Record<string, { brand: Brand, displayInfo: DisplayInfo }>,
|
|
280
|
-
* }} agoricNames
|
|
281
|
-
* @param {(msg: string) => Error} makeError error constructor
|
|
282
|
-
* @returns {(a: string) => Amount<'nat'>}
|
|
283
|
-
*/
|
|
284
|
-
export const makeParseAmount =
|
|
285
|
-
(agoricNames, makeError = msg => RangeError(msg)) =>
|
|
286
|
-
opt => {
|
|
287
|
-
assert.typeof(opt, 'string', 'parseAmount expected string');
|
|
288
|
-
const m = opt.match(/^(?<value>[\d_]+(\.[\d_]+)?)(?<brand>[A-Z]\w*?)$/);
|
|
289
|
-
if (!m || !m.groups) {
|
|
290
|
-
throw makeError(`invalid amount: ${opt}`);
|
|
291
|
-
}
|
|
292
|
-
const anyBrand = agoricNames.brand[m.groups.brand];
|
|
293
|
-
if (!anyBrand) {
|
|
294
|
-
throw makeError(`unknown brand: ${m.groups.brand}`);
|
|
295
|
-
}
|
|
296
|
-
const assetDesc = values(agoricNames.vbankAsset).find(
|
|
297
|
-
d => d.brand === anyBrand,
|
|
298
|
-
);
|
|
299
|
-
if (!assetDesc) {
|
|
300
|
-
throw makeError(`unknown brand: ${m.groups.brand}`);
|
|
301
|
-
}
|
|
302
|
-
const { displayInfo } = assetDesc;
|
|
303
|
-
if (!displayInfo.decimalPlaces || displayInfo.assetKind !== 'nat') {
|
|
304
|
-
throw makeError(`bad brand: ${displayInfo}`);
|
|
305
|
-
}
|
|
306
|
-
const value = BigInt(
|
|
307
|
-
Number(m.groups.value.replace(/_/g, '')) *
|
|
308
|
-
10 ** displayInfo.decimalPlaces,
|
|
309
|
-
);
|
|
310
|
-
/** @type {Brand<'nat'>} */
|
|
311
|
-
// @ts-expect-error dynamic cast
|
|
312
|
-
const natBrand = anyBrand;
|
|
313
|
-
const amt = { value, brand: natBrand };
|
|
314
|
-
return amt;
|
|
315
|
-
};
|