@partisiablockchain/blockchain-api-transaction-client 5.59.0 → 5.68.0

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.
Files changed (73) hide show
  1. package/package.json +2 -1
  2. package/target/main/generated/openapi/models/Account.d.ts +2 -1
  3. package/target/main/generated/openapi/models/Account.js +5 -1
  4. package/target/main/generated/openapi/models/Account.js.map +1 -1
  5. package/target/main/generated/openapi/models/AvlInformation.d.ts +2 -1
  6. package/target/main/generated/openapi/models/AvlInformation.js +5 -1
  7. package/target/main/generated/openapi/models/AvlInformation.js.map +1 -1
  8. package/target/main/generated/openapi/models/AvlStateEntry.d.ts +2 -1
  9. package/target/main/generated/openapi/models/AvlStateEntry.js +5 -1
  10. package/target/main/generated/openapi/models/AvlStateEntry.js.map +1 -1
  11. package/target/main/generated/openapi/models/AvlStateValue.d.ts +2 -1
  12. package/target/main/generated/openapi/models/AvlStateValue.js +5 -1
  13. package/target/main/generated/openapi/models/AvlStateValue.js.map +1 -1
  14. package/target/main/generated/openapi/models/Block.d.ts +2 -1
  15. package/target/main/generated/openapi/models/Block.js +5 -1
  16. package/target/main/generated/openapi/models/Block.js.map +1 -1
  17. package/target/main/generated/openapi/models/Chain.d.ts +2 -1
  18. package/target/main/generated/openapi/models/Chain.js +5 -1
  19. package/target/main/generated/openapi/models/Chain.js.map +1 -1
  20. package/target/main/generated/openapi/models/Contract.d.ts +2 -1
  21. package/target/main/generated/openapi/models/Contract.js +5 -1
  22. package/target/main/generated/openapi/models/Contract.js.map +1 -1
  23. package/target/main/generated/openapi/models/ExecutedTransaction.d.ts +2 -1
  24. package/target/main/generated/openapi/models/ExecutedTransaction.js +5 -1
  25. package/target/main/generated/openapi/models/ExecutedTransaction.js.map +1 -1
  26. package/target/main/generated/openapi/models/ExecutionStatus.d.ts +2 -1
  27. package/target/main/generated/openapi/models/ExecutionStatus.js +5 -1
  28. package/target/main/generated/openapi/models/ExecutionStatus.js.map +1 -1
  29. package/target/main/generated/openapi/models/Failure.d.ts +2 -1
  30. package/target/main/generated/openapi/models/Failure.js +5 -1
  31. package/target/main/generated/openapi/models/Failure.js.map +1 -1
  32. package/target/main/generated/openapi/models/Feature.d.ts +2 -1
  33. package/target/main/generated/openapi/models/Feature.js +5 -1
  34. package/target/main/generated/openapi/models/Feature.js.map +1 -1
  35. package/target/main/generated/openapi/models/Jar.d.ts +2 -1
  36. package/target/main/generated/openapi/models/Jar.js +5 -1
  37. package/target/main/generated/openapi/models/Jar.js.map +1 -1
  38. package/target/main/generated/openapi/models/Plugin.d.ts +2 -1
  39. package/target/main/generated/openapi/models/Plugin.js +5 -1
  40. package/target/main/generated/openapi/models/Plugin.js.map +1 -1
  41. package/target/main/generated/openapi/models/SerializedTransaction.d.ts +2 -1
  42. package/target/main/generated/openapi/models/SerializedTransaction.js +5 -1
  43. package/target/main/generated/openapi/models/SerializedTransaction.js.map +1 -1
  44. package/target/main/generated/openapi/models/Shard.d.ts +2 -1
  45. package/target/main/generated/openapi/models/Shard.js +5 -1
  46. package/target/main/generated/openapi/models/Shard.js.map +1 -1
  47. package/target/main/generated/openapi/models/TransactionCost.d.ts +2 -1
  48. package/target/main/generated/openapi/models/TransactionCost.js +5 -1
  49. package/target/main/generated/openapi/models/TransactionCost.js.map +1 -1
  50. package/target/main/generated/openapi/models/TransactionPointer.d.ts +2 -1
  51. package/target/main/generated/openapi/models/TransactionPointer.js +5 -1
  52. package/target/main/generated/openapi/models/TransactionPointer.js.map +1 -1
  53. package/target/main/generated/openapi/runtime.d.ts +1 -0
  54. package/target/main/generated/openapi/runtime.js +5 -0
  55. package/target/main/generated/openapi/runtime.js.map +1 -1
  56. package/target/main/index.d.ts +2 -1
  57. package/target/main/index.js +3 -1
  58. package/target/main/index.js.map +1 -1
  59. package/target/main/transactionclient/BlockchainTransactionClient.d.ts +17 -7
  60. package/target/main/transactionclient/BlockchainTransactionClient.js +29 -18
  61. package/target/main/transactionclient/BlockchainTransactionClient.js.map +1 -1
  62. package/target/main/transactionclient/SenderAuthenticationKeyPair.js +2 -5
  63. package/target/main/transactionclient/SenderAuthenticationKeyPair.js.map +1 -1
  64. package/target/main/transactionclient/ShardAndChainControllerTransactionClient.d.ts +23 -0
  65. package/target/main/transactionclient/ShardAndChainControllerTransactionClient.js +69 -0
  66. package/target/main/transactionclient/ShardAndChainControllerTransactionClient.js.map +1 -0
  67. package/target/main/transactionclient/SignedTransaction.d.ts +7 -0
  68. package/target/main/transactionclient/SignedTransaction.js +13 -4
  69. package/target/main/transactionclient/SignedTransaction.js.map +1 -1
  70. package/target/main/transactionclient/TransactionTree.d.ts +20 -0
  71. package/target/main/transactionclient/TransactionTree.js +50 -0
  72. package/target/main/transactionclient/TransactionTree.js.map +1 -0
  73. package/target/main/transactionclient/types.d.ts +36 -7
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright (C) 2022 - 2023 Partisia Blockchain Foundation
4
+ *
5
+ * This program is free software: you can redistribute it and/or modify
6
+ * it under the terms of the GNU Affero General Public License as published by
7
+ * the Free Software Foundation, either version 3 of the License, or
8
+ * (at your option) any later version.
9
+ *
10
+ * This program is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ * GNU General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Affero General Public License
16
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+ *
18
+ */
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.TransactionTree = void 0;
21
+ /** Status for a transaction and the whole tree of spawned events. */
22
+ class TransactionTree {
23
+ /**
24
+ * Create new TransactionTree.
25
+ * @param transaction the original transaction.
26
+ * @param events list of spawned events from the transaction.
27
+ */
28
+ constructor(transaction, events) {
29
+ this.transaction = transaction;
30
+ this.events = events;
31
+ }
32
+ /**
33
+ * Check if the executed transaction tree includes any transactions or events which did not
34
+ * succeed.
35
+ * @returns true if the transaction tree includes any failures, false if all succeeded.
36
+ */
37
+ hasFailures() {
38
+ if (!this.transaction.executionStatus.success) {
39
+ return true;
40
+ }
41
+ for (const event of this.events) {
42
+ if (!event.executionStatus.success) {
43
+ return true;
44
+ }
45
+ }
46
+ return false;
47
+ }
48
+ }
49
+ exports.TransactionTree = TransactionTree;
50
+ //# sourceMappingURL=TransactionTree.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TransactionTree.js","sourceRoot":"","sources":["../../../src/main/transactionclient/TransactionTree.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;AAIH,qEAAqE;AACrE,MAAa,eAAe;IAM1B;;;;OAIG;IACH,YAAY,WAAgC,EAAE,MAA6B;QACzE,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;;;;OAIG;IACI,WAAW;QAChB,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,eAAgB,CAAC,OAAO,EAAE,CAAC;YAC/C,OAAO,IAAI,CAAC;QACd,CAAC;QACD,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChC,IAAI,CAAC,KAAK,CAAC,eAAgB,CAAC,OAAO,EAAE,CAAC;gBACpC,OAAO,IAAI,CAAC;YACd,CAAC;QACH,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAhCD,0CAgCC"}
@@ -1,5 +1,5 @@
1
1
  import { SignedTransaction } from "./SignedTransaction";
