Skip to content

Commit

Permalink
feat: reference custom proto Msg builder in contract
Browse files Browse the repository at this point in the history
  • Loading branch information
0xpatrickdev committed Oct 26, 2024
1 parent 0908ca5 commit ce1a17a
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ jobs:
- uses: actions/setup-node@v4
- run: corepack enable
- run: yarn install
- run: yarn build
- run: yarn lint
unit:
runs-on: ubuntu-latest
Expand Down
3 changes: 2 additions & 1 deletion contract/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@
"@endo/far": "^1.1.4",
"@endo/init": "^1.1.3",
"@endo/marshal": "^1.5.2",
"@endo/patterns": "^1.4.2"
"@endo/patterns": "^1.4.2",
"dapp-agoric-orca-proto": "workspace:*"
},
"ava": {
"extensions": {
Expand Down
26 changes: 26 additions & 0 deletions contract/test/custom-proto.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { test } from './prepare-test-env-ava.js';
import { MsgCreateThought } from '../../protos/dist/cyber/dmn/v1beta1/tx.js';

test('custom proto', t => {
const msg = MsgCreateThought.toProtoMsg({
name: 'test',
particle: 'test',
program: 'test',
trigger: {
block: 1n,
period: 1n,
},
load: {
gasPrice: {
denom: 'ubld',
amount: '1',
},
input: 'test',
},
});

t.like(msg, {
typeUrl: '/cyber.dmn.v1beta1.MsgCreateThought',
});
t.true(msg.value instanceof Uint8Array);
});
3 changes: 2 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13242,6 +13242,7 @@ __metadata:
"@typescript-eslint/parser": "npm:^7.15.0"
agoric: "npm:^0.22.0-u17.1"
ava: "npm:^5.3.1"
dapp-agoric-orca-proto: "workspace:*"
eslint: "npm:^8.57.0"
eslint-config-airbnb-base: "npm:^15.0.0"
eslint-config-jessie: "npm:^0.0.6"
Expand All @@ -13265,7 +13266,7 @@ __metadata:
languageName: unknown
linkType: soft

"dapp-agoric-orca-proto@workspace:protos":
"dapp-agoric-orca-proto@workspace:*, dapp-agoric-orca-proto@workspace:protos":
version: 0.0.0-use.local
resolution: "dapp-agoric-orca-proto@workspace:protos"
dependencies:
Expand Down

0 comments on commit ce1a17a

Please sign in to comment.