@agoric/fast-usdc 0.2.0 → 0.2.1-upgrade-23-dev-bd79330.0.bd79330

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.
Files changed (51) hide show
  1. package/package.json +13 -11
  2. package/src/cli/bin.d.ts +3 -0
  3. package/src/cli/bin.d.ts.map +1 -0
  4. package/src/cli/bridge-action.d.ts +10 -0
  5. package/src/cli/bridge-action.d.ts.map +1 -0
  6. package/src/cli/bridge-action.js +5 -4
  7. package/src/cli/cli.d.ts +13 -0
  8. package/src/cli/cli.d.ts.map +1 -0
  9. package/src/cli/cli.js +4 -4
  10. package/src/cli/config-commands.d.ts +5 -0
  11. package/src/cli/config-commands.d.ts.map +1 -0
  12. package/src/cli/config.d.ts +22 -0
  13. package/src/cli/config.d.ts.map +1 -0
  14. package/src/cli/lp-commands.d.ts +12 -0
  15. package/src/cli/lp-commands.d.ts.map +1 -0
  16. package/src/cli/lp-commands.js +9 -3
  17. package/src/cli/operator-commands.d.ts +10 -0
  18. package/src/cli/operator-commands.d.ts.map +1 -0
  19. package/src/cli/transfer.d.ts +9 -0
  20. package/src/cli/transfer.d.ts.map +1 -0
  21. package/src/cli/transfer.js +5 -4
  22. package/src/cli/util/agoric.d.ts +3 -0
  23. package/src/cli/util/agoric.d.ts.map +1 -0
  24. package/src/cli/util/bank.d.ts +2 -0
  25. package/src/cli/util/bank.d.ts.map +1 -0
  26. package/src/cli/util/cctp.d.ts +5 -0
  27. package/src/cli/util/cctp.d.ts.map +1 -0
  28. package/src/cli/util/file.d.ts +12 -0
  29. package/src/cli/util/file.d.ts.map +1 -0
  30. package/src/cli/util/file.js +1 -1
  31. package/src/cli/util/noble.d.ts +11 -0
  32. package/src/cli/util/noble.d.ts.map +1 -0
  33. package/src/clientSupport.d.ts +51 -0
  34. package/src/clientSupport.d.ts.map +1 -0
  35. package/src/clientSupport.js +8 -5
  36. package/src/constants.d.ts +35 -0
  37. package/src/constants.d.ts.map +1 -0
  38. package/src/main.d.ts +2 -0
  39. package/src/main.d.ts.map +1 -0
  40. package/src/operator-kit-interface.d.ts +19 -0
  41. package/src/operator-kit-interface.d.ts.map +1 -0
  42. package/src/pool-share-math.d.ts +73 -0
  43. package/src/pool-share-math.d.ts.map +1 -0
  44. package/src/type-guards.d.ts +113 -0
  45. package/src/type-guards.d.ts.map +1 -0
  46. package/src/types.d.ts +174 -0
  47. package/src/types.d.ts.map +1 -0
  48. package/src/types.js +208 -0
  49. package/src/utils/fees.d.ts +64 -0
  50. package/src/utils/fees.d.ts.map +1 -0
  51. package/src/types.ts +0 -196
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agoric/fast-usdc",
3
- "version": "0.2.0",
3
+ "version": "0.2.1-upgrade-23-dev-bd79330.0.bd79330",
4
4
  "description": "CLI and library for Fast USDC product",
5
5
  "type": "module",
