Skip to content

Commit

Permalink
Merge pull request #131 from fleet-sdk/fix-gql-provider
Browse files Browse the repository at this point in the history
`blockchain-providers` fixes
  • Loading branch information
arobsn authored Aug 13, 2024
2 parents adb3a76 + ece573c commit 1beb8cf
Show file tree
Hide file tree
Showing 13 changed files with 165 additions and 156 deletions.
5 changes: 5 additions & 0 deletions .changeset/mean-yaks-lay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@fleet-sdk/blockchain-providers": patch
---

Fix `Header#votes` encoding
5 changes: 5 additions & 0 deletions .changeset/real-weeks-fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@fleet-sdk/blockchain-providers": patch
---

Export `BlockChainProviders` types
5 changes: 5 additions & 0 deletions .changeset/spotty-foxes-fetch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@fleet-sdk/core": patch
---

Set default token limit for a single box to `100`
5 changes: 5 additions & 0 deletions .changeset/unlucky-numbers-sort.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@fleet-sdk/blockchain-providers": patch
---

[`ErgoGraphQLProvider`] Query Addresses/ErgoTrees by chunks of 20
5 changes: 5 additions & 0 deletions .changeset/wicked-rice-mate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@fleet-sdk/blockchain-providers": patch
---

Export `request` and `createGqlOperation` utility functions
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ describe("ergo-graphql provider", () => {

await _client.getBoxes({
where: {
boxIds: ["boxId_1", "boxId_2"],
boxId: "boxId_1",
ergoTrees: ["contract", "another_contract"]
}
});

call = JSON.parse(fetchSpy.mock.lastCall?.[1]?.body as string);
expect(call.variables).to.be.deep.equal({
spent: false,
boxIds: ["boxId_1", "boxId_2"],
boxIds: ["boxId_1"],
ergoTrees: ["contract", "another_contract"],
skip: 0,
take: 50
Expand All @@ -90,7 +90,6 @@ describe("ergo-graphql provider", () => {
.setBigIntMapper((v) => Number(v))
.getBoxes({
where: {
boxIds: ["boxId_0", "boxId_1"],
boxId: "boxId_0",
ergoTrees: ["ergoTree_0", "ergoTree_1", "ergoTree_1"],
ergoTree: "ergoTree_2"
Expand All @@ -103,7 +102,7 @@ describe("ergo-graphql provider", () => {
const call = JSON.parse(fetchSpy.mock.lastCall?.[1]?.body as string);
expect(call.variables).to.be.deep.equal({
spent: false,
boxIds: ["boxId_0", "boxId_1"],
boxIds: ["boxId_0"],
ergoTrees: ["ergoTree_0", "ergoTree_1", "ergoTree_2"],
skip: 0,
take: 50
Expand Down Expand Up @@ -451,7 +450,6 @@ describe("ergo-graphql provider", () => {
const response = await _client.getConfirmedTransactions({
where: {
transactionId: "txId",
transactionIds: ["txId_1", "txId_2", "txId_1"],
address: _addresses[0].encode(),
addresses: [_addresses[0], _addresses[1]],
ergoTree: _addresses[1].ergoTree,
Expand All @@ -469,7 +467,7 @@ describe("ergo-graphql provider", () => {
let callBody = JSON.parse(fetchSpy.mock.lastCall?.[1]?.body as string);
expect(callBody.query).to.be.equal(CONF_TX_QUERY);
expect(callBody.variables).to.be.deep.equal({
transactionIds: ["txId_1", "txId_2", "txId"],
transactionIds: ["txId"],
addresses: [
_addresses[0].encode(),
_addresses[1].encode(),
Expand Down Expand Up @@ -565,8 +563,6 @@ describe("ergo-graphql provider", () => {

const response = await _client.getUnconfirmedTransactions({
where: {
transactionId: "txId",
transactionIds: ["txId_1", "txId_2", "txId_1"],
address: _addresses[0].encode(),
addresses: [_addresses[0], _addresses[1]],
ergoTree: _addresses[1].ergoTree,
Expand All @@ -582,7 +578,6 @@ describe("ergo-graphql provider", () => {
let callBody = JSON.parse(fetchSpy.mock.lastCall?.[1]?.body as string);
expect(callBody.query).to.be.equal(UNCONF_TX_QUERY);
expect(callBody.variables).to.be.deep.equal({
transactionIds: ["txId_1", "txId_2", "txId"],
addresses: [
_addresses[0].encode(),
_addresses[1].encode(),
Expand Down Expand Up @@ -679,7 +674,7 @@ describe("ergo-graphql provider", () => {
id: header.headerId,
nBits: Number(header.nBits),
timestamp: Number(header.timestamp),
votes: header.votes.join("")
votes: "000000"
}))
);
expect(fetchSpy).toHaveBeenCalledOnce();
Expand Down
Loading

0 comments on commit 1beb8cf

Please sign in to comment.