Skip to content

Commit

Permalink
Node.js update query parameters (#1550)
Browse files Browse the repository at this point in the history
* Node.js: update query parameters

* Use HexEncodedString instead of String

* Update bindings/nodejs/lib/types/client/query-parameters.ts

* Update bindings/nodejs/lib/types/client/bridge/client.ts

---------

Co-authored-by: Thibault Martinez <[email protected]>
Co-authored-by: Thibault Martinez <[email protected]>
  • Loading branch information
3 people committed Nov 1, 2023
1 parent cccdd21 commit e6a11f3
Show file tree
Hide file tree
Showing 7 changed files with 491 additions and 509 deletions.
12 changes: 6 additions & 6 deletions bindings/nodejs/examples/client/05-get-address-balance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ async function run() {
});

// Get output ids of basic outputs that can be controlled by this address without further unlock constraints
const outputIdsResponse = await client.basicOutputIds([
{ address: addresses[0] },
{ hasExpiration: false },
{ hasTimelock: false },
{ hasStorageDepositReturn: false },
]);
const outputIdsResponse = await client.basicOutputIds({
address: addresses[0],
hasExpiration: false,
hasTimelock: false,
hasStorageDepositReturn: false,
});

// Get outputs by their IDs
const addressOutputs = await client.getOutputs(outputIdsResponse.items);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,9 @@ async function run() {
);

// Find first output unlockable by the account address
const queryParameters = [
{
address: accountAddress,
},
];
const queryParameters = {
address: accountAddress,
};
const input = (
await (await wallet.getClient()).basicOutputIds(queryParameters)
).items[0];
Expand Down
16 changes: 7 additions & 9 deletions bindings/nodejs/examples/how_tos/client/get-outputs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,13 @@ async function run() {

try {
// Get output ids of basic outputs that can be controlled by this address without further unlock constraints
const outputIdsResponse = await client.basicOutputIds([
{
address:
'rms1qpllaj0pyveqfkwxmnngz2c488hfdtmfrj3wfkgxtk4gtyrax0jaxzt70zy',
},
{ hasExpiration: false },
{ hasTimelock: false },
{ hasStorageDepositReturn: false },
]);
const outputIdsResponse = await client.basicOutputIds({
address:
'rms1qpllaj0pyveqfkwxmnngz2c488hfdtmfrj3wfkgxtk4gtyrax0jaxzt70zy',
hasExpiration: false,
hasTimelock: false,
hasStorageDepositReturn: false,
});
console.log('First output of query:');
console.log('ID: ', outputIdsResponse.items[0]);

Expand Down
Loading

0 comments on commit e6a11f3

Please sign in to comment.