Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module client and smart contract module schema #262

Merged
merged 12 commits into from
Sep 18, 2023
20 changes: 11 additions & 9 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@ name: Build, lint and typecheck examples
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main, release** ]
branches: [main, release**]
pull_request:
branches: [ main, release** ]
branches: [main, release**]
# Don't run on draft PR's, see: https://github.com/orgs/community/discussions/25722#discussioncomment-3248917
types: [ opened, synchronize, reopened, ready_for_review ]
types: [opened, synchronize, reopened, ready_for_review]
# Allows us to run the workflow manually from the Actions tab
workflow_dispatch:


env:
NODE_VERSION: 18.16.0
RUST_VERSION: 1.65
Expand All @@ -24,7 +23,7 @@ jobs:
steps:
- uses: actions/checkout@v3
with:
submodules: "recursive"
submodules: 'recursive'

- uses: actions/setup-node@v3
with:
Expand Down Expand Up @@ -52,7 +51,7 @@ jobs:
steps:
- uses: actions/checkout@v3
with:
submodules: "recursive"
submodules: 'recursive'

- uses: actions/setup-node@v3
with:
Expand Down Expand Up @@ -148,7 +147,10 @@ jobs:
run:
working-directory: packages/common
steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v3
with:
submodules: 'recursive'

- uses: actions/setup-node@v3
with:
Expand Down Expand Up @@ -306,7 +308,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: "recursive"
submodules: 'recursive'

- name: Install formatter
run: |
Expand All @@ -327,7 +329,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: "recursive"
submodules: 'recursive'

- name: Install clippy
run: |
Expand Down
19 changes: 14 additions & 5 deletions examples/ccd-js-gen/wCCD/client-tokenMetadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,26 @@ const contractAddress: SDK.ContractAddress = {
/* eslint-disable import/no-unresolved */
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const wCCDModule = await import('./lib/wCCD').catch((e) => {
const wCCDContractClient = await import('./lib/cis2_wCCD').catch((e) => {
/* eslint-enable import/no-unresolved */
console.error(
'\nFailed to load the generated wCCD module, did you run the `generate` script?\n'
);
throw e;
});

const parameter = '010000'; // First 2 bytes for number of tokens to query, 1 byte for the token ID.
const contract = new wCCDModule.Cis2WCCD(grpcClient, contractAddress);
const parameter = SDK.Parameter.fromHexString('010000'); // First 2 bytes for number of tokens to query, 1 byte for the token ID.
const contract = await wCCDContractClient.create(
grpcClient,
contractAddress
);

const responseHex = await contract.dryRun.tokenMetadata(parameter);
console.log({ responseHex });
const result = await wCCDContractClient.dryRunTokenMetadata(
contract,
new SDK.AccountAddress(
'357EYHqrmMiJBmUZTVG5FuaMq4soAhgtgz6XNEAJaXHW3NHaUf'
),
parameter
);
console.log({ result });
})();
Loading