@partisiablockchain/abi-client 6.49.0 → 6.79.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.
- package/package.json +3 -3
- package/target/main/AccountPluginInvocationDeserialization.js +4 -4
- package/target/main/AccountPluginInvocationDeserialization.js.map +1 -1
- package/target/main/TransactionAndEventDeserialization.js +1 -1
- package/target/main/TransactionAndEventDeserialization.js.map +1 -1
- package/target/main/index.d.ts +7 -2
- package/target/main/index.js +22 -6
- package/target/main/index.js.map +1 -1
- package/target/main/transaction/TransactionSerialization.d.ts +7 -0
- package/target/main/transaction/TransactionSerialization.js +49 -0
- package/target/main/transaction/TransactionSerialization.js.map +1 -0
- package/target/main/transaction/model/InnerEvent.d.ts +73 -0
- package/target/main/transaction/model/InnerEvent.js +140 -0
- package/target/main/transaction/model/InnerEvent.js.map +1 -0
- package/target/main/transaction/model/InnerSystemEvent.d.ts +150 -0
- package/target/main/transaction/model/InnerSystemEvent.js +279 -0
- package/target/main/transaction/model/InnerSystemEvent.js.map +1 -0
- package/target/main/transaction/model/Model.d.ts +81 -0
- package/target/main/transaction/model/Model.js +121 -0
- package/target/main/transaction/model/Model.js.map +1 -0
- package/target/main/transaction/model/StreamHelper.d.ts +16 -0
- package/target/main/transaction/model/StreamHelper.js +70 -0
- package/target/main/transaction/model/StreamHelper.js.map +1 -0
- package/target/main/transaction/model/Transaction.d.ts +58 -0
- package/target/main/transaction/model/Transaction.js +101 -0
- package/target/main/transaction/model/Transaction.js.map +1 -0
- package/target/main/transaction/TransactionBuilder.d.ts +0 -7
- package/target/main/transaction/TransactionBuilder.js +0 -47
- package/target/main/transaction/TransactionBuilder.js.map +0 -1
- package/target/main/transaction/TransactionReader.d.ts +0 -19
- package/target/main/transaction/TransactionReader.js +0 -74
- package/target/main/transaction/TransactionReader.js.map +0 -1
|
@@ -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,MAAM,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;IAC5D,CAAC;IAED,aAAa,CACX,MAAkB,EAClB,KAAoB,EACpB,MAA8C;QAE9C,MAAM,MAAM,GAAG,KAAK,KAAK,SAAS,CAAC;QACnC,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;QAC5B,IAAI,MAAM,EAAE,CAAC;YACX,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QACxB,CAAC;IACH,CAAC;IACD,SAAS,CAAC,MAAkB,EAAE,KAAW;QACvC,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;IAC/C,CAAC;IACD,YAAY,CAAC,MAAkB,EAAE,KAAwB;QACvD,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;IAC/C,CAAC;IACD,cAAc,CAAC,MAAkB,EAAE,KAAgB;QACjD,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;IAC/C,CAAC;IACD,iBAAiB,CAAC,MAAkB,EAAE,KAAa;QACjD,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAC9B,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC;IACD,gBAAgB,CACd,MAAkB,EAClB,KAAU,EACV,MAA8C;QAE9C,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAC9B,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC;IAC1C,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { BlockchainAddress } from "./Model";
|
|
2
|
+
import { ByteInput, 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;IACnF,CAAC;IAED,KAAK,CAAC,MAAkB,EAAE,KAAgC;QACxD,2BAAY,CAAC,YAAY,CAAC,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QACjD,2BAAY,CAAC,iBAAiB,CAAC,MAAM,EAAE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B,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,+D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ractAbi } 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,UAAU,CAAC,CAAC;QACxD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAES,OAAO;QACf,MAAM,IA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