Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/ag-trade/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "0.1.0",
"type": "module",
"scripts": {
"postinstall": "patch-package",
"lint-fix": "eslint --fix .",
"lint": "run-s --continue-on-error lint:*",
"lint:js": "eslint .",
Expand All @@ -16,6 +17,8 @@
"ava": "^5.3.1",
"eslint": "^8.36.0",
"npm-run-all": "^4.1.5",
"patch-package": "^8.0.0",
"postinstall-postinstall": "^2.1.0",
"typescript": "~5.1.6"
},
"ava": {
Expand All @@ -24,16 +27,17 @@
]
},
"dependencies": {
"@agoric/cosmic-proto": "^0.3.0",
"@cosmjs/amino": "^0.31.3",
"@cosmjs/crypto": "^0.31.3",
"@cosmjs/encoding": "^0.31.3",
"@cosmjs/proto-signing": "^0.31.3",
"@cosmjs/stargate": "^0.31.3",
"@cosmjs/tendermint-rpc": "^0.31.3",
"@endo/far": "^0.2.21",
"@endo/marshal": "^0.8.9",
"@endo/patterns": "^0.2.5",
"better-sqlite3": "^8.5.2",
"cosmic-proto-es": "../cosmic-proto-es/",
"google-auth-library": "^9.0.0",
"google-spreadsheet": "^4.0.2",
"minimatch": "^9.0.3",
Expand Down
21 changes: 21 additions & 0 deletions packages/ag-trade/patches/@protobufjs+inquire+1.1.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
diff --git a/node_modules/@protobufjs/inquire/index.js b/node_modules/@protobufjs/inquire/index.js
index 33778b5..c343370 100644
--- a/node_modules/@protobufjs/inquire/index.js
+++ b/node_modules/@protobufjs/inquire/index.js
@@ -1,6 +1,7 @@
"use strict";
module.exports = inquire;

+
/**
* Requires a module only if available.
* @memberof util
@@ -9,7 +10,7 @@ module.exports = inquire;
*/
function inquire(moduleName) {
try {
- var mod = eval("quire".replace(/^/,"re"))(moduleName); // eslint-disable-line no-eval
+ var mod = NOeval("quire".replace(/^/,"re"))(moduleName); // eslint-disable-line no-eval
if (mod && (mod.length || Object.keys(mod).length))
return mod;
} catch (e) {} // eslint-disable-line no-empty
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/node_modules/cosmic-proto-es/node_modules/@bufbuild/protobuf/package.json b/node_modules/cosmic-proto-es/node_modules/@bufbuild/protobuf/package.json
index 81b39d9..177f75e 100644
--- a/node_modules/cosmic-proto-es/node_modules/@bufbuild/protobuf/package.json
+++ b/node_modules/cosmic-proto-es/node_modules/@bufbuild/protobuf/package.json
@@ -27,7 +27,7 @@
".": {
"module": "./dist/esm/index.js",
"require": "./dist/cjs/index.js",
- "import": "./dist/proxy/index.js"
+ "import": "./dist/esm/index.js"
}
},
"devDependencies": {
10 changes: 8 additions & 2 deletions packages/ag-trade/src/agoricZone.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @ts-check
import { MsgWalletSpendAction } from '@agoric/cosmic-proto/swingset/msgs.js';
import { MsgWalletSpendAction } from 'cosmic-proto-es/swingset/msgs.js';

import { Registry } from '@cosmjs/proto-signing';
import { GasPrice, defaultRegistryTypes } from '@cosmjs/stargate';
Expand All @@ -20,10 +20,16 @@ export const SwingsetMsgs = {
},
};

const MsgWalletSpendAction_pbjs = {
create: properties => new MsgWalletSpendAction(properties),
encode: message => /** @type {any} */ ({ finish: () => message.toBinary() }),
decode: bytes => MsgWalletSpendAction.fromBinary(bytes),
};

export const SwingsetRegistry = new Registry([
...defaultRegistryTypes,
// XXX should this list be "upstreamed" to @agoric/cosmic-proto?
[SwingsetMsgs.MsgWalletSpendAction.typeUrl, MsgWalletSpendAction],
[SwingsetMsgs.MsgWalletSpendAction.typeUrl, MsgWalletSpendAction_pbjs],
]);

// https://community.agoric.com/t/network-change-instituting-fees-on-the-agoric-chain-to-mitigate-spam-transactions/109/2
Expand Down
1 change: 1 addition & 0 deletions packages/ag-trade/src/cosmosFetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { Far } from '@endo/far';
import { makeHttpClient, makeLCD } from './httpClient.js';

export const make = _powers => {
console.log('cosmosFetch worker');
/** @param { string } rpcURL */
const makeRPCClient = rpcURL => makeHttpClient(rpcURL, globalThis.fetch);
/** @param { string } apiURL */
Expand Down
4 changes: 3 additions & 1 deletion packages/ag-trade/src/smartWallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ import { batchVstorageQuery, makeVStorage } from './batchQuery.js';
export const makeWalletActionMessage = (address, spendAction) => ({
typeUrl: SwingsetMsgs.MsgWalletSpendAction.typeUrl,
value: {
owner: toBase64(toAccAddress(address)),
// probufjs: owner: toBase64(toAccAddress(address)),
owner: toAccAddress(address),
spendAction,
},
});
Expand Down Expand Up @@ -316,6 +317,7 @@ const makeQueryKit = lcd => {
/** @typedef {Awaited<ReturnType<typeof makeQueryKit>>['query']} QueryTool */

export const make = () => {
console.log('smartWallet worker');
/** @param {number} ms */
const delay = ms => new Promise(resolve => setTimeout(resolve, ms));

Expand Down
Loading