|
| 1 | +## Gno Provider |
| 2 | + |
| 3 | +The `Gno Provider` is an extension on the `tm2-js-client` `Provider`, |
| 4 | +outlined [here](../../tm2-js-client/provider/provider.md). Both JSON-RPC and WS providers are included with the package. |
| 5 | + |
| 6 | +## Realm Methods |
| 7 | + |
| 8 | +### getRenderOutput |
| 9 | + |
| 10 | +Executes the Render(<path>) method in read-only mode |
| 11 | + |
| 12 | +#### Parameters |
| 13 | + |
| 14 | +* `packagePath` **string** the gno package path |
| 15 | +* `path` **string** the render path |
| 16 | +* `height` **number** the height for querying. |
| 17 | + If omitted, the latest height is used (optional, default `0`) |
| 18 | + |
| 19 | +Returns **Promise\<string>** |
| 20 | + |
| 21 | +#### Usage |
| 22 | + |
| 23 | +```ts |
| 24 | +await provider.getRenderOutput('gno.land/r/demo/demo_realm', ''); |
| 25 | +// ## Hello World! |
| 26 | +``` |
| 27 | + |
| 28 | +### getFunctionSignatures |
| 29 | + |
| 30 | +Fetches public facing function signatures |
| 31 | + |
| 32 | +#### Parameters |
| 33 | + |
| 34 | +* `packagePath` **string** the gno package path |
| 35 | +* `height` **number** the height for querying. |
| 36 | + If omitted, the latest height is used (optional, default `0`) |
| 37 | + |
| 38 | +Returns **Promise\<FunctionSignature[]>** |
| 39 | + |
| 40 | +#### Usage |
| 41 | + |
| 42 | +```ts |
| 43 | +await provider.getFunctionSignatures('gno.land/r/demo/foo20'); |
| 44 | +/* |
| 45 | +[ |
| 46 | + { FuncName: 'TotalSupply', Params: null, Results: [ [Object] ] }, |
| 47 | + { |
| 48 | + FuncName: 'BalanceOf', |
| 49 | + Params: [ [Object] ], |
| 50 | + Results: [ [Object] ] |
| 51 | + }, |
| 52 | + { |
| 53 | + FuncName: 'Allowance', |
| 54 | + Params: [ [Object], [Object] ], |
| 55 | + Results: [ [Object] ] |
| 56 | + }, |
| 57 | + { |
| 58 | + FuncName: 'Transfer', |
| 59 | + Params: [ [Object], [Object] ], |
| 60 | + Results: null |
| 61 | + }, |
| 62 | + { |
| 63 | + FuncName: 'Approve', |
| 64 | + Params: [ [Object], [Object] ], |
| 65 | + Results: null |
| 66 | + }, |
| 67 | + { |
| 68 | + FuncName: 'TransferFrom', |
| 69 | + Params: [ [Object], [Object], [Object] ], |
| 70 | + Results: null |
| 71 | + }, |
| 72 | + { FuncName: 'Faucet', Params: null, Results: null }, |
| 73 | + { FuncName: 'Mint', Params: [ [Object], [Object] ], Results: null }, |
| 74 | + { FuncName: 'Burn', Params: [ [Object], [Object] ], Results: null }, |
| 75 | + { FuncName: 'Render', Params: [ [Object] ], Results: [ [Object] ] } |
| 76 | +] |
| 77 | + */ |
| 78 | +``` |
| 79 | + |
| 80 | +### evaluateExpression |
| 81 | + |
| 82 | +Evaluates any expression in readonly mode and returns the results |
| 83 | + |
| 84 | +#### Parameters |
| 85 | + |
| 86 | +* `packagePath` **string** the gno package path |
| 87 | +* `expression` **string** the expression to be evaluated |
| 88 | +* `height` **number** the height for querying. |
| 89 | + If omitted, the latest height is used (optional, default `0`) |
| 90 | + |
| 91 | +Returns **Promise\<string>** |
| 92 | + |
| 93 | +#### Usage |
| 94 | + |
| 95 | +```ts |
| 96 | +await provider.evaluateExpression('gno.land/r/demo/foo20', 'TotalSupply()') |
| 97 | +// (10100000000 uint64) |
| 98 | +``` |
| 99 | + |
| 100 | +### getFileContent |
| 101 | + |
| 102 | +Fetches the file content, or the list of files if the path is a directory |
| 103 | + |
| 104 | +#### Parameters |
| 105 | + |
| 106 | +* `packagePath` **string** the gno package path |
| 107 | +* `height` **number** the height for querying. |
| 108 | + If omitted, the latest height is used (optional, default `0`) |
| 109 | + |
| 110 | +Returns **Promise\<string>** |
| 111 | + |
| 112 | +#### Usage |
| 113 | + |
| 114 | +```ts |
| 115 | +await provider.getFileContent('gno.land/r/demo/foo20', 'TotalSupply()') |
| 116 | +/* |
| 117 | +foo20.gno |
| 118 | +foo20_test.gno |
| 119 | + */ |
| 120 | +``` |
0 commit comments