6
6
  "files": [
@@ -11,29 +11,31 @@
11
11
  "bin": "./src/cli/bin.js",
12
12
  "scripts": {
13
13
  "build": "exit 0",
14
+ "prepack": "yarn run -T prepack-package",
15
+ "postpack": "yarn run -T postpack-package",
14
16
  "test": "ava",
15
17
  "test:c8": "c8 --all ${C8_OPTIONS:-} ava",
16
18
  "test:xs": "exit 0",
17
19
  "lint-fix": "yarn lint:eslint --fix",
18
20
  "lint": "yarn run -T run-s --continue-on-error 'lint:*'",
19
- "lint:eslint": "yarn run -T eslint .",
21
+ "lint:eslint": "node ../../scripts/eslint-repo.mjs .",
20
22
  "lint:types": "yarn run -T tsc"
21
23
  },
22
24
  "devDependencies": {
23
25
  "@fast-check/ava": "^2.0.1",
24
- "ava": "^5.3.0",
26
+ "ava": "^6.4.1",
25
27
  "c8": "^10.1.3",
26
28
  "nano-spawn": "^1.0.2",
27
29
  "ts-blank-space": "^0.6.2"
28
30
  },
29
31
  "dependencies": {
30
- "@agoric/client-utils": "0.2.0",
31
- "@agoric/cosmic-proto": "0.5.0",
32
- "@agoric/ertp": "0.17.0",
33
- "@agoric/internal": "0.4.0",
34
- "@agoric/notifier": "0.7.0",
35
- "@agoric/orchestration": "0.2.0",
36
- "@agoric/zoe": "0.27.0",
32
+ "@agoric/client-utils": "0.2.1-upgrade-23-dev-bd79330.0.bd79330",
33
+ "@agoric/cosmic-proto": "0.5.1-upgrade-23-dev-bd79330.0.bd79330",
34
+ "@agoric/ertp": "0.17.1-upgrade-23-dev-bd79330.0.bd79330",
35
+ "@agoric/internal": "0.4.1-upgrade-23-dev-bd79330.0.bd79330",
36
+ "@agoric/notifier": "0.7.1-upgrade-23-dev-bd79330.0.bd79330",
37
+ "@agoric/orchestration": "0.2.1-upgrade-23-dev-bd79330.0.bd79330",
38
+ "@agoric/zoe": "0.27.1-upgrade-23-dev-bd79330.0.bd79330",
37
39
  "@cosmjs/proto-signing": "^0.36.0",
38
40
  "@cosmjs/stargate": "^0.36.0",
39
41
  "@endo/base64": "^1.0.12",
@@ -79,5 +81,5 @@
79
81
  "engines": {
80
82
  "node": "^20.9 || ^22.11"
81
83
  },
82
- "gitHead": "0922d0447ab8fae9d2d87415964403330b5ca313"
84
+ "gitHead": "bd79330f78dae2faf9cc3d8b10063567700da07b"
83
85
  }
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=bin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["bin.js"],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ export const sendHint: "Now use `agoric wallet send ...` to sign and broadcast the offer.\n";
2
+ export function outputActionAndHint(bridgeAction: BridgeAction, { stdout, stderr }: {
3
+ stdout: Pick<Writable, "write">;
4
+ stderr: Pick<Writable, "write">;
5
+ }, marshaller?: BoardSlottingMarshaller | undefined): void;
6
+ export type BoardSlottingMarshaller = ReturnType<typeof boardSlottingMarshaller>;
7
+ import type { BridgeAction } from '@agoric/smart-wallet/src/smartWallet.js';
8
+ import type { Writable } from 'stream';
9
+ import { boardSlottingMarshaller } from '@agoric/client-utils';
10
+ //# sourceMappingURL=bridge-action.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bridge-action.d.ts","sourceRoot":"","sources":["bridge-action.js"],"names":[],"mappings":"AAsBA,uBACE,qEAAqE,CAAC;AAUjE,kDAPI,YAAY,sBACZ;IACN,MAAM,EAAE,IAAI,CAAC,QAAQ,EAAC,OAAO,CAAC,CAAC;IAC/B,MAAM,EAAE,IAAI,CAAC,QAAQ,EAAC,OAAO,CAAC,CAAC;CAChC,eACO,uBAAuB,GAAG,SAAS,QAS7C;sCA/Ba,UAAU,CAAC,OAAO,uBAAuB,CAAC;kCANzB,yCAAyC;8BAC7C,QAAQ;wCAJK,sBAAsB"}
@@ -2,15 +2,16 @@ import { boardSlottingMarshaller } from '@agoric/client-utils';
2
2
 
3
3
  /**
4
4
  * @import {BridgeAction} from '@agoric/smart-wallet/src/smartWallet.js';
5
+ * @import {Writable} from 'stream';
5
6
  */
6
7
 
7
8
  const defaultMarshaller = boardSlottingMarshaller();
8
9
 
9
- /** @typedef {ReturnType<boardSlottingMarshaller>} BoardSlottingMarshaller */
10
+ /** @typedef {ReturnType<typeof boardSlottingMarshaller>} BoardSlottingMarshaller */
10
11
 
11
12
  /**
12
13
  * @param {BridgeAction} bridgeAction
13
- * @param {Pick<import('stream').Writable,'write'>} stdout
14
+ * @param {Pick<Writable,'write'>} stdout
14
15
  * @param {BoardSlottingMarshaller} marshaller
15
16
  */
16
17
  const outputAction = (bridgeAction, stdout, marshaller) => {
@@ -25,8 +26,8 @@ export const sendHint =
25
26
  /**
26
27
  * @param {BridgeAction} bridgeAction
27
28
  * @param {{
28
- * stdout: Pick<import('stream').Writable,'write'>,
29
- * stderr: Pick<import('stream').Writable,'write'>,
29
+ * stdout: Pick<Writable,'write'>,
30
+ * stderr: Pick<Writable,'write'>,
30
31
  * }} io
31
32
  * @param {BoardSlottingMarshaller | undefined} marshaller
32
33
  */
@@ -0,0 +1,13 @@
1
+ export function initProgram(configHelpers?: typeof configLib, transferHelpers?: typeof transferLib, readFile?: typeof readAsync, writeFile?: typeof writeAsync, mkdir?: typeof mkdirSync, exists?: typeof existsSync, fetch?: typeof globalThis.fetch, stdout?: NodeJS.WriteStream & {
2
+ fd: 1;
3
+ }, stderr?: NodeJS.WriteStream & {
4
+ fd: 2;
5
+ }, env?: NodeJS.ProcessEnv, now?: () => number): Command;
6
+ import * as configLib from './config.js';
7
+ import * as transferLib from './transfer.js';
8
+ import { readFile as readAsync } from 'node:fs/promises';
9
+ import { writeFile as writeAsync } from 'node:fs/promises';
10
+ import { mkdirSync } from 'node:fs';
11
+ import { existsSync } from 'node:fs';
12
+ import { Command } from 'commander';
13
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["cli.js"],"names":[],"mappings":"AA2BO;;;;yDA4EN;2BA1F0B,aAAa;6BACX,eAAe;sCAJrC,kBAAkB;wCAAlB,kBAAkB;0BAP2B,SAAS;2BAAT,SAAS;wBADrC,WAAW"}
package/src/cli/cli.js CHANGED
@@ -1,10 +1,10 @@
1
1
  /* eslint-env node */
2
2
  /* global globalThis */
3
3
  import { Command } from 'commander';
4
- import { existsSync, mkdirSync, readFileSync } from 'fs';
5
- import { fileURLToPath } from 'url';
6
- import { dirname, resolve } from 'path';
7
- import { homedir } from 'os';
4
+ import { existsSync, mkdirSync, readFileSync } from 'node:fs';
5
+ import { fileURLToPath } from 'node:url';
6
+ import { dirname, resolve } from 'node:path';
7
+ import { homedir } from 'node:os';
8
8
  import {
9
9
  readFile as readAsync,
10
10
  writeFile as writeAsync,
@@ -0,0 +1,5 @@
1
+ export function addConfigCommands(program: Command, configHelpers: typeof ConfigHelpers, makeConfigFile: () => File): Command;
2
+ import type { Command } from 'commander';
3
+ import type * as ConfigHelpers from './config.js';
4
+ import type { File } from './util/file.js';
5
+ //# sourceMappingURL=config-commands.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-commands.d.ts","sourceRoot":"","sources":["config-commands.js"],"names":[],"mappings":"AAWO,2CAJI,OAAO,uDAEP,MAAM,IAAI,WAkGpB;6BA1GyB,WAAW;oCAEF,aAAa;0BADzB,gBAAgB"}
@@ -0,0 +1,22 @@
1
+ export function init(configFile: File, options: ConfigOpts, out?: Console, rl?: readline.Interface): Promise<void>;
2
+ export function update(configFile: File, options: Partial<ConfigOpts>, out?: Console): Promise<void>;
3
+ export function show(configFile: File, out?: Console): Promise<void>;
4
+ export type DestinationChain = {
5
+ bech32Prefix: string;
6
+ api: string;
7
+ USDCDenom: string;
8
+ };
9
+ export type ConfigOpts = {
10
+ nobleSeed: string;
11
+ ethSeed: string;
12
+ nobleToAgoricChannel: string;
13
+ nobleApi: string;
14
+ nobleRpc: string;
15
+ ethRpc: string;
16
+ tokenMessengerAddress: string;
17
+ tokenAddress: string;
18
+ destinationChains?: DestinationChain[];
19
+ };
20
+ import type { File } from './util/file.js';
21
+ import * as readline from 'node:readline/promises';
22
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["config.js"],"names":[],"mappings":"AA2BO,iCACM,IAAI,WACJ,UAAU,yDA+BtB;AAEM,mCACM,IAAI,WACJ,OAAO,CAAC,UAAU,CAAC,gCA2B/B;AAEM,iCAA+B,IAAI,gCAazC;+BAtGY;IACT,YAAY,EAAE,MAAM,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAA;CAClB;yBAIU;IACT,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,qBAAqB,EAAE,MAAM,CAAC;IAC9B,YAAY,EAAE,MAAM,CAAA;IACpB,iBAAiB,CAAC,EAAE,gBAAgB,EAAE,CAAA;CACvC;0BAGuB,gBAAgB;0BAzBhB,wBAAwB"}
@@ -0,0 +1,12 @@
1
+ export function delay(ms: any): Promise<any>;
2
+ export function addLPCommands(program: Command, { fetch, smartWalletKit, stderr, stdout, env, now }: {
3
+ fetch?: Window["fetch"];
4
+ smartWalletKit?: SmartWalletKit;
5
+ stdout: typeof process.stdout;
6
+ stderr: typeof process.stderr;
7
+ env: typeof process.env;
8
+ now: typeof Date.now;
9
+ }): Command;
10
+ import type { Command } from 'commander';
11
+ import type { SmartWalletKit } from '@agoric/client-utils';
12
+ //# sourceMappingURL=lp-commands.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lp-commands.d.ts","sourceRoot":"","sources":["lp-commands.js"],"names":[],"mappings":"AA2BO,6CAAmE;AAkCnE,uCAVI,OAAO,uDACP;IACN,KAAK,CAAC,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;IACvB,cAAc,CAAC,EAAE,cAAc,CAAC;IACjC,MAAM,EAAE,OAAO,OAAO,CAAC,MAAM,CAAC;IAC9B,MAAM,EAAE,OAAO,OAAO,CAAC,MAAM,CAAC;IAC9B,GAAG,EAAE,OAAO,OAAO,CAAC,GAAG,CAAC;IACxB,GAAG,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC;CACtB,WA0GH;6BAnKyB,WAAW;oCAMJ,sBAAsB"}
@@ -5,6 +5,8 @@
5
5
  * @import {OfferSpec} from '@agoric/smart-wallet/src/offers.js';
6
6
  * @import {ExecuteOfferAction} from '@agoric/smart-wallet/src/smartWallet.js';
7
7
  * @import {USDCProposalShapes} from '../pool-share-math.js';
8
+ * @import {PoolMetrics} from '../types.js';
9
+ * @import {SmartWalletKit} from '@agoric/client-utils';
8
10
  */
9
11
 
10
12
  import {
@@ -50,7 +52,7 @@ const parseUSDCAmount = (amountString, usdc) => {
50
52
  * @param {Command} program
51
53
  * @param {{
52
54
  * fetch?: Window['fetch'];
53
- * smartWalletKit?: import('@agoric/client-utils').SmartWalletKit;
55
+ * smartWalletKit?: SmartWalletKit;
54
56
  * stdout: typeof process.stdout;
55
57
  * stderr: typeof process.stderr;
56
58
  * env: typeof process.env;
@@ -97,7 +99,9 @@ export const addLPCommands = (
97
99
 
98
100
  const usdcAmount = parseUSDCAmount(opts.amount, usdc);
99
101
 
100
- const metrics = await swk.readPublished('fastUsdc.poolMetrics');
102
+ const metrics = /** @type {PoolMetrics} */ (
103
+ await swk.readPublished('fastUsdc.poolMetrics')
104
+ );
101
105
  const fastLPAmount = floorDivideBy(usdcAmount, metrics.shareWorth);
102
106
 
103
107
  const offer = Offers.fastUsdc.Deposit(swk.agoricNames, {
@@ -140,7 +144,9 @@ export const addLPCommands = (
140
144
 
141
145
  const usdcAmount = parseUSDCAmount(opts.amount, usdc);
142
146
 
143
- const metrics = await swk.readPublished('fastUsdc.poolMetrics');
147
+ const metrics = /** @type {PoolMetrics} */ (
148
+ await swk.readPublished('fastUsdc.poolMetrics')
149
+ );
144
150
  const fastLPAmount = ceilDivideBy(usdcAmount, metrics.shareWorth);
145
151
 
146
152
  const offer = Offers.fastUsdc.Withdraw(swk.agoricNames, {
@@ -0,0 +1,10 @@
1
+ export function delay(ms: any): Promise<any>;
2
+ export function addOperatorCommands(program: Command, { fetch, stderr, stdout, env, now }: {
3
+ fetch: Window["fetch"];
4
+ stdout: typeof process.stdout;
5
+ stderr: typeof process.stderr;
6
+ env: typeof process.env;
7
+ now: typeof Date.now;
8
+ }): Command;
9
+ import type { Command } from 'commander';
10
+ //# sourceMappingURL=operator-commands.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operator-commands.d.ts","sourceRoot":"","sources":["operator-commands.js"],"names":[],"mappings":"AAkBO,6CAAmE;AAwBnE,6CATI,OAAO,uCACP;IACN,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;IACvB,MAAM,EAAE,OAAO,OAAO,CAAC,MAAM,CAAC;IAC9B,MAAM,EAAE,OAAO,OAAO,CAAC,MAAM,CAAC;IAC9B,GAAG,EAAE,OAAO,OAAO,CAAC,GAAG,CAAC;IACxB,GAAG,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC;CACtB,WAsGH;6BA5IyB,WAAW"}
@@ -0,0 +1,9 @@
1
+ export function transfer(configFile: File, amount: string, EUD: string, out?: typeof globalThis.console, fetch?: typeof globalThis.fetch, vstorage?: VStorage, nobleSigner?: {
2
+ signer: SigningStargateClient;
3
+ address: string;
4
+ }, ethProvider?: ethProvider, env?: typeof process.env, setTimeout?: typeof globalThis.setTimeout): Promise<void>;
5
+ import type { File } from './util/file.js';
6
+ import type { VStorage } from '@agoric/client-utils';
7
+ import type { SigningStargateClient } from '@cosmjs/stargate';
8
+ import type { JsonRpcProvider as ethProvider } from 'ethers';
9
+ //# sourceMappingURL=transfer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transfer.d.ts","sourceRoot":"","sources":["transfer.js"],"names":[],"mappings":"AAsCO,qCAXI,IAAI,UACJ,MAAM,OACN,MAAM,QACN,OAAO,UAAU,CAAC,OAAO,UACzB,OAAO,UAAU,CAAC,KAAK,aACvB,QAAQ,gBACR;IAAC,MAAM,EAAE,qBAAqB,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAC,gBAChD,WAAW,QACX,OAAO,OAAO,CAAC,GAAG,eAClB,OAAO,UAAU,CAAC,UAAU,iBAmHtC;0BApIwB,gBAAgB;8BAGX,sBAAsB;2CACT,kBAAkB;oDACT,QAAQ"}
@@ -16,7 +16,10 @@ import {
16
16
  } from './util/noble.js';
17
17
  import { queryUSDCBalance } from './util/bank.js';
18
18
 
19
- /** @import { File } from './util/file.js' */
19
+ /**
20
+ * @import { File } from './util/file.js'
21
+ * @import {ConfigOpts} from './config.js';
22
+ */
20
23
  /** @import { VStorage } from '@agoric/client-utils' */
21
24
  /** @import { SigningStargateClient } from '@cosmjs/stargate' */
22
25
  /** @import { JsonRpcProvider as ethProvider } from 'ethers' */
@@ -45,9 +48,7 @@ export const transfer = async (
45
48
  env = process.env,
46
49
  setTimeout = globalThis.setTimeout,
47
50
  ) => {
48
- const execute = async (
49
- /** @type {import('./config.js').ConfigOpts} */ config,
50
- ) => {
51
+ const execute = async (/** @type {ConfigOpts} */ config) => {
51
52
  const netConfig = await fetchEnvNetworkConfig({ env, fetch });
52
53
  vstorage ||= makeVStorage(
53
54
  { fetch },
@@ -0,0 +1,3 @@
1
+ export function queryFastUSDCLocalChainAccount(vstorage: VStorage, out?: Console): Promise<any>;
2
+ import type { VStorage } from '@agoric/client-utils';
3
+ //# sourceMappingURL=agoric.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agoric.d.ts","sourceRoot":"","sources":["agoric.js"],"names":[],"mappings":"AAEO,yDACM,QAAQ,+BAOpB;8BAV6B,sBAAsB"}
@@ -0,0 +1,2 @@
1
+ export function queryUSDCBalance(address: string, api: string, denom: string, fetch: typeof globalThis.fetch): Promise<bigint>;
2
+ //# sourceMappingURL=bank.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bank.d.ts","sourceRoot":"","sources":["bank.js"],"names":[],"mappings":"AAAO,0CACM,MAAM,OACN,MAAM,SACN,MAAM,SACN,OAAO,UAAU,CAAC,KAAK,mBAOnC"}
@@ -0,0 +1,5 @@
1
+ export function encodeBech32Address(address: string): string;
2
+ export function makeProvider(rpc: string): ethers.JsonRpcProvider;
3
+ export function depositForBurn(provider: ethers.JsonRpcProvider, ethSeed: string, tokenMessengerAddress: string, tokenAddress: string, destination: string, amount: string, out?: Console): Promise<void>;
4
+ import { ethers } from 'ethers';
5
+ //# sourceMappingURL=cctp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cctp.d.ts","sourceRoot":"","sources":["cctp.js"],"names":[],"mappings":"AAUO,6CAHI,MAAM,GACJ,MAAM,CAUlB;AAQM,kCAAiC,MAAM,0BACb;AAM1B,yCACM,MAAM,CAAC,eAAe,WACtB,MAAM,yBACN,MAAM,gBACN,MAAM,eACN,MAAM,UACN,MAAM,gCA+BlB;uBApEsB,QAAQ"}
@@ -0,0 +1,12 @@
1
+ export function makeFile(path: string, readFile: typeof readAsync, writeFile: typeof writeAsync, mkdir: typeof mkdirSync, pathExists: typeof existsSync): {
2
+ read: () => Promise<string>;
3
+ write: (data: string) => Promise<void>;
4
+ exists: () => boolean;
5
+ path: string;
6
+ };
7
+ export type File = ReturnType<typeof makeFile>;
8
+ import type { readFile as readAsync } from 'node:fs/promises';
9
+ import type { writeFile as writeAsync } from 'node:fs/promises';
10
+ import type { mkdirSync } from 'node:fs';
11
+ import type { existsSync } from 'node:fs';
12
+ //# sourceMappingURL=file.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file.d.ts","sourceRoot":"","sources":["file.js"],"names":[],"mappings":"AAOO,+BACM,MAAM;;kBAQe,MAAM;;;EAWvC;mBAEa,UAAU,CAAC,OAAO,QAAQ,CAAC;2CA3BE,kBAAkB;6CAChB,kBAAkB;+BAChC,SAAS;gCACR,SAAS"}
@@ -1,4 +1,4 @@
1
- import { dirname } from 'path';
1
+ import { dirname } from 'node:path';
2
2
 
3
3
  /** @import { readFile as readAsync } from 'node:fs/promises' */
4
4
  /** @import { writeFile as writeAsync } from 'node:fs/promises' */
@@ -0,0 +1,11 @@
1
+ export function makeSigner(nobleSeed: string, nobleRpc: string, out?: Console): Promise<{
2
+ address: string;
3
+ signer: SigningStargateClient;
4
+ }>;
5
+ export function registerFwdAccount(nobleSigner: SigningStargateClient, nobleAddress: string, nobleToAgoricChannel: string, recipient: string, out?: Console): Promise<string>;
6
+ export function queryForwardingAccount(nobleApi: string, nobleToAgoricChannel: string, agoricAddr: string, out?: Console, fetch?: typeof globalThis.fetch): Promise<{
7
+ address: string;
8
+ exists: boolean;
9
+ }>;
10
+ import { SigningStargateClient } from '@cosmjs/stargate';
11
+ //# sourceMappingURL=noble.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"noble.d.ts","sourceRoot":"","sources":["noble.js"],"names":[],"mappings":"AAMO,sCACM,MAAM,YACN,MAAM;;;GAoBlB;AAiBM,gDACM,qBAAqB,gBACrB,MAAM,wBACN,MAAM,aACN,MAAM,kCA+BlB;AAEM,iDACM,MAAM,wBACN,MAAM,cACN,MAAM;;;GAwBlB;sCA1GiD,kBAAkB"}
@@ -0,0 +1,51 @@
1
+ export namespace Offers {
2
+ namespace fastUsdc {
3
+ export { makeDepositOffer as Deposit };
4
+ export { makeWithdrawOffer as Withdraw };
5
+ }
6
+ }
7
+ /**
8
+ * @import {USDCProposalShapes} from './pool-share-math.js';
9
+ * @import {AgoricNamesRemotes} from '@agoric/vats/tools/board-utils.js';
10
+ * @import {OfferSpec} from '@agoric/smart-wallet/src/offers.js';
11
+ * @import {OfferMaker} from '@agoric/smart-wallet/src/types.js';
12
+ */
13
+ /**
14
+ * @param {Pick<
15
+ * AgoricNamesRemotes,
16
+ * 'brand'
17
+ * >} agoricNames
18
+ * @param {object} opts
19
+ * @param {string} opts.offerId
20
+ * @param {bigint} opts.fastLPAmount
21
+ * @param {bigint} opts.usdcAmount
22
+ * @returns {OfferSpec & {proposal: USDCProposalShapes['deposit']}}
23
+ */
24
+ declare function makeDepositOffer({ brand }: Pick<AgoricNamesRemotes, "brand">, { offerId, fastLPAmount, usdcAmount }: {
25
+ offerId: string;
26
+ fastLPAmount: bigint;
27
+ usdcAmount: bigint;
28
+ }): OfferSpec & {
29
+ proposal: USDCProposalShapes["deposit"];
30
+ };
31
+ /**
32
+ * @param {Pick<
33
+ * AgoricNamesRemotes,
34
+ * 'brand'
35
+ * >} agoricNames
36
+ * @param {object} opts
37
+ * @param {string} opts.offerId
38
+ * @param {bigint} opts.fastLPAmount
39
+ * @param {bigint} opts.usdcAmount
40
+ * @returns {OfferSpec}
41
+ */
42
+ declare function makeWithdrawOffer({ brand }: Pick<AgoricNamesRemotes, "brand">, { offerId, fastLPAmount, usdcAmount }: {
43
+ offerId: string;
44
+ fastLPAmount: bigint;
45
+ usdcAmount: bigint;
46
+ }): OfferSpec;
47
+ import type { AgoricNamesRemotes } from '@agoric/vats/tools/board-utils.js';
48
+ import type { OfferSpec } from '@agoric/smart-wallet/src/offers.js';
49
+ import type { USDCProposalShapes } from './pool-share-math.js';
50
+ export {};
51
+ //# sourceMappingURL=clientSupport.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clientSupport.d.ts","sourceRoot":"","sources":["clientSupport.js"],"names":[],"mappings":";;;;;;AAGA;;;;;GAKG;AAEH;;;;;;;;;;GAUG;AACH,6CAVW,IAAI,CACd,kBAAsB,EACtB,OAAW,CACR,yCAED;IAAqB,OAAO,EAApB,MAAM;IACO,YAAY,EAAzB,MAAM;IACO,UAAU,EAAvB,MAAM;CACd,GAAU,SAAS,GAAG;IAAC,QAAQ,EAAE,kBAAkB,CAAC,SAAS,CAAC,CAAA;CAAC,CA6BjE;AAED;;;;;;;;;;GAUG;AACH,8CAVW,IAAI,CACd,kBAAsB,EACtB,OAAW,CACR,yCAED;IAAqB,OAAO,EAApB,MAAM;IACO,YAAY,EAAzB,MAAM;IACO,UAAU,EAAvB,MAAM;CACd,GAAU,SAAS,CA4BpB;wCAlFmC,mCAAmC;+BAC5C,oCAAoC;wCAF3B,sBAAsB"}
@@ -3,18 +3,21 @@ import { assertAllDefined } from '@agoric/internal';
3
3
 
4
4
  /**
5
5
  * @import {USDCProposalShapes} from './pool-share-math.js';
6
+ * @import {AgoricNamesRemotes} from '@agoric/vats/tools/board-utils.js';
7
+ * @import {OfferSpec} from '@agoric/smart-wallet/src/offers.js';
8
+ * @import {OfferMaker} from '@agoric/smart-wallet/src/types.js';
6
9
  */
7
10
 
8
11
  /**
9
12
  * @param {Pick<
10
- * import('@agoric/vats/tools/board-utils.js').AgoricNamesRemotes,
13
+ * AgoricNamesRemotes,
11
14
  * 'brand'
12
15
  * >} agoricNames
13
16
  * @param {object} opts
14
17
  * @param {string} opts.offerId
15
18
  * @param {bigint} opts.fastLPAmount
16
19
  * @param {bigint} opts.usdcAmount
17
- * @returns {import('@agoric/smart-wallet/src/offers.js').OfferSpec & {proposal: USDCProposalShapes['deposit']}}
20
+ * @returns {OfferSpec & {proposal: USDCProposalShapes['deposit']}}
18
21
  */
19
22
  const makeDepositOffer = ({ brand }, { offerId, fastLPAmount, usdcAmount }) => {
20
23
  assertAllDefined({ offerId, fastLPAmount, usdcAmount });
@@ -47,14 +50,14 @@ const makeDepositOffer = ({ brand }, { offerId, fastLPAmount, usdcAmount }) => {
47
50
 
48
51
  /**
49
52
  * @param {Pick<
50
- * import('@agoric/vats/tools/board-utils.js').AgoricNamesRemotes,
53
+ * AgoricNamesRemotes,
51
54
  * 'brand'
52
55
  * >} agoricNames
53
56
  * @param {object} opts
54
57
  * @param {string} opts.offerId
55
58
  * @param {bigint} opts.fastLPAmount
56
59
  * @param {bigint} opts.usdcAmount
57
- * @returns {import('@agoric/smart-wallet/src/offers.js').OfferSpec}
60
+ * @returns {OfferSpec}
58
61
  */
59
62
  const makeWithdrawOffer = (
60
63
  { brand },
@@ -87,7 +90,7 @@ const makeWithdrawOffer = (
87
90
  /**
88
91
  * @satisfies {Record<
89
92
  * string,
90
- * Record<string, import('@agoric/smart-wallet/src/types.js').OfferMaker>
93
+ * Record<string, OfferMaker>
91
94
  * >}
92
95
  */
93
96
  export const Offers = {
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Status values for FastUSDC. Includes states for advancing and settling.
3
+ */
4
+ export type TxStatus = (typeof TxStatus)[keyof typeof TxStatus];
5
+ export namespace TxStatus {
6
+ let Observed: "OBSERVED";
7
+ let Advancing: "ADVANCING";
8
+ let Advanced: "ADVANCED";
9
+ let AdvanceFailed: "ADVANCE_FAILED";
10
+ let AdvanceSkipped: "ADVANCE_SKIPPED";
11
+ let Disbursed: "DISBURSED";
12
+ let ForwardedSkipped: "FORWARD_SKIPPED";
13
+ let Forwarded: "FORWARDED";
14
+ let ForwardFailed: "FORWARD_FAILED";
15
+ }
16
+ export namespace TerminalTxStatus {
17
+ let FORWARDED: boolean;
18
+ let FORWARD_FAILED: boolean;
19
+ let DISBURSED: boolean;
20
+ }
21
+ /**
22
+ * Status values for the StatusManager while an advance is being processed.
23
+ */
24
+ export type PendingTxStatus = (typeof PendingTxStatus)[keyof typeof PendingTxStatus];
25
+ export namespace PendingTxStatus {
26
+ let Advancing_1: "ADVANCING";
27
+ export { Advancing_1 as Advancing };
28
+ let AdvanceFailed_1: "ADVANCE_FAILED";
29
+ export { AdvanceFailed_1 as AdvanceFailed };
30
+ let Advanced_1: "ADVANCED";
31
+ export { Advanced_1 as Advanced };
32
+ let AdvanceSkipped_1: "ADVANCE_SKIPPED";
33
+ export { AdvanceSkipped_1 as AdvanceSkipped };
34
+ }
35
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["constants.js"],"names":[],"mappings":";;;uBAGU,CAAC,OAAO,QAAQ,EAAE,MAAM,OAAO,QAAQ,CAAC;;;;;;;;;;;;;;;;;;;;8BAkCxC,CAAC,OAAO,eAAe,EAAE,MAAM,OAAO,eAAe,CAAC"}
package/src/main.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from "./types.js";
2
+ //# sourceMappingURL=main.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["main.js"],"names":[],"mappings":""}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @import {Zone} from '@agoric/zone';
3
+ * @import {CctpTxEvidence, RiskAssessment} from '@agoric/fast-usdc/src/types.js';
4
+ */
5
+ /** Name in the invitation purse (keyed also by this contract instance) */
6
+ export const INVITATION_MAKERS_DESC: "oracle operator invitation";
7
+ export namespace OperatorKitI {
8
+ let admin: import("@endo/patterns").InterfaceGuard<{
9
+ disable: import("@endo/patterns").MethodGuard;
10
+ }>;
11
+ let invitationMakers: import("@endo/patterns").InterfaceGuard<{
12
+ SubmitEvidence: import("@endo/patterns").MethodGuard;
13
+ }>;
14
+ let operator: import("@endo/patterns").InterfaceGuard<{
15
+ submitEvidence: import("@endo/patterns").MethodGuard;
16
+ getStatus: import("@endo/patterns").MethodGuard;
17
+ }>;
18
+ }
19
+ //# sourceMappingURL=operator-kit-interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operator-kit-interface.d.ts","sourceRoot":"","sources":["operator-kit-interface.js"],"names":[],"mappings":"AAGA;;;GAGG;AAEH,0EAA0E;AAC1E,qCAAsC,4BAA4B,CAAC"}
@@ -0,0 +1,73 @@
1
+ export function makeParity(numeratorBrand: Brand<"nat">, denominatorBrand: Brand<"nat">): import("@agoric/ertp/src/ratio.js").Ratio;
2
+ export function depositCalc(shareWorth: ShareWorth, { give, want }: USDCProposalShapes["deposit"]): {
3
+ payouts: {
4
+ PoolShare: Amount<"nat">;
5
+ };
6
+ shareWorth: ShareWorth;
7
+ };
8
+ export function checkPoolBalance(poolAlloc: Allocation, shareWorth: ShareWorth, encumberedBalance: Amount<"nat">): {
9
+ unencumberedBalance: import("@agoric/ertp").AnyAmount;
10
+ grossBalance: import("@agoric/ertp").AnyAmount;
11
+ };
12
+ export function withdrawCalc(shareWorth: ShareWorth, { give, want }: USDCProposalShapes["withdraw"], poolAlloc: Allocation, encumberedBalance?: Amount<"nat">): {
13
+ shareWorth: ShareWorth;
14
+ payouts: {
15
+ USDC: Amount<"nat">;
16
+ };
17
+ };
18
+ export function withFees(shareWorth: ShareWorth, fees: Amount<"nat">): import("@agoric/ertp/src/ratio.js").Ratio;
19
+ export function borrowCalc(requested: Amount<"nat">, poolSeatAllocation: Amount<"nat">, encumberedBalance: Amount<"nat">, poolStats: PoolStats): {
20
+ encumberedBalance: import("@agoric/ertp").NatAmount;
21
+ poolStats: {
22
+ totalBorrows: import("@agoric/ertp").NatAmount;
23
+ totalContractFees: Amount<"nat">;
24
+ totalPoolFees: Amount<"nat">;
25
+ totalRepays: Amount<"nat">;
26
+ };
27
+ };
28
+ export function repayCalc(shareWorth: ShareWorth, split: RepayAmountKWR, encumberedBalance: Amount<"nat">, poolStats: PoolStats): {
29
+ shareWorth: import("@agoric/ertp/src/ratio.js").Ratio;
30
+ encumberedBalance: import("@agoric/ertp").NatAmount;
31
+ poolStats: {
32
+ totalRepays: import("@agoric/ertp").NatAmount;
33
+ totalPoolFees: import("@agoric/ertp").NatAmount;
34
+ totalContractFees: import("@agoric/ertp").NatAmount;
35
+ totalBorrows: Amount<"nat">;
36
+ };
37
+ };
38
+ /**
39
+ * Invariant: shareWorth is the pool balance divided by shares outstanding.
40
+ *
41
+ * Use `makeParity(USDC, PoolShares)` for an initial value.
42
+ */
43
+ export type ShareWorth = Ratio;
44
+ export type USDCProposalShapes = {
45
+ deposit: {
46
+ give: {
47
+ USDC: Amount<"nat">;
48
+ };
49
+ want: {
50
+ PoolShare: Amount<"nat">;
51
+ };
52
+ };
53
+ withdraw: {
54
+ give: {
55
+ PoolShare: Amount<"nat">;
56
+ };
57
+ want: {
58
+ USDC: Amount<"nat">;
59
+ };
60
+ };
61
+ withdrawFees: {
62
+ want: {
63
+ USDC: Amount<"nat">;
64
+ };
65
+ };
66
+ };
67
+ import type { Brand } from '@agoric/ertp';
68
+ import type { Amount } from '@agoric/ertp';
69
+ import type { Allocation } from '@agoric/zoe';
70
+ import type { PoolStats } from './types.js';
71
+ import type { RepayAmountKWR } from './utils/fees.js';
72
+ import type { Ratio } from '@agoric/ertp';
73
+ //# sourceMappingURL=pool-share-math.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pool-share-math.d.ts","sourceRoot":"","sources":["pool-share-math.js"],"names":[],"mappings":"AAiCO,2CAHI,MAAM,KAAK,CAAC,oBACZ,MAAM,KAAK,CAAC,6CAKtB;AA2CM,wCAJI,UAAU,kBACV,kBAAkB,CAAC,SAAS,CAAC,GAC3B;IAAE,OAAO,EAAE;QAAE,SAAS,EAAE,OAAO,KAAK,CAAC,CAAA;KAAE,CAAC;IAAC,UAAU,EAAE,UAAU,CAAA;CAAE,CAmB7E;AAeM,4CAJI,UAAU,cACV,UAAU,qBACV,OAAO,KAAK,CAAC;;;EAcvB;AAWM,yCANI,UAAU,kBACV,kBAAkB,CAAC,UAAU,CAAC,aAC9B,UAAU,sBACV,OAAO,KAAK,CAAC,GACX;IAAE,UAAU,EAAE,UAAU,CAAC;IAAC,OAAO,EAAE;QAAE,IAAI,EAAE,OAAO,KAAK,CAAC,CAAA;KAAE,CAAA;CAAC,CAgCvE;AAMM,qCAHI,UAAU,QACV,OAAO,KAAK,CAAC,6CAKvB;AAUM,sCANI,OAAO,KAAK,CAAC,sBACb,OAAO,KAAK,CAAC,qBACb,OAAO,KAAK,CAAC,aACb,SAAS;;;;;;;;EAoBnB;AASM,sCANI,UAAU,SACV,cAAc,qBACd,OAAO,KAAK,CAAC,aACb,SAAS;;;;;;;;;EAoBnB;;;;;;yBA1MY,KAAK;iCAeL;IACR,OAAO,EAAE;QACP,IAAI,EAAE;YAAE,IAAI,EAAE,OAAO,KAAK,CAAC,CAAA;SAAE,CAAC;QAC9B,IAAI,EAAE;YAAE,SAAS,EAAE,OAAO,KAAK,CAAC,CAAA;SAAE,CAAA;KACnC,CAAC;IACF,QAAQ,EAAE;QACR,IAAI,EAAE;YAAE,SAAS,EAAE,OAAO,KAAK,CAAC,CAAA;SAAE,CAAA;QAClC,IAAI,EAAE;YAAE,IAAI,EAAE,OAAO,KAAK,CAAC,CAAA;SAAE,CAAC;KAC/B,CAAC;IACF,YAAY,EAAE;QACZ,IAAI,EAAE;YAAE,IAAI,EAAE,OAAO,KAAK,CAAC,CAAA;SAAE,CAAA;KAC9B,CAAA;CACF;2BAtCoE,cAAc;4BAAd,cAAc;gCACzD,aAAa;+BACd,YAAY;oCACP,iBAAiB;2BAHsB,cAAc"}