Now, link the wrapper to Tezos-plugin-js and tezos-test-env:
yarn link @web3api/tezos-plugin-js
yarn link @web3api/tezos-test-env
Install the node packages and build plugin-js
yarn
yarn build
Running Tests
The e2e tests can be found in the src/tests/e2e folder. Run the e2e tests as follows:
yarn test
Project Structure
Queries
Can be found in the ./src/query folder containing the index.ts file which is the AssemblyScript mutation logic and schema.graphql file which contains the graphql schemas for the functions in the query's index file.
export function getBalanceOf(input: Input_getBalanceOf): GetBalanceResponse {
if (input.network == Network.custom && input.custom === null) {
throw new Error(`custom network should have a valid connection and contract address`);
}
const connectionDetails = getConnectionDetails(input.network, input.custom, false);
const balance = Tezos_Query.getContractStorage({
address: connectionDetails.contractAddress,
connection: connectionDetails.connection,
key: "ledger",
field: '["' + input.owner + '",' + input.token_id + ']',
});
return {
owner: input.owner,
token_id: input.token_id,
balance: balance
};
Tests
To test the functions in query/index.ts, e2e tests are written in the __tests__/e2e folder.