2
- import { ExecutedTransaction, TransactionPointer } from "../generated/openapi";
2
+ import { ExecutedTransaction, SerializedTransaction, TransactionPointer } from "../generated/openapi";
3
3
  /** Hash as a 32 byte long hex string. */
4
4
  export type Hash = string;
5
5
  /** BlockchainAddress as 21 byte long hex string. */
@@ -40,10 +40,39 @@ export interface SentTransaction {
40
40
  /** A pointer to the signed transaction that was sent. */
41
41
  transactionPointer: TransactionPointer;
42
42
  }
43
- /** Status for a transaction and the whole tree of spawned events. */
44
- export interface TransactionTree {
45
- /** The original transaction. */
46
- transaction: ExecutedTransaction;
47
- /** List of spawned events from the transaction. */
48
- events: ExecutedTransaction[];
43
+ /**
44
+ * A client for getting the information to create a transaction, and send it after creation and
45
+ * signing.
46
+ */
47
+ export interface BlockchainClientForTransaction {
48
+ /**
49
+ * Get the chain ID for the running chain.
50
+ * @returns the chain ID string.
51
+ */
52
+ getChainId(): Promise<string>;
53
+ /**
54
+ * Get the current nonce to use when signing a transaction for the given account.
55
+ * @param blockchainAddress the address to get the nonce for.
56
+ * @returns the current nonce to use for signing.
57
+ */
58
+ getNonce(blockchainAddress: BlockchainAddress): Promise<number>;
59
+ /**
60
+ * Retrieve an executed transaction from the blockchain.
61
+ * @param shardId The name of the shard to interact with.
62
+ * @param transactionId The transaction hash.
63
+ * @returns The retrieved transaction.
64
+ */
65
+ getTransaction(shardId: string, transactionId: Hash): Promise<ExecutedTransaction>;
66
+ /**
67
+ * Get the production time from the latest created block of a specific shard.
68
+ * @param shardId the id of the shard.
69
+ * @returns the production time of the latest created block.
70
+ */
71
+ getLatestProductionTime(shardId: string): Promise<number>;
72
+ /**
73
+ * Send a signed transaction to the chain and return a pointer to the transaction.
74
+ * @param serializedTransaction the transaction to send.
75
+ * @returns a pointer to the transaction on chain.
76
+ */
77
+ putTransaction(serializedTransaction: SerializedTransaction): Promise<TransactionPointer>;
49
78
  }