@partisiablockchain/abi-client 6.62.0 → 6.85.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 (34) hide show
  1. package/package.json +9 -10
  2. package/target/main/AccountPluginInvocationDeserialization.js +4 -4
  3. package/target/main/AccountPluginInvocationDeserialization.js.map +1 -1
  4. package/target/main/TransactionAndEventDeserialization.js +1 -1
  5. package/target/main/TransactionAndEventDeserialization.js.map +1 -1
  6. package/target/main/index.d.ts +8 -2
  7. package/target/main/index.js +24 -6
  8. package/target/main/index.js.map +1 -1
  9. package/target/main/parser/AbiParser.js +3 -2
  10. package/target/main/parser/AbiParser.js.map +1 -1
  11. package/target/main/transaction/TransactionSerialization.d.ts +7 -0
  12. package/target/main/transaction/TransactionSerialization.js +49 -0
  13. package/target/main/transaction/TransactionSerialization.js.map +1 -0
  14. package/target/main/transaction/model/InnerEvent.d.ts +73 -0
  15. package/target/main/transaction/model/InnerEvent.js +140 -0
  16. package/target/main/transaction/model/InnerEvent.js.map +1 -0
  17. package/target/main/transaction/model/InnerSystemEvent.d.ts +150 -0
  18. package/target/main/transaction/model/InnerSystemEvent.js +279 -0
  19. package/target/main/transaction/model/InnerSystemEvent.js.map +1 -0
  20. package/target/main/transaction/model/Model.d.ts +81 -0
  21. package/target/main/transaction/model/Model.js +121 -0
  22. package/target/main/transaction/model/Model.js.map +1 -0
  23. package/target/main/transaction/model/StreamHelper.d.ts +16 -0
  24. package/target/main/transaction/model/StreamHelper.js +70 -0
  25. package/target/main/transaction/model/StreamHelper.js.map +1 -0
  26. package/target/main/transaction/model/Transaction.d.ts +58 -0
  27. package/target/main/transaction/model/Transaction.js +101 -0
  28. package/target/main/transaction/model/Transaction.js.map +1 -0
  29. package/target/main/transaction/TransactionBuilder.d.ts +0 -7
  30. package/target/main/transaction/TransactionBuilder.js +0 -47
  31. package/target/main/transaction/TransactionBuilder.js.map +0 -1
  32. package/target/main/transaction/TransactionReader.d.ts +0 -19
  33. package/target/main/transaction/TransactionReader.js +0 -74
  34. package/target/main/transaction/TransactionReader.js.map +0 -1
