@buildonspark/issuer-sdk 0.0.87 → 0.0.89

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @buildonspark/issuer-sdk
2
2
 
3
+ ## 0.0.89
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+ - @buildonspark/spark-sdk@0.2.10
9
+
10
+ ## 0.0.88
11
+
12
+ ### Patch Changes
13
+
14
+ - -- return offset from queryTokenTransactions
15
+ - Updated dependencies
16
+ - @buildonspark/spark-sdk@0.2.9
17
+
3
18
  ## 0.0.87
4
19
 
5
20
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buildonspark/issuer-sdk",
3
- "version": "0.0.87",
3
+ "version": "0.0.89",
4
4
  "description": "Spark Issuer SDK for token issuance",
5
5
  "license": "Apache-2.0",
6
6
  "module": "./dist/index.js",
@@ -72,7 +72,7 @@
72
72
  "types": "tsc"
73
73
  },
74
74
  "dependencies": {
75
- "@buildonspark/spark-sdk": "0.2.8",
75
+ "@buildonspark/spark-sdk": "0.2.10",
76
76
  "@noble/curves": "^1.8.0",
77
77
  "@scure/btc-signer": "^1.5.0",
78
78
  "buffer": "^6.0.3"
@@ -615,10 +615,11 @@ describe.each(TEST_CONFIGS)(
615
615
  );
616
616
  expect(userBalance.balance).toBeGreaterThanOrEqual(tokenAmount);
617
617
 
618
- const transactions = await issuerWallet.queryTokenTransactions({
618
+ const response = await issuerWallet.queryTokenTransactions({
619
619
  tokenIdentifiers: [tokenIdentifier!],
620
620
  ownerPublicKeys: [issuerPublicKey],
621
621
  });
622
+ const transactions = response.tokenTransactionsWithStatus;
622
623
  expect(transactions.length).toBeGreaterThanOrEqual(2);
623
624
 
624
625
  let mint_operation = 0;
@@ -677,10 +678,11 @@ describe.each(TEST_CONFIGS)(
677
678
 
678
679
  await issuerWallet.burnTokens(250n);
679
680
 
680
- const transactions = await issuerWallet.queryTokenTransactions({
681
+ const res = await issuerWallet.queryTokenTransactions({
681
682
  tokenIdentifiers: [tokenIdentifier!],
682
683
  ownerPublicKeys: [issuerPublicKey],
683
684
  });
685
+ const transactions = res.tokenTransactionsWithStatus;
684
686
 
685
687
  const mintTransaction = transactions.find(
686
688
  (tx) => tx.tokenTransaction?.tokenInputs?.$case === "mintInput",
@@ -727,9 +729,10 @@ describe.each(TEST_CONFIGS)(
727
729
  await issuerWallet.mintTokens(tokenAmount);
728
730
 
729
731
  {
730
- const transactions = await issuerWallet.queryTokenTransactions({
732
+ const res = await issuerWallet.queryTokenTransactions({
731
733
  tokenIdentifiers: [tokenIdentifier!],
732
734
  });
735
+ const transactions = res.tokenTransactionsWithStatus;
733
736
  const amount_of_transactions = transactions.length;
734
737
  expect(amount_of_transactions).toEqual(1);
735
738
  }
@@ -741,9 +744,10 @@ describe.each(TEST_CONFIGS)(
741
744
  });
742
745
 
743
746
  {
744
- const transactions = await issuerWallet.queryTokenTransactions({
747
+ const res = await issuerWallet.queryTokenTransactions({
745
748
  tokenIdentifiers: [tokenIdentifier!],
746
749
  });
750
+ const transactions = res.tokenTransactionsWithStatus;
747
751
  const amount_of_transactions = transactions.length;
748
752
  expect(amount_of_transactions).toEqual(2);
749
753
  }
@@ -758,10 +762,11 @@ describe.each(TEST_CONFIGS)(
758
762
  } // 202 in total
759
763
 
760
764
  {
761
- const transactions = await issuerWallet.queryTokenTransactions({
765
+ const res = await issuerWallet.queryTokenTransactions({
762
766
  tokenIdentifiers: [tokenIdentifier!],
763
767
  pageSize: 10,
764
768
  });
769
+ const transactions = res.tokenTransactionsWithStatus;
765
770
  const amount_of_transactions = transactions.length;
766
771
  expect(amount_of_transactions).toEqual(10);
767
772
  }
@@ -774,22 +779,23 @@ describe.each(TEST_CONFIGS)(
774
779
  let page_num = 0;
775
780
 
776
781
  while (true) {
777
- const transactionsPage = await issuerWallet.queryTokenTransactions({
782
+ const res = await issuerWallet.queryTokenTransactions({
778
783
  tokenIdentifiers: [tokenIdentifier!],
779
784
  pageSize,
780
785
  offset,
781
786
  });
787
+ const transactions = res.tokenTransactionsWithStatus;
782
788
 
783
- if (transactionsPage.length === 0) {
789
+ if (transactions.length === 0) {
784
790
  break;
785
791
  }
786
792
 
787
793
  if (offset === 0) {
788
- expect(transactionsPage.length).toEqual(pageSize);
794
+ expect(transactions.length).toEqual(pageSize);
789
795
  }
790
796
 
791
- for (let index = 0; index < transactionsPage.length; ++index) {
792
- const element = transactionsPage[index];
797
+ for (let index = 0; index < transactions.length; ++index) {
798
+ const element = transactions[index];
793
799
  if (element.tokenTransaction !== undefined) {
794
800
  const hash: String = bytesToHex(element.tokenTransactionHash);
795
801
  if (hashset_of_all_transactions.has(hash)) {
@@ -807,7 +813,7 @@ describe.each(TEST_CONFIGS)(
807
813
  }
808
814
 
809
815
  // Prepare for next iteration.
810
- offset += transactionsPage.length;
816
+ offset += transactions.length;
811
817
  page_num += 1;
812
818
  }
813
819