The Gno Provider
is an extension on the tm2-js-client
Provider
,
outlined here. Both JSON-RPC and WS providers are included with the package.
Executes the Render() method in read-only mode
packagePath
string the gno package pathpath
string the render pathheight
number the height for querying. If omitted, the latest height is used (optional, default0
)
Returns Promise<string>
await provider.getRenderOutput('gno.land/r/demo/demo_realm', '');
// ## Hello World!
Fetches public facing function signatures
packagePath
string the gno package pathheight
number the height for querying. If omitted, the latest height is used (optional, default0
)
Returns Promise<FunctionSignature[]>
await provider.getFunctionSignatures('gno.land/r/demo/foo20');
/*
[
{ FuncName: 'TotalSupply', Params: null, Results: [ [Object] ] },
{
FuncName: 'BalanceOf',
Params: [ [Object] ],
Results: [ [Object] ]
},
{
FuncName: 'Allowance',
Params: [ [Object], [Object] ],
Results: [ [Object] ]
},
{
FuncName: 'Transfer',
Params: [ [Object], [Object] ],
Results: null
},
{
FuncName: 'Approve',
Params: [ [Object], [Object] ],
Results: null
},
{
FuncName: 'TransferFrom',
Params: [ [Object], [Object], [Object] ],
Results: null
},
{ FuncName: 'Faucet', Params: null, Results: null },
{ FuncName: 'Mint', Params: [ [Object], [Object] ], Results: null },
{ FuncName: 'Burn', Params: [ [Object], [Object] ], Results: null },
{ FuncName: 'Render', Params: [ [Object] ], Results: [ [Object] ] }
]
*/
Evaluates any expression in readonly mode and returns the results
packagePath
string the gno package pathexpression
string the expression to be evaluatedheight
number the height for querying. If omitted, the latest height is used (optional, default0
)
Returns Promise<string>
await provider.evaluateExpression('gno.land/r/demo/foo20', 'TotalSupply()')
// (10100000000 uint64)
Fetches the file content, or the list of files if the path is a directory
packagePath
string the gno package pathheight
number the height for querying. If omitted, the latest height is used (optional, default0
)
Returns Promise<string>
await provider.getFileContent('gno.land/r/demo/foo20', 'TotalSupply()')
/*
foo20.gno
foo20_test.gno
*/