@@ -0,0 +1,81 @@
1
+ import { InnerEvent } from "./InnerEvent";
2
+ import { InteractWithContractTransaction } from "./Transaction";
3
+ import { ByteInput, ByteOutput } from "@secata-public/bitmanipulation-ts";
4
+ export type Hash = string;
5
+ export type BlockchainAddress = string;
6
+ export type Signature = string;
7
+ /** An event that is executable in the blockchain. */
8
+ export interface ExecutableEvent {
9
+ /** The shard that the event originated from. */
10
+ originShard: string | undefined;
11
+ /** The underlying {@link EventTransaction}. */
12
+ transaction: EventTransaction;
13
+ }
14
+ export declare const ExecutableEvent: {
15
+ read(stream: ByteInput): ExecutableEvent;
16
+ write(stream: ByteOutput, value: ExecutableEvent): void;
17
+ };
18
+ /** An event created on the blockchain, and to be executed internally by the blockchain. */
19
+ export interface EventTransaction {
20
+ /** The {@link SignedTransaction} initiating the tree of events that
21
+ * this event is a part of. */
22
+ originatingTransaction: Hash;
23
+ /** Describes the specific event that have occurred.*/
24
+ inner: InnerEvent;
25
+ /** The shard this event is going to and nonce for this event.*/
26
+ shardRoute: ShardRoute;
27
+ /** The id of the committee that produced this event.*/
28
+ committeeId: number;
29
+ /** The version of governance when this event was produced.*/
30
+ governanceVersion: number;
31
+ /** Height of the event call stack for this {@link EventTransaction}.*/
32
+ height: number;
33
+ /** Pointer to the contract that expects a callback. Possibly null, if no
34
+ * callback have been requested.*/
35
+ returnEnvelope: ReturnEnvelope | undefined;
36
+ }
37
+ /** A transaction that has been signed by the private key. */
38
+ export interface SignedTransaction {
39
+ /** The signature of the transaction.*/
40
+ signature: Signature;
41
+ /** The inner transaction.*/
42
+ inner: InnerPart;
43
+ }
44
+ export declare const SignedTransaction: {
45
+ read(stream: ByteInput): SignedTransaction;
46
+ write(stream: ByteOutput, value: SignedTransaction): void;
47
+ };
48
+ /** The inner part of a signed transaction.*/
49
+ export interface InnerPart {
50
+ /** Nonce for the sender of this transaction. */
51
+ nonce: number;
52
+ /** Which human time (System.currentMillis) this transaction is valid to .*/
53
+ validToTime: number;
54
+ /** The fee to be deducted from sender account during transaction. */
55
+ gasCost: number;
56
+ /** The actual transaction */
57
+ transaction: InteractWithContractTransaction;
58
+ }
59
+ /** Unique routing to a shard.*/
60
+ export interface ShardRoute {
61
+ /** Id of target shard. */
62
+ targetShard: string | undefined;
63
+ /** Nonce for route. */
64
+ nonce: number;
65
+ }
66
+ /** Tracks contract that should eventually receive a callback for a transaction it has previously
67
+ * sent. */
68
+ export interface ReturnEnvelope {
69
+ /** Address of contract. */
70
+ contract: BlockchainAddress;
71
+ }
72
+ export declare const ReturnEnvelope: {
73
+ read(stream: ByteInput): ReturnEnvelope;
74
+ write(stream: ByteOutput, value: ReturnEnvelope): void;
75
+ };
76
+ export declare enum ChainPluginType {
77
+ ACCOUNT = 0,
78
+ CONSENSUS = 1,
79
+ ROUTING = 2,
80
+ SHARED_OBJECT_STORE = 3
81
+ }
@@ -0,0 +1,121 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright (C) 2022 - 2025 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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
20
+ return (mod && mod.__esModule) ? mod : { "default": mod };
21
+ };
22
+ Object.defineProperty(exports, "__esModule", { value: true });
23
+ exports.ChainPluginType = exports.ReturnEnvelope = exports.SignedTransaction = exports.ExecutableEvent = void 0;
24
+ const InnerEvent_1 = require("./InnerEvent");
25
+ const Transaction_1 = require("./Transaction");
26
+ const StreamHelper_1 = require("./StreamHelper");
27
+ const bn_js_1 = __importDefault(require("bn.js"));
28
+ exports.ExecutableEvent = {
29
+ read(stream) {
30
+ const originShard = StreamHelper_1.StreamHelper.readOptional(stream, (stream) => stream.readString());
31
+ const transaction = EventTransaction.read(stream);
32
+ return { originShard, transaction };
33
+ },
34
+ write(stream, value) {
35
+ StreamHelper_1.StreamHelper.writeOptional(stream, value.originShard, (stream, value) => stream.writeString(value));
36
+ EventTransaction.write(stream, value.transaction);
37
+ },
38
+ };
39
+ const EventTransaction = {
40
+ read(stream) {
41
+ const originatingTransaction = StreamHelper_1.StreamHelper.readHash(stream);
42
+ const inner = InnerEvent_1.InnerEvent.read(stream);
43
+ const shardRoute = ShardRoute.read(stream);
44
+ const committeeId = stream.readI64().toNumber();
45
+ const governanceVersion = stream.readI64().toNumber();
46
+ const height = stream.readU8();
47
+ const returnEnvelope = StreamHelper_1.StreamHelper.readOptional(stream, exports.ReturnEnvelope.read);
48
+ return {
49
+ originatingTransaction,
50
+ inner,
51
+ shardRoute,
52
+ committeeId,
53
+ governanceVersion,
54
+ height,
55
+ returnEnvelope,
56
+ };
57
+ },
58
+ write(stream, value) {
59
+ StreamHelper_1.StreamHelper.writeHash(stream, value.originatingTransaction);
60
+ InnerEvent_1.InnerEvent.write(stream, value.inner);
61
+ ShardRoute.write(stream, value.shardRoute);
62
+ stream.writeI64(new bn_js_1.default(value.committeeId));
63
+ stream.writeI64(new bn_js_1.default(value.governanceVersion));
64
+ stream.writeU8(value.height);
65
+ StreamHelper_1.StreamHelper.writeOptional(stream, value.returnEnvelope, exports.ReturnEnvelope.write);
66
+ },
67
+ };
68
+ exports.SignedTransaction = {
69
+ read(stream) {
70
+ const signature = StreamHelper_1.StreamHelper.readSignature(stream);
71
+ const inner = InnerPart.read(stream);
72
+ return { signature, inner };
73
+ },
74
+ write(stream, value) {
75
+ StreamHelper_1.StreamHelper.writeSignature(stream, value.signature);
76
+ InnerPart.write(stream, value.inner);
77
+ },
78
+ };
79
+ const InnerPart = {
80
+ read(stream) {
81
+ const nonce = stream.readI64().toNumber();
82
+ const validToTime = stream.readI64().toNumber();
83
+ const gasCost = stream.readI64().toNumber();
84
+ const transaction = Transaction_1.InteractWithContractTransaction.read(stream);
85
+ return { nonce, validToTime, gasCost, transaction };
86
+ },
87
+ write(stream, value) {
88
+ stream.writeI64(new bn_js_1.default(value.nonce));
89
+ stream.writeI64(new bn_js_1.default(value.validToTime));
90
+ stream.writeI64(new bn_js_1.default(value.gasCost));
91
+ Transaction_1.InteractWithContractTransaction.write(stream, value.transaction);
92
+ },
93
+ };
94
+ const ShardRoute = {
95
+ read(stream) {
96
+ const targetShard = StreamHelper_1.StreamHelper.readOptional(stream, (stream) => stream.readString());
97
+ const nonce = stream.readI64().toNumber();
98
+ return { targetShard, nonce };
99
+ },
100
+ write(stream, value) {
101
+ StreamHelper_1.StreamHelper.writeOptional(stream, value.targetShard, (stream, value) => stream.writeString(value));
102
+ stream.writeI64(new bn_js_1.default(value.nonce));
103
+ },
104
+ };
105
+ exports.ReturnEnvelope = {
106
+ read(stream) {
107
+ const contract = StreamHelper_1.StreamHelper.readAddress(stream);
108
+ return { contract };
109
+ },
110
+ write(stream, value) {
111
+ StreamHelper_1.StreamHelper.writeAddress(stream, value.contract);
112
+ },
113
+ };
114
+ var ChainPluginType;
115
+ (function (ChainPluginType) {
116
+ ChainPluginType[ChainPluginType["ACCOUNT"] = 0] = "ACCOUNT";
117
+ ChainPluginType[ChainPluginType["CONSENSUS"] = 1] = "CONSENSUS";
118
+ ChainPluginType[ChainPluginType["ROUTING"] = 2] = "ROUTING";
119
+ ChainPluginType[ChainPluginType["SHARED_OBJECT_STORE"] = 3] = "SHARED_OBJECT_STORE";
120
+ })(ChainPluginType || (exports.ChainPluginType = ChainPluginType = {}));
121
+ //# sourceMappingURL=Model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Model.js","sourceRoot":"","sources":["../../../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K,CAAC,WAAW,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CACtE,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAC1B,CAAC;QACF,MAAM,CAAC,QAAQ,CAAC,IAAI,eAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;IACvC,CAAC;CACF,CAAC;AASW,QAAA,cAAc,GAAG;IAC5B,IAAI,CAAC,MAAiB;QACpB,MAAM,QAAQ,GAAG,2BAAY,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;QAClD,OAAO,EAAE,QAAQ,EAAE,CAAC;IACtB,CAAC;IAED,KAAK,CAAC,MAAkB,EAAE,KAAqB;QAC7C,2BAAY,CAAC,YAAY,CAAC,MAAM,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;IACpD,CAAC;CACF,CAAC;AAEF,IAAY,eAKX;AALD,WAAY,eAAe;IACzB,2DAAO,CAAA;IACP,+DAAS,CAAA;IACT,2DAAO,CAAA;IACP,mFAAmB,CAAA;AACrB,CAAC,EALW,eAAe,+BAAf,eAAe,QAK1B"}
@@ -0,0 +1,16 @@
1
+ import { ByteInput, ByteOutput } from "@secata-public/bitmanipulation-ts";
2
+ import { BlockchainAddress, Hash, Signature } from "./Model";
3
+ export declare const StreamHelper: {
4
+ readOptional<T>(stream: ByteInput, reader: (stream: ByteInput) => T): T | undefined;
5
+ readHash(stream: ByteInput): Hash;
6
+ readAddress(stream: ByteInput): BlockchainAddress;
7
+ readSignature(stream: ByteInput): Signature;
8
+ readDynamicBytes(stream: ByteInput): Buffer;
9
+ readDynamicList<T>(stream: ByteInput, reader: (stream: ByteInput) => T): T[];
10
+ writeOptional<T>(stream: ByteOutput, value: T | undefined, writer: (stream: ByteOutput, value: T) => void): void;
11
+ writeHash(stream: ByteOutput, value: Hash): void;
12
+ writeAddress(stream: ByteOutput, value: BlockchainAddress): void;
13
+ writeSignature(stream: ByteOutput, value: Signature): void;
14
+ writeDynamicBytes(stream: ByteOutput, value: Buffer): void;
15
+ writeDynamicList<T>(stream: ByteOutput, value: T[], writer: (stream: ByteOutput, value: T) => void): void;
16
+ };
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright (C) 2022 - 2025 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.StreamHelper = void 0;
21
+ exports.StreamHelper = {
22
+ readOptional(stream, reader) {
23
+ const isSome = stream.readBoolean();
24
+ if (isSome) {
25
+ return reader(stream);
26
+ }
27
+ },
28
+ readHash(stream) {
29
+ return stream.readBytes(32).toString("hex");
30
+ },
31
+ readAddress(stream) {
32
+ return stream.readBytes(21).toString("hex");
33
+ },
34
+ readSignature(stream) {
35
+ return stream.readBytes(65).toString("hex");
36
+ },
37
+ readDynamicBytes(stream) {
38
+ const size = stream.readI32();
39
+ return stream.readBytes(size);
40
+ },
41
+ readDynamicList(stream, reader) {
42
+ const size = stream.readI32();
43
+ return Array.from({ length: size }, () => reader(stream));
44
+ },
45
+ writeOptional(stream, value, writer) {
46
+ const isSome = value !== undefined;
47
+ stream.writeBoolean(isSome);
48
+ if (isSome) {
49
+ writer(stream, value);
50
+ }
51
+ },
52
+ writeHash(stream, value) {
53
+ stream.writeBytes(Buffer.from(value, "hex"));
54
+ },
55
+ writeAddress(stream, value) {
56
+ stream.writeBytes(Buffer.from(value, "hex"));
57
+ },
58
+ writeSignature(stream, value) {
59
+ stream.writeBytes(Buffer.from(value, "hex"));
60
+ },
61
+ writeDynamicBytes(stream, value) {
62
+ stream.writeI32(value.length);
63
+ stream.writeBytes(value);
64
+ },
65
+ writeDynamicList(stream, value, writer) {
66
+ stream.writeI32(value.length);
67
+ value.forEach((v) => writer(stream, v));
68
+ },
69
+ };
70
+ //# sourceMappingURL=StreamHelper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StreamHelper.js","sourceRoot":"","sources":["../../../../src/main/transaction/model/StreamHelper.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;AAKU,QAAA,YAAY,GAAG;IAC1B,YAAY,CAAI,MAAiB,EAAE,MAAgC;QACjE,MAAM,MAAM,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;QACpC,IAAI,MAAM,EAAE,CAAC;YACX,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC;QACxB,CAAC;IACH,CAAC;IAED,QAAQ,CAAC,MAAiB;QACxB,OAAO,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC9C,CAAC;IACD,WAAW,CAAC,MAAiB;QAC3B,OAAO,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC9C,CAAC;IACD,aAAa,CAAC,MAAiB;QAC7B,OAAO,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC9C,CAAC;IACD,gBAAgB,CAAC,MAAiB;QAChC,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC;QAC9B,OAAO,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;IACD,eAAe,CAAI,MAAiB,EAAE,MAAgC;QACpE,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC;QAC9B,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,M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Input, ByteOutput } from "@secata-public/bitmanipulation-ts";
3
+ /** A smart contract transaction. */
4
+ export type Transaction = CreateContractTransaction | InteractWithContractTransaction | UpgradeContractTransaction;
5
+ /** The type of {@link Transaction}. */
6
+ export declare enum Type {
7
+ /** Deploy contract. */
8
+ DEPLOY_CONTRACT = 0,
9
+ /** Interact contract. */
10
+ INTERACT_CONTRACT = 1,
11
+ /** Upgrade contract. */
12
+ UPGRADE_CONTRACT = 2
13
+ }
14
+ /** {@link Transaction} for creating new smart contracts. */
15
+ export interface CreateContractTransaction {
16
+ type: Type.DEPLOY_CONTRACT;
17
+ /** The address that the contract should be deployed at. */
18
+ address: BlockchainAddress;
19
+ /** The binding jar. */
20
+ binderJar: Buffer;
21
+ /** The actual contract. */
22
+ contractJar: Buffer;
23
+ /** The ABI for the contract. */
24
+ abi: Buffer;
25
+ /** The invocation for create. */
26
+ rpc: Buffer;
27
+ }
28
+ /** Interact with contract transaction allows to do any interaction with a contract. rpc bytes
29
+ * defines the input to the interaction.*/
30
+ export interface InteractWithContractTransaction {
31
+ type: Type.INTERACT_CONTRACT;
32
+ /** Address of the contract. */
33
+ address: BlockchainAddress;
34
+ /** Rpc payload for the interaction. */
35
+ rpc: Buffer;
36
+ }
37
+ export declare const InteractWithContractTransaction: {
38
+ read(stream: ByteInput): InteractWithContractTransaction;
39
+ write(stream: ByteOutput, value: InteractWithContractTransaction): void;
40
+ };
41
+ /** Upgrade contract transaction for upgradable contract. */
42
+ export interface UpgradeContractTransaction {
43
+ type: Type.UPGRADE_CONTRACT;
44
+ /** Address of contract to upgrade. */
45
+ address: BlockchainAddress;
46
+ /** New binder jar. */
47
+ newBinderJar: Buffer;
48
+ /** New contract jar. */
49
+ newContractJar: Buffer;
50
+ /** New abi. */
51
+ newAbi: Buffer;
52
+ /** Contract upgrade rpc. */
53
+ rpc: Buffer;
54
+ }
55
+ export declare const Transaction: {
56
+ read(stream: ByteInput): Transaction;
57
+ write(stream: ByteOutput, value: Transaction): void;
58
+ };
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright (C) 2022 - 2025 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.Transaction = exports.InteractWithContractTransaction = exports.Type = void 0;
21
+ const StreamHelper_1 = require("./StreamHelper");
22
+ /** The type of {@link Transaction}. */
23
+ var Type;
24
+ (function (Type) {
25
+ /** Deploy contract. */
26
+ Type[Type["DEPLOY_CONTRACT"] = 0] = "DEPLOY_CONTRACT";
27
+ /** Interact contract. */
28
+ Type[Type["INTERACT_CONTRACT"] = 1] = "INTERACT_CONTRACT";
29
+ /** Upgrade contract. */
30
+ Type[Type["UPGRADE_CONTRACT"] = 2] = "UPGRADE_CONTRACT";
31
+ })(Type || (exports.Type = Type = {}));
32
+ const CreateContractTransaction = {
33
+ read(stream) {
34
+ const address = StreamHelper_1.StreamHelper.readAddress(stream);
35
+ const binderJar = StreamHelper_1.StreamHelper.readDynamicBytes(stream);
36
+ const contractJar = StreamHelper_1.StreamHelper.readDynamicBytes(stream);
37
+ const abi = StreamHelper_1.StreamHelper.readDynamicBytes(stream);
38
+ const rpc = StreamHelper_1.StreamHelper.readDynamicBytes(stream);
39
+ return { type: Type.DEPLOY_CONTRACT, address, binderJar, contractJar, abi, rpc };
40
+ },
41
+ write(stream, value) {
42
+ StreamHelper_1.StreamHelper.writeAddress(stream, value.address);
43
+ StreamHelper_1.StreamHelper.writeDynamicBytes(stream, value.binderJar);
44
+ StreamHelper_1.StreamHelper.writeDynamicBytes(stream, value.contractJar);
45
+ StreamHelper_1.StreamHelper.writeDynamicBytes(stream, value.abi);
46
+ StreamHelper_1.StreamHelper.writeDynamicBytes(stream, value.rpc);
47
+ },
48
+ };
49
+ exports.InteractWithContractTransaction = {
50
+ read(stream) {
51
+ const address = StreamHelper_1.StreamHelper.readAddress(stream);
52
+ const rpc = StreamHelper_1.StreamHelper.readDynamicBytes(stream);
53
+ return { type: Type.INTERACT_CONTRACT, address, rpc };
54
+ },
55
+ write(stream, value) {
56
+ StreamHelper_1.StreamHelper.writeAddress(stream, value.address);
57
+ StreamHelper_1.StreamHelper.writeDynamicBytes(stream, value.rpc);
58
+ },
59
+ };
60
+ const UpgradeContractTransaction = {
61
+ read(stream) {
62
+ const address = StreamHelper_1.StreamHelper.readAddress(stream);
63
+ const newBinderJar = StreamHelper_1.StreamHelper.readDynamicBytes(stream);
64
+ const newContractJar = StreamHelper_1.StreamHelper.readDynamicBytes(stream);
65
+ const newAbi = StreamHelper_1.StreamHelper.readDynamicBytes(stream);
66
+ const rpc = StreamHelper_1.StreamHelper.readDynamicBytes(stream);
67
+ return { type: Type.UPGRADE_CONTRACT, address, newBinderJar, newContractJar, newAbi, rpc };
68
+ },
69
+ write(stream, value) {
70
+ StreamHelper_1.StreamHelper.writeAddress(stream, value.address);
71
+ StreamHelper_1.StreamHelper.writeDynamicBytes(stream, value.newBinderJar);
72
+ StreamHelper_1.StreamHelper.writeDynamicBytes(stream, value.newContractJar);
73
+ StreamHelper_1.StreamHelper.writeDynamicBytes(stream, value.newAbi);
74
+ StreamHelper_1.StreamHelper.writeDynamicBytes(stream, value.rpc);
75
+ },
76
+ };
77
+ exports.Transaction = {
78
+ read(stream) {
79
+ const type = stream.readU8();
80
+ switch (type) {
81
+ case Type.DEPLOY_CONTRACT:
82
+ return CreateContractTransaction.read(stream);
83
+ case Type.INTERACT_CONTRACT:
84
+ return exports.InteractWithContractTransaction.read(stream);
85
+ case Type.UPGRADE_CONTRACT:
86
+ return UpgradeContractTransaction.read(stream);
87
+ }
88
+ },
89
+ write(stream, value) {
90
+ stream.writeU8(value.type);
91
+ switch (value.type) {
92
+ case Type.DEPLOY_CONTRACT:
93
+ return CreateContractTransaction.write(stream, value);
94
+ case Type.INTERACT_CONTRACT:
95
+ return exports.InteractWithContractTransaction.write(stream, value);
96
+ case Type.UPGRADE_CONTRACT:
97
+ return UpgradeContractTransaction.write(stream, value);
98
+ }
99
+ },
100
+ };
101
+ //# sourceMappingURL=Transaction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Transaction.js","sourceRoot":"","sources":["../../../../src/main/transaction/model/Transaction.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;AAIH,iDAA8C;AAQ9C,uCAAuC;AACvC,IAAY,IAOX;AAPD,WAAY,IAAI;IACd,uBAAuB;IACvB,qDAAe,CAAA;IACf,yBAAyB;IACzB,yDAAiB,CAAA;IACjB,wBAAwB;IACxB,uDAAgB,CAAA;AAClB,CAAC,EAPW,IAAI,oBAAJ,IAAI,QAOf;AAiBD,MAAM,yBAAyB,GAAG;IAChC,IAAI,CAAC,MAAiB;QACpB,MAAM,OAAO,GAAG,2BAAY,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;QACjD,MAAM,SAAS,GAAG,2BAAY,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;QACxD,MAAM,WAAW,GAAG,2BAAY,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;QAC1D,MAAM,GAAG,GAAG,2BAAY,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;QAClD,MAAM,GAAG,GAAG,2BAAY,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;QAClD,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,eAAe,EAAE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;I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AAK,CAAC,IAAI,EAAE,CAAC;YACnB,KAAK,IAAI,CAAC,eAAe;gBACvB,OAAO,yBAAyB,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;YACxD,KAAK,IAAI,CAAC,iBAAiB;gBACzB,OAAO,uCAA+B,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;YAC9D,KAAK,IAAI,CAAC,gBAAgB;gBACxB,OAAO,0BAA0B,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QAC3D,CAAC;IACH,CAAC;CACF,CAAC"}
@@ -1,7 +0,0 @@
1
- import { AbstractBuilder } from "../builder/AbstractBuilder";
2
- export declare class TransactionBuilder extends AbstractBuilder {
3
- private constructor();
4
- static createTransactionBuilder(): TransactionBuilder;
5
- static createEventBuilder(): TransactionBuilder;
6
- getBytes(): Buffer;
7
- }
@@ -1,47 +0,0 @@
1
- "use strict";
2
- /*
3
- * Copyright (C) 2022 - 2025 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.TransactionBuilder = void 0;
21
- const AbstractBuilder_1 = require("../builder/AbstractBuilder");
22
- const AbiParser_1 = require("../parser/AbiParser");
23
- const TransactionAndEventDeserialization_1 = require("../TransactionAndEventDeserialization");
24
- const StructProducer_1 = require("../builder/StructProducer");
25
- const AbiByteOutput_1 = require("../abistreams/AbiByteOutput");
26
- class TransactionBuilder extends AbstractBuilder_1.AbstractBuilder {
27
- constructor(contractAbi, aggregateProducer) {
28
- super(contractAbi.namedTypes, "", aggregateProducer);
29
- }
30
- static createTransactionBuilder() {
31
- const transactionAbi = new AbiParser_1.AbiParser(TransactionAndEventDeserialization_1.TRANSACTION_AND_EVENT_ABI).parseAbi()
32
- .chainComponent;
33
- const signedTransaction = transactionAbi.namedTypes.find((namedType) => namedType.name === "SignedTransaction");
34
- return new TransactionBuilder(transactionAbi, new StructProducer_1.StructProducer(signedTransaction, "root"));
35
- }
36
- static createEventBuilder() {
37
- const transactionAbi = new AbiParser_1.AbiParser(TransactionAndEventDeserialization_1.TRANSACTION_AND_EVENT_ABI).parseAbi()
38
- .chainComponent;
39
- const signedTransaction = transactionAbi.namedTypes.find((namedType) => namedType.name === "ExecutableEvent");
40
- return new TransactionBuilder(transactionAbi, new StructProducer_1.StructProducer(signedTransaction, "root"));
41
- }
42
- getBytes() {
43
- return AbiByteOutput_1.AbiByteOutput.serializeBigEndian((out) => this.getAggregateProducer().write(out));
44
- }
45
- }
46
- exports.TransactionBuilder = TransactionBuilder;
47
- //# sourceMappingURL=TransactionBuilder.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TransactionBuilder.js","sourceRoot":"","sources":["../../../src/main/transaction/TransactionBuilder.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;AAEH,gEAA6D;AAG7D,mDAAgD;AAChD,8FAAkF;AAElF,8DAA2D;AAC3D,+DAA4D;AAE5D,MAAa,kBAAmB,SAAQ,iCAAe;IACrD,YAAoB,WAAwB,EAAE,iBAAoC;QAChF,KAAK,CAAC,WAAW,CAAC,UAAU,EAAE,EAAE,EAAE,iBAAiB,CAAC,CAAC;IACvD,CAAC;IAEM,MAAM,CAAC,wBAAwB;QACpC,MAAM,cAAc,GAAG,IAAI,qBAAS,CAAC,8DAAyB,CAAC,CAAC,QAAQ,EAAE;aACvE,cAA6B,CAAC;QACjC,MAAM,iBAAiB,GAAG,cAAc,CAAC,UAAU,CAAC,IAAI,CACtD,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,KAAK,mBAAmB,CACpC,CAAC;QACpB,OAAO,IAAI,kBAAkB,CAAC,cAAc,EAAE,IAAI,+BAAc,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC,CAAC;IAC/F,CAAC;IAEM,MAAM,CAAC,kBAAkB;QAC9B,MAAM,cAAc,GAAG,IAAI,qBAAS,CAAC,8DAAyB,CAAC,CAAC,QAAQ,EAAE;aACvE,cAA6B,CAAC;QACjC,MAAM,iBAAiB,GAAG,cAAc,CAAC,UAAU,CAAC,IAAI,CACtD,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,KAAK,iBAAiB,CAClC,CAAC;QACpB,OAAO,IAAI,kBAAkB,CAAC,cAAc,EAAE,IAAI,+BAAc,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC,CAAC;IAC/F,CAAC;IAEM,QAAQ;QACb,OAAO,6BAAa,CAAC,kBAAkB,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;IAC3F,CAAC;CACF;AA1BD,gDA0BC"}
@@ -1,19 +0,0 @@
1
- import { BigEndianByteInput } from "@secata-public/bitmanipulation-ts";
2
- import { AbstractReader } from "../AbstractReader";
3
- import { ContractAbi } from "../model/ContractAbi";
4
- import { ScValueMap } from "../value/ScValueMap";
5
- import { ScValueSet } from "../value/ScValueSet";
6
- import { ScValueStruct } from "../value/ScValueStruct";
7
- import { ScValueAvlTreeMap } from "../value/ScValueAvlTreeMap";
8
- export declare class TransactionReader extends AbstractReader {
9
- private readonly contract;
10
- private static readonly CONTRACT_ABI;
11
- constructor(input: BigEndianByteInput | Buffer, contract: ContractAbi);
12
- protected readMap(): ScValueMap;
13
- protected readSet(): ScValueSet;
14
- protected readAvlTreeMap(): ScValueAvlTreeMap;
15
- checkAllBytesRead(): void;
16
- static deserializeEventPayload(payload: Buffer): ScValueStruct;
17
- static deserializeTransactionPayload(payload: Buffer): ScValueStruct;
18
- static getContractAbi(): ContractAbi;
19
- }
@@ -1,74 +0,0 @@
1
- "use strict";
2
- /*
3
- * Copyright (C) 2022 - 2025 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.TransactionReader = void 0;
21
- const bitmanipulation_ts_1 = require("@secata-public/bitmanipulation-ts");
22
- const AbiByteInput_1 = require("../abistreams/AbiByteInput");
23
- const AbstractReader_1 = require("../AbstractReader");
24
- const AbiParser_1 = require("../parser/AbiParser");
25
- const TransactionAndEventDeserialization_1 = require("../TransactionAndEventDeserialization");
26
- class TransactionReader extends AbstractReader_1.AbstractReader {
27
- constructor(input, contract) {
28
- let byteInput;
29
- if ("length" in input) {
30
- byteInput = new bitmanipulation_ts_1.BigEndianByteInput(input);
31
- }
32
- else {
33
- byteInput = new bitmanipulation_ts_1.BigEndianByteInput(input.readRemaining());
34
- }
35
- super(new AbiByteInput_1.AbiByteInput(byteInput), contract.namedTypes);
36
- this.contract = contract;
37
- }
38
- readMap() {
39
- throw new Error("Type Map is not supported in rpc");
40
- }
41
- readSet() {
42
- throw new Error("Type Set is not supported in rpc");
43
- }
44
- readAvlTreeMap() {
45
- throw new Error("Type AvlTreeMap is not supported in rpc");
46
- }
47
- checkAllBytesRead() {
48
- const remaining = this.input.readRemaining();
49
- if (remaining.length != 0) {
50
- throw new Error("The input wasn't fully read, " + remaining.length + " remaining bytes.");
51
- }
52
- }
53
- static deserializeEventPayload(payload) {
54
- const reader = new TransactionReader(payload, TransactionReader.CONTRACT_ABI);
55
- const executableEvent = reader.contract.namedTypes.find((namedType) => namedType.name === "ExecutableEvent");
56
- const res = reader.readStruct(executableEvent);
57
- reader.checkAllBytesRead();
58
- return res;
59
- }
60
- static deserializeTransactionPayload(payload) {
61
- const reader = new TransactionReader(payload, TransactionReader.CONTRACT_ABI);
62
- const signedTransaction = reader.contract.namedTypes.find((namedType) => namedType.name === "SignedTransaction");
63
- const res = reader.readStruct(signedTransaction);
64
- reader.checkAllBytesRead();
65
- return res;
66
- }
67
- static getContractAbi() {
68
- return this.CONTRACT_ABI;
69
- }
70
- }
71
- exports.TransactionReader = TransactionReader;
72
- TransactionReader.CONTRACT_ABI = new AbiParser_1.AbiParser(TransactionAndEventDeserialization_1.TRANSACTION_AND_EVENT_ABI).parseAbi()
73
- .chainComponent;
74
- //# sourceMappingURL=TransactionReader.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TransactionReader.js","sourceRoot":"","sources":["../../../src/main/transaction/TransactionReader.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;AAEH,0EAAuE;AACvE,6DAA0D;AAC1D,sDAAmD;AACnD,mDAAgD;AAEhD,8FAAkF;AAOlF,MAAa,iBAAkB,SAAQ,+BAAc;IAKnD,YAAY,KAAkC,EAAE,QAAqB;QACnE,IAAI,SAAS,CAAC;QACd,IAAI,QAAQ,IAAI,KAAK,EAAE,CAAC;YACtB,SAAS,GAAG,IAAI,uCAAkB,CAAC,KAAK,CAAC,CAAC;QAC5C,CAAC;aAAM,CAAC;YACN,SAAS,GAAG,IAAI,uCAAkB,CAAC,KAAK,CAAC,aAAa,EAAE,CAAC,CAAC;QAC5D,CAAC;QACD,KAAK,CAAC,IAAI,2BAAY,CAAC,SAAS,CAAC,EAAE,QAAQ,CAAC,UA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