@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,150 @@
|
|
|
1
|
+
import { EventType } from "./InnerEvent";
|
|
2
|
+
import { BlockchainAddress, ChainPluginType, Hash, ReturnEnvelope } from "./Model";
|
|
3
|
+
import { ByteInput, ByteOutput } from "@secata-public/bitmanipulation-ts";
|
|
4
|
+
/** Event for manipulating the system state of the blockchain. */
|
|
5
|
+
export type InnerSystemEvent = {
|
|
6
|
+
eventType: EventType.SYSTEM;
|
|
7
|
+
} & SystemEvent;
|
|
8
|
+
type SystemEvent = CreateAccountEvent | CheckExistenceEvent | SetFeatureEvent | UpdateLocalPluginStateEvent | UpdateGlobalPluginStateEvent | UpdatePluginEvent | CallbackEvent | CreateShardEvent | RemoveShardEvent | UpdateContextFreePluginState | UpgradeSystemContractEvent | RemoveContract;
|
|
9
|
+
/** Type of system event. */
|
|
10
|
+
export declare enum SystemEventType {
|
|
11
|
+
/** Create account. */
|
|
12
|
+
CREATE_ACCOUNT = 0,
|
|
13
|
+
/** Check existence. */
|
|
14
|
+
CHECK_EXISTENCE = 1,
|
|
15
|
+
/** Set feature. */
|
|
16
|
+
SET_FEATURE = 2,
|
|
17
|
+
/** Update local plugin state. */
|
|
18
|
+
UPDATE_LOCAL_PLUGIN_STATE = 3,
|
|
19
|
+
/** Update global plugin state. */
|
|
20
|
+
UPDATE_GLOBAL_PLUGIN_STATE = 4,
|
|
21
|
+
/** Update plugin. */
|
|
22
|
+
UPDATE_PLUGIN = 5,
|
|
23
|
+
/** Callback. */
|
|
24
|
+
CALLBACK = 6,
|
|
25
|
+
/** Create shard. */
|
|
26
|
+
CREATE_SHARD = 7,
|
|
27
|
+
/** Remove shard. */
|
|
28
|
+
REMOVE_SHARD = 8,
|
|
29
|
+
/** Update context free plugin state. */
|
|
30
|
+
UPDATE_CONTEXT_FREE_PLUGIN_STATE = 9,
|
|
31
|
+
/** Upgrade system contract. */
|
|
32
|
+
UPGRADE_SYSTEM_CONTRACT = 10,
|
|
33
|
+
/** Remove an existing contract from the state. */
|
|
34
|
+
REMOVE_CONTRACT = 11
|
|
35
|
+
}
|
|
36
|
+
/** Event for creating an account.*/
|
|
37
|
+
export interface CreateAccountEvent {
|
|
38
|
+
systemEventType: SystemEventType.CREATE_ACCOUNT;
|
|
39
|
+
/** Address of account to create. */
|
|
40
|
+
toCreate: BlockchainAddress;
|
|
41
|
+
}
|
|
42
|
+
/** Event for checking existence of an account or contract. */
|
|
43
|
+
export interface CheckExistenceEvent {
|
|
44
|
+
systemEventType: SystemEventType.CHECK_EXISTENCE;
|
|
45
|
+
/** Address to check for existence. */
|
|
46
|
+
contractOrAccountAddress: BlockchainAddress;
|
|
47
|
+
}
|
|
48
|
+
/** Event for setting a feature in the state. */
|
|
49
|
+
export interface SetFeatureEvent {
|
|
50
|
+
systemEventType: SystemEventType.SET_FEATURE;
|
|
51
|
+
/** Indicates feature to set. */
|
|
52
|
+
key: string;
|
|
53
|
+
/** Value to set on feature. */
|
|
54
|
+
value: string | undefined;
|
|
55
|
+
}
|
|
56
|
+
/** An event to update the local state of a plugin. */
|
|
57
|
+
export interface UpdateLocalPluginStateEvent {
|
|
58
|
+
systemEventType: SystemEventType.UPDATE_LOCAL_PLUGIN_STATE;
|
|
59
|
+
/** The type of plugin to update. */
|
|
60
|
+
type: ChainPluginType;
|
|
61
|
+
/** An update to the local state of a plugin. */
|
|
62
|
+
update: LocalPluginStateUpdate;
|
|
63
|
+
}
|
|
64
|
+
/** Update to be performed against the local state of a plugin. */
|
|
65
|
+
export interface LocalPluginStateUpdate {
|
|
66
|
+
/** Address for plugin. */
|
|
67
|
+
context: BlockchainAddress;
|
|
68
|
+
/** Invocation data. */
|
|
69
|
+
rpc: Buffer;
|
|
70
|
+
}
|
|
71
|
+
/** Event for updating the global state of a plugin. */
|
|
72
|
+
export interface UpdateGlobalPluginStateEvent {
|
|
73
|
+
systemEventType: SystemEventType.UPDATE_GLOBAL_PLUGIN_STATE;
|
|
74
|
+
/** The type of plugin to update. */
|
|
75
|
+
type: ChainPluginType;
|
|
76
|
+
/** An update to the global state of a plugin. */
|
|
77
|
+
update: GlobalPluginStateUpdate;
|
|
78
|
+
}
|
|
79
|
+
/** An update that is to be performed against the global state of a plugin. */
|
|
80
|
+
export interface GlobalPluginStateUpdate {
|
|
81
|
+
/** Invocation data. */
|
|
82
|
+
rpc: Buffer;
|
|
83
|
+
}
|
|
84
|
+
/** Event for changing an active plugin. */
|
|
85
|
+
export interface UpdatePluginEvent {
|
|
86
|
+
systemEventType: SystemEventType.UPDATE_PLUGIN;
|
|
87
|
+
/** The type of plugin to update. */
|
|
88
|
+
type: ChainPluginType;
|
|
89
|
+
/** The jar to use as plugin. */
|
|
90
|
+
jar: Buffer | undefined;
|
|
91
|
+
/** Global state migration rpc. */
|
|
92
|
+
invocation: Buffer;
|
|
93
|
+
}
|
|
94
|
+
/** Callback sent when a transaction has been executed. */
|
|
95
|
+
export interface CallbackEvent {
|
|
96
|
+
systemEventType: SystemEventType.CALLBACK;
|
|
97
|
+
/** The destination for this callback. */
|
|
98
|
+
returnEnvelope: ReturnEnvelope;
|
|
99
|
+
/** The transaction that just has completed. */
|
|
100
|
+
completedTransaction: Hash;
|
|
101
|
+
/** Whether the transaction was successful. */
|
|
102
|
+
success: boolean;
|
|
103
|
+
/** Return value of the callback event. */
|
|
104
|
+
returnValue: Buffer;
|
|
105
|
+
}
|
|
106
|
+
/** Event for creating a shard. */
|
|
107
|
+
export interface CreateShardEvent {
|
|
108
|
+
systemEventType: SystemEventType.CREATE_SHARD;
|
|
109
|
+
/** Id of the shard. */
|
|
110
|
+
shardId: string;
|
|
111
|
+
}
|
|
112
|
+
/** Event for removing a shard. */
|
|
113
|
+
export interface RemoveShardEvent {
|
|
114
|
+
systemEventType: SystemEventType.REMOVE_SHARD;
|
|
115
|
+
/** Id of the shard. */
|
|
116
|
+
shardId: string;
|
|
117
|
+
}
|
|
118
|
+
/** An event to update the local state of a plugin without context on a named shard. */
|
|
119
|
+
export interface UpdateContextFreePluginState {
|
|
120
|
+
systemEventType: SystemEventType.UPDATE_CONTEXT_FREE_PLUGIN_STATE;
|
|
121
|
+
/** The type of plugin to update. */
|
|
122
|
+
type: ChainPluginType;
|
|
123
|
+
/** Local state migration rpc. */
|
|
124
|
+
rpc: Buffer;
|
|
125
|
+
}
|
|
126
|
+
/** Event for upgrading a system contract. */
|
|
127
|
+
export interface UpgradeSystemContractEvent {
|
|
128
|
+
systemEventType: SystemEventType.UPGRADE_SYSTEM_CONTRACT;
|
|
129
|
+
/** The contract. */
|
|
130
|
+
contractJar: Buffer;
|
|
131
|
+
/** The binder. */
|
|
132
|
+
binderJar: Buffer;
|
|
133
|
+
/** The abi for the contract. */
|
|
134
|
+
abi: Buffer;
|
|
135
|
+
/** The invocation. */
|
|
136
|
+
rpc: Buffer;
|
|
137
|
+
/** The address of the contract. */
|
|
138
|
+
contractAddress: BlockchainAddress;
|
|
139
|
+
}
|
|
140
|
+
/** System event used to remove a contract from the chain state. */
|
|
141
|
+
export interface RemoveContract {
|
|
142
|
+
systemEventType: SystemEventType.REMOVE_CONTRACT;
|
|
143
|
+
/** The contract that should be removed. */
|
|
144
|
+
contractAddress: BlockchainAddress;
|
|
145
|
+
}
|
|
146
|
+
export declare const InnerSystemEvent: {
|
|
147
|
+
read(stream: ByteInput): InnerSystemEvent;
|
|
148
|
+
write(stream: ByteOutput, value: InnerSystemEvent): void;
|
|
149
|
+
};
|
|
150
|
+
export {};
|
|
@@ -0,0 +1,279 @@
|
|
|
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.InnerSystemEvent = exports.SystemEventType = void 0;
|
|
21
|
+
const InnerEvent_1 = require("./InnerEvent");
|
|
22
|
+
const Model_1 = require("./Model");
|
|
23
|
+
const StreamHelper_1 = require("./StreamHelper");
|
|
24
|
+
/** Type of system event. */
|
|
25
|
+
var SystemEventType;
|
|
26
|
+
(function (SystemEventType) {
|
|
27
|
+
/** Create account. */
|
|
28
|
+
SystemEventType[SystemEventType["CREATE_ACCOUNT"] = 0] = "CREATE_ACCOUNT";
|
|
29
|
+
/** Check existence. */
|
|
30
|
+
SystemEventType[SystemEventType["CHECK_EXISTENCE"] = 1] = "CHECK_EXISTENCE";
|
|
31
|
+
/** Set feature. */
|
|
32
|
+
SystemEventType[SystemEventType["SET_FEATURE"] = 2] = "SET_FEATURE";
|
|
33
|
+
/** Update local plugin state. */
|
|
34
|
+
SystemEventType[SystemEventType["UPDATE_LOCAL_PLUGIN_STATE"] = 3] = "UPDATE_LOCAL_PLUGIN_STATE";
|
|
35
|
+
/** Update global plugin state. */
|
|
36
|
+
SystemEventType[SystemEventType["UPDATE_GLOBAL_PLUGIN_STATE"] = 4] = "UPDATE_GLOBAL_PLUGIN_STATE";
|
|
37
|
+
/** Update plugin. */
|
|
38
|
+
SystemEventType[SystemEventType["UPDATE_PLUGIN"] = 5] = "UPDATE_PLUGIN";
|
|
39
|
+
/** Callback. */
|
|
40
|
+
SystemEventType[SystemEventType["CALLBACK"] = 6] = "CALLBACK";
|
|
41
|
+
/** Create shard. */
|
|
42
|
+
SystemEventType[SystemEventType["CREATE_SHARD"] = 7] = "CREATE_SHARD";
|
|
43
|
+
/** Remove shard. */
|
|
44
|
+
SystemEventType[SystemEventType["REMOVE_SHARD"] = 8] = "REMOVE_SHARD";
|
|
45
|
+
/** Update context free plugin state. */
|
|
46
|
+
SystemEventType[SystemEventType["UPDATE_CONTEXT_FREE_PLUGIN_STATE"] = 9] = "UPDATE_CONTEXT_FREE_PLUGIN_STATE";
|
|
47
|
+
/** Upgrade system contract. */
|
|
48
|
+
SystemEventType[SystemEventType["UPGRADE_SYSTEM_CONTRACT"] = 10] = "UPGRADE_SYSTEM_CONTRACT";
|
|
49
|
+
/** Remove an existing contract from the state. */
|
|
50
|
+
SystemEventType[SystemEventType["REMOVE_CONTRACT"] = 11] = "REMOVE_CONTRACT";
|
|
51
|
+
})(SystemEventType || (exports.SystemEventType = SystemEventType = {}));
|
|
52
|
+
const CreateAccountEvent = {
|
|
53
|
+
read(stream) {
|
|
54
|
+
const toCreate = StreamHelper_1.StreamHelper.readAddress(stream);
|
|
55
|
+
return { systemEventType: SystemEventType.CREATE_ACCOUNT, toCreate };
|
|
56
|
+
},
|
|
57
|
+
write(stream, value) {
|
|
58
|
+
StreamHelper_1.StreamHelper.writeAddress(stream, value.toCreate);
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
const CheckExistenceEvent = {
|
|
62
|
+
read(stream) {
|
|
63
|
+
const contractOrAccountAddress = StreamHelper_1.StreamHelper.readAddress(stream);
|
|
64
|
+
return { systemEventType: SystemEventType.CHECK_EXISTENCE, contractOrAccountAddress };
|
|
65
|
+
},
|
|
66
|
+
write(stream, value) {
|
|
67
|
+
StreamHelper_1.StreamHelper.writeAddress(stream, value.contractOrAccountAddress);
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
const SetFeatureEvent = {
|
|
71
|
+
read(stream) {
|
|
72
|
+
const key = stream.readString();
|
|
73
|
+
const value = StreamHelper_1.StreamHelper.readOptional(stream, (stream) => stream.readString());
|
|
74
|
+
return { systemEventType: SystemEventType.SET_FEATURE, key, value };
|
|
75
|
+
},
|
|
76
|
+
write(stream, value) {
|
|
77
|
+
stream.writeString(value.key);
|
|
78
|
+
StreamHelper_1.StreamHelper.writeOptional(stream, value.value, (stream, value) => stream.writeString(value));
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
const UpdateLocalPluginStateEvent = {
|
|
82
|
+
read(stream) {
|
|
83
|
+
const type = stream.readU8();
|
|
84
|
+
const update = LocalPluginStateUpdate.read(stream);
|
|
85
|
+
return { systemEventType: SystemEventType.UPDATE_LOCAL_PLUGIN_STATE, type, update };
|
|
86
|
+
},
|
|
87
|
+
write(stream, value) {
|
|
88
|
+
stream.writeU8(value.type);
|
|
89
|
+
LocalPluginStateUpdate.write(stream, value.update);
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
const LocalPluginStateUpdate = {
|
|
93
|
+
read(stream) {
|
|
94
|
+
const context = StreamHelper_1.StreamHelper.readAddress(stream);
|
|
95
|
+
const rpc = StreamHelper_1.StreamHelper.readDynamicBytes(stream);
|
|
96
|
+
return { context, rpc };
|
|
97
|
+
},
|
|
98
|
+
write(stream, value) {
|
|
99
|
+
StreamHelper_1.StreamHelper.writeAddress(stream, value.context);
|
|
100
|
+
StreamHelper_1.StreamHelper.writeDynamicBytes(stream, value.rpc);
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
const UpdateGlobalPluginStateEvent = {
|
|
104
|
+
read(stream) {
|
|
105
|
+
const type = stream.readU8();
|
|
106
|
+
const update = GlobalPluginStateUpdate.read(stream);
|
|
107
|
+
return { systemEventType: SystemEventType.UPDATE_GLOBAL_PLUGIN_STATE, type, update };
|
|
108
|
+
},
|
|
109
|
+
write(stream, value) {
|
|
110
|
+
stream.writeU8(value.type);
|
|
111
|
+
GlobalPluginStateUpdate.write(stream, value.update);
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
const GlobalPluginStateUpdate = {
|
|
115
|
+
read(stream) {
|
|
116
|
+
const rpc = StreamHelper_1.StreamHelper.readDynamicBytes(stream);
|
|
117
|
+
return { rpc };
|
|
118
|
+
},
|
|
119
|
+
write(stream, value) {
|
|
120
|
+
StreamHelper_1.StreamHelper.writeDynamicBytes(stream, value.rpc);
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
const UpdatePluginEvent = {
|
|
124
|
+
read(stream) {
|
|
125
|
+
const type = stream.readU8();
|
|
126
|
+
const jar = StreamHelper_1.StreamHelper.readOptional(stream, StreamHelper_1.StreamHelper.readDynamicBytes);
|
|
127
|
+
const invocation = StreamHelper_1.StreamHelper.readDynamicBytes(stream);
|
|
128
|
+
return { systemEventType: SystemEventType.UPDATE_PLUGIN, type, jar, invocation };
|
|
129
|
+
},
|
|
130
|
+
write(stream, value) {
|
|
131
|
+
stream.writeU8(value.type);
|
|
132
|
+
StreamHelper_1.StreamHelper.writeOptional(stream, value.jar, StreamHelper_1.StreamHelper.writeDynamicBytes);
|
|
133
|
+
StreamHelper_1.StreamHelper.writeDynamicBytes(stream, value.invocation);
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
const CallbackEvent = {
|
|
137
|
+
read(stream) {
|
|
138
|
+
const returnEnvelope = Model_1.ReturnEnvelope.read(stream);
|
|
139
|
+
const completedTransaction = StreamHelper_1.StreamHelper.readHash(stream);
|
|
140
|
+
const success = stream.readBoolean();
|
|
141
|
+
const returnValue = StreamHelper_1.StreamHelper.readDynamicBytes(stream);
|
|
142
|
+
return {
|
|
143
|
+
systemEventType: SystemEventType.CALLBACK,
|
|
144
|
+
returnEnvelope,
|
|
145
|
+
success,
|
|
146
|
+
completedTransaction,
|
|
147
|
+
returnValue,
|
|
148
|
+
};
|
|
149
|
+
},
|
|
150
|
+
write(stream, value) {
|
|
151
|
+
Model_1.ReturnEnvelope.write(stream, value.returnEnvelope);
|
|
152
|
+
StreamHelper_1.StreamHelper.writeHash(stream, value.completedTransaction);
|
|
153
|
+
stream.writeBoolean(value.success);
|
|
154
|
+
StreamHelper_1.StreamHelper.writeDynamicBytes(stream, value.returnValue);
|
|
155
|
+
},
|
|
156
|
+
};
|
|
157
|
+
const CreateShardEvent = {
|
|
158
|
+
read(stream) {
|
|
159
|
+
const shardId = stream.readString();
|
|
160
|
+
return { systemEventType: SystemEventType.CREATE_SHARD, shardId };
|
|
161
|
+
},
|
|
162
|
+
write(stream, value) {
|
|
163
|
+
stream.writeString(value.shardId);
|
|
164
|
+
},
|
|
165
|
+
};
|
|
166
|
+
const RemoveShardEvent = {
|
|
167
|
+
read(stream) {
|
|
168
|
+
const shardId = stream.readString();
|
|
169
|
+
return { systemEventType: SystemEventType.REMOVE_SHARD, shardId };
|
|
170
|
+
},
|
|
171
|
+
write(stream, value) {
|
|
172
|
+
stream.writeString(value.shardId);
|
|
173
|
+
},
|
|
174
|
+
};
|
|
175
|
+
const UpdateContextFreePluginState = {
|
|
176
|
+
read(stream) {
|
|
177
|
+
const type = stream.readU8();
|
|
178
|
+
const rpc = StreamHelper_1.StreamHelper.readDynamicBytes(stream);
|
|
179
|
+
return { systemEventType: SystemEventType.UPDATE_CONTEXT_FREE_PLUGIN_STATE, type, rpc };
|
|
180
|
+
},
|
|
181
|
+
write(stream, value) {
|
|
182
|
+
stream.writeU8(value.type);
|
|
183
|
+
StreamHelper_1.StreamHelper.writeDynamicBytes(stream, value.rpc);
|
|
184
|
+
},
|
|
185
|
+
};
|
|
186
|
+
const UpgradeSystemContractEvent = {
|
|
187
|
+
read(stream) {
|
|
188
|
+
const contractJar = StreamHelper_1.StreamHelper.readDynamicBytes(stream);
|
|
189
|
+
const binderJar = StreamHelper_1.StreamHelper.readDynamicBytes(stream);
|
|
190
|
+
const abi = StreamHelper_1.StreamHelper.readDynamicBytes(stream);
|
|
191
|
+
const rpc = StreamHelper_1.StreamHelper.readDynamicBytes(stream);
|
|
192
|
+
const contractAddress = StreamHelper_1.StreamHelper.readAddress(stream);
|
|
193
|
+
return {
|
|
194
|
+
systemEventType: SystemEventType.UPGRADE_SYSTEM_CONTRACT,
|
|
195
|
+
contractJar,
|
|
196
|
+
binderJar,
|
|
197
|
+
abi,
|
|
198
|
+
rpc,
|
|
199
|
+
contractAddress,
|
|
200
|
+
};
|
|
201
|
+
},
|
|
202
|
+
write(stream, value) {
|
|
203
|
+
StreamHelper_1.StreamHelper.writeDynamicBytes(stream, value.contractJar);
|
|
204
|
+
StreamHelper_1.StreamHelper.writeDynamicBytes(stream, value.binderJar);
|
|
205
|
+
StreamHelper_1.StreamHelper.writeDynamicBytes(stream, value.abi);
|
|
206
|
+
StreamHelper_1.StreamHelper.writeDynamicBytes(stream, value.rpc);
|
|
207
|
+
StreamHelper_1.StreamHelper.writeAddress(stream, value.contractAddress);
|
|
208
|
+
},
|
|
209
|
+
};
|
|
210
|
+
const RemoveContract = {
|
|
211
|
+
read(stream) {
|
|
212
|
+
const contractAddress = StreamHelper_1.StreamHelper.readAddress(stream);
|
|
213
|
+
return { systemEventType: SystemEventType.REMOVE_CONTRACT, contractAddress };
|
|
214
|
+
},
|
|
215
|
+
write(stream, value) {
|
|
216
|
+
StreamHelper_1.StreamHelper.writeAddress(stream, value.contractAddress);
|
|
217
|
+
},
|
|
218
|
+
};
|
|
219
|
+
exports.InnerSystemEvent = {
|
|
220
|
+
read(stream) {
|
|
221
|
+
const systemEventType = stream.readU8();
|
|
222
|
+
switch (systemEventType) {
|
|
223
|
+
case SystemEventType.CREATE_ACCOUNT:
|
|
224
|
+
return Object.assign({ eventType: InnerEvent_1.EventType.SYSTEM }, CreateAccountEvent.read(stream));
|
|
225
|
+
case SystemEventType.CHECK_EXISTENCE:
|
|
226
|
+
return Object.assign({ eventType: InnerEvent_1.EventType.SYSTEM }, CheckExistenceEvent.read(stream));
|
|
227
|
+
case SystemEventType.SET_FEATURE:
|
|
228
|
+
return Object.assign({ eventType: InnerEvent_1.EventType.SYSTEM }, SetFeatureEvent.read(stream));
|
|
229
|
+
case SystemEventType.UPDATE_LOCAL_PLUGIN_STATE:
|
|
230
|
+
return Object.assign({ eventType: InnerEvent_1.EventType.SYSTEM }, UpdateLocalPluginStateEvent.read(stream));
|
|
231
|
+
case SystemEventType.UPDATE_GLOBAL_PLUGIN_STATE:
|
|
232
|
+
return Object.assign({ eventType: InnerEvent_1.EventType.SYSTEM }, UpdateGlobalPluginStateEvent.read(stream));
|
|
233
|
+
case SystemEventType.UPDATE_PLUGIN:
|
|
234
|
+
return Object.assign({ eventType: InnerEvent_1.EventType.SYSTEM }, UpdatePluginEvent.read(stream));
|
|
235
|
+
case SystemEventType.CALLBACK:
|
|
236
|
+
return Object.assign({ eventType: InnerEvent_1.EventType.SYSTEM }, CallbackEvent.read(stream));
|
|
237
|
+
case SystemEventType.CREATE_SHARD:
|
|
238
|
+
return Object.assign({ eventType: InnerEvent_1.EventType.SYSTEM }, CreateShardEvent.read(stream));
|
|
239
|
+
case SystemEventType.REMOVE_SHARD:
|
|
240
|
+
return Object.assign({ eventType: InnerEvent_1.EventType.SYSTEM }, RemoveShardEvent.read(stream));
|
|
241
|
+
case SystemEventType.UPDATE_CONTEXT_FREE_PLUGIN_STATE:
|
|
242
|
+
return Object.assign({ eventType: InnerEvent_1.EventType.SYSTEM }, UpdateContextFreePluginState.read(stream));
|
|
243
|
+
case SystemEventType.UPGRADE_SYSTEM_CONTRACT:
|
|
244
|
+
return Object.assign({ eventType: InnerEvent_1.EventType.SYSTEM }, UpgradeSystemContractEvent.read(stream));
|
|
245
|
+
case SystemEventType.REMOVE_CONTRACT:
|
|
246
|
+
return Object.assign({ eventType: InnerEvent_1.EventType.SYSTEM }, RemoveContract.read(stream));
|
|
247
|
+
}
|
|
248
|
+
},
|
|
249
|
+
write(stream, value) {
|
|
250
|
+
stream.writeU8(value.systemEventType);
|
|
251
|
+
switch (value.systemEventType) {
|
|
252
|
+
case SystemEventType.CREATE_ACCOUNT:
|
|
253
|
+
return CreateAccountEvent.write(stream, value);
|
|
254
|
+
case SystemEventType.CHECK_EXISTENCE:
|
|
255
|
+
return CheckExistenceEvent.write(stream, value);
|
|
256
|
+
case SystemEventType.SET_FEATURE:
|
|
257
|
+
return SetFeatureEvent.write(stream, value);
|
|
258
|
+
case SystemEventType.UPDATE_LOCAL_PLUGIN_STATE:
|
|
259
|
+
return UpdateLocalPluginStateEvent.write(stream, value);
|
|
260
|
+
case SystemEventType.UPDATE_GLOBAL_PLUGIN_STATE:
|
|
261
|
+
return UpdateGlobalPluginStateEvent.write(stream, value);
|
|
262
|
+
case SystemEventType.UPDATE_PLUGIN:
|
|
263
|
+
return UpdatePluginEvent.write(stream, value);
|
|
264
|
+
case SystemEventType.CALLBACK:
|
|
265
|
+
return CallbackEvent.write(stream, value);
|
|
266
|
+
case SystemEventType.CREATE_SHARD:
|
|
267
|
+
return CreateShardEvent.write(stream, value);
|
|
268
|
+
case SystemEventType.REMOVE_SHARD:
|
|
269
|
+
return RemoveShardEvent.write(stream, value);
|
|
270
|
+
case SystemEventType.UPDATE_CONTEXT_FREE_PLUGIN_STATE:
|
|
271
|
+
return UpdateContextFreePluginState.write(stream, value);
|
|
272
|
+
case SystemEventType.UPGRADE_SYSTEM_CONTRACT:
|
|
273
|
+
return UpgradeSystemContractEvent.write(stream, value);
|
|
274
|
+
case SystemEventType.REMOVE_CONTRACT:
|
|
275
|
+
return RemoveContract.write(stream, value);
|
|
276
|
+
}
|
|
277
|
+
},
|
|
278
|
+
};
|
|
279
|
+
//# sourceMappingURL=InnerSystemEvent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InnerSystemEvent.js","sourceRoot":"","sources":["../../../../src/main/transaction/model/InnerSystemEvent.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;AAEH,6CAAyC;AACzC,mCAAmF;AAEnF,iDAA8C;AAmB9C,4BAA4B;AAC5B,IAAY,eAyBX;AAzBD,WAAY,eAAe;IACzB,sBAAsB;IACtB,yEAAc,CAAA;IACd,uBAAuB;IACvB,2EAAe,CAAA;IACf,mBAAmB;IACnB,mEAAW,CAAA;IACX,iCAAiC;IACjC,+FAAyB,CAAA;IACzB,kCAAkC;IAClC,iGAA0B,CAAA;IAC1B,qBAAqB;IACrB,uEAAa,CAAA;IACb,gBAAgB;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AAC,CAAC;YAC/C,KAAK,eAAe,CAAC,gCAAgC;gBACnD,OAAO,4BAA4B,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;YAC3D,KAAK,eAAe,CAAC,uBAAuB;gBAC1C,OAAO,0BAA0B,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;YACzD,KAAK,eAAe,CAAC,eAAe;gBAClC,OAAO,cAAc,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC;CACF,CAAC"}
|
|
@@ -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":["../../../../src/main/transaction/model/Model.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;;;;AAEH,6CAA0C;AAC1C,+CAAgE;AAEhE,iDAA8C;AAC9C,kDAAuB;AAcV,QAAA,eAAe,GAAG;IAC7B,IAAI,CAAC,MAAiB;QACpB,MAAM,WAAW,GAAG,2BAAY,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC;QACvF,MAAM,WAAW,GAAG,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAClD,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC;IACtC,CAAC;IAED,KAAK,CAAC,MAAkB,EAAE,KAAsB;QAC9C,2BAAY,CAAC,aAAa,CAAC,MAAM,EAAE,KAAK,CAAC,WAAW,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CACtE,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAC1B,CAAC;QACF,gBAAgB,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC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