@hashgraphonline/standards-sdk 0.1.146 → 0.1.148
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/dist/cjs/hcs-3/src/types.d.ts +64 -0
- package/dist/cjs/hcs-3/src/types.d.ts.map +1 -0
- package/dist/cjs/inscribe/inscriber.d.ts.map +1 -1
- package/dist/cjs/services/registry-broker/client/adapters.d.ts +15 -18
- package/dist/cjs/services/registry-broker/client/adapters.d.ts.map +1 -1
- package/dist/cjs/services/registry-broker/client/agents.d.ts +11 -14
- package/dist/cjs/services/registry-broker/client/agents.d.ts.map +1 -1
- package/dist/cjs/services/registry-broker/client/base-client.d.ts +100 -1
- package/dist/cjs/services/registry-broker/client/base-client.d.ts.map +1 -1
- package/dist/cjs/services/registry-broker/client/chat-history.d.ts +8 -12
- package/dist/cjs/services/registry-broker/client/chat-history.d.ts.map +1 -1
- package/dist/cjs/services/registry-broker/client/chat.d.ts +29 -30
- package/dist/cjs/services/registry-broker/client/chat.d.ts.map +1 -1
- package/dist/cjs/services/registry-broker/client/credits.d.ts +14 -18
- package/dist/cjs/services/registry-broker/client/credits.d.ts.map +1 -1
- package/dist/cjs/services/registry-broker/client/encrypted-chat-manager.d.ts +0 -5
- package/dist/cjs/services/registry-broker/client/encrypted-chat-manager.d.ts.map +1 -1
- package/dist/cjs/services/registry-broker/client/encryption.d.ts +32 -30
- package/dist/cjs/services/registry-broker/client/encryption.d.ts.map +1 -1
- package/dist/cjs/services/registry-broker/client/ledger-auth.d.ts +5 -8
- package/dist/cjs/services/registry-broker/client/ledger-auth.d.ts.map +1 -1
- package/dist/cjs/services/registry-broker/client/search.d.ts +14 -17
- package/dist/cjs/services/registry-broker/client/search.d.ts.map +1 -1
- package/dist/cjs/services/registry-broker/schemas.d.ts +9 -9
- package/dist/cjs/services/registry-broker/types.d.ts +1 -0
- package/dist/cjs/services/registry-broker/types.d.ts.map +1 -1
- package/dist/cjs/standards-sdk.cjs +3 -3
- package/dist/cjs/standards-sdk.cjs.map +1 -1
- package/dist/es/hcs-3/src/types.d.ts +64 -0
- package/dist/es/hcs-3/src/types.d.ts.map +1 -0
- package/dist/es/inscribe/inscriber.d.ts.map +1 -1
- package/dist/es/services/registry-broker/client/adapters.d.ts +15 -18
- package/dist/es/services/registry-broker/client/adapters.d.ts.map +1 -1
- package/dist/es/services/registry-broker/client/agents.d.ts +11 -14
- package/dist/es/services/registry-broker/client/agents.d.ts.map +1 -1
- package/dist/es/services/registry-broker/client/base-client.d.ts +100 -1
- package/dist/es/services/registry-broker/client/base-client.d.ts.map +1 -1
- package/dist/es/services/registry-broker/client/chat-history.d.ts +8 -12
- package/dist/es/services/registry-broker/client/chat-history.d.ts.map +1 -1
- package/dist/es/services/registry-broker/client/chat.d.ts +29 -30
- package/dist/es/services/registry-broker/client/chat.d.ts.map +1 -1
- package/dist/es/services/registry-broker/client/credits.d.ts +14 -18
- package/dist/es/services/registry-broker/client/credits.d.ts.map +1 -1
- package/dist/es/services/registry-broker/client/encrypted-chat-manager.d.ts +0 -5
- package/dist/es/services/registry-broker/client/encrypted-chat-manager.d.ts.map +1 -1
- package/dist/es/services/registry-broker/client/encryption.d.ts +32 -30
- package/dist/es/services/registry-broker/client/encryption.d.ts.map +1 -1
- package/dist/es/services/registry-broker/client/ledger-auth.d.ts +5 -8
- package/dist/es/services/registry-broker/client/ledger-auth.d.ts.map +1 -1
- package/dist/es/services/registry-broker/client/search.d.ts +14 -17
- package/dist/es/services/registry-broker/client/search.d.ts.map +1 -1
- package/dist/es/services/registry-broker/schemas.d.ts +9 -9
- package/dist/es/services/registry-broker/types.d.ts +1 -0
- package/dist/es/services/registry-broker/types.d.ts.map +1 -1
- package/dist/es/standards-sdk.es.js +13 -16
- package/dist/es/standards-sdk.es.js.map +1 -1
- package/dist/es/standards-sdk.es101.js +1 -1
- package/dist/es/standards-sdk.es103.js +1 -1
- package/dist/es/standards-sdk.es109.js +3 -10
- package/dist/es/standards-sdk.es109.js.map +1 -1
- package/dist/es/standards-sdk.es11.js +1 -1
- package/dist/es/standards-sdk.es110.js +5 -5
- package/dist/es/standards-sdk.es12.js +1 -1
- package/dist/es/standards-sdk.es120.js +1 -1
- package/dist/es/standards-sdk.es121.js +1 -1
- package/dist/es/standards-sdk.es122.js +5 -5
- package/dist/es/standards-sdk.es124.js +20 -1
- package/dist/es/standards-sdk.es124.js.map +1 -1
- package/dist/es/standards-sdk.es125.js +1 -1
- package/dist/es/standards-sdk.es127.js +960 -178
- package/dist/es/standards-sdk.es127.js.map +1 -1
- package/dist/es/standards-sdk.es128.js +15 -205
- package/dist/es/standards-sdk.es128.js.map +1 -1
- package/dist/es/standards-sdk.es129.js +79 -96
- package/dist/es/standards-sdk.es129.js.map +1 -1
- package/dist/es/standards-sdk.es130.js +72 -112
- package/dist/es/standards-sdk.es130.js.map +1 -1
- package/dist/es/standards-sdk.es131.js +760 -213
- package/dist/es/standards-sdk.es131.js.map +1 -1
- package/dist/es/standards-sdk.es132.js +53 -173
- package/dist/es/standards-sdk.es132.js.map +1 -1
- package/dist/es/standards-sdk.es133.js +156 -119
- package/dist/es/standards-sdk.es133.js.map +1 -1
- package/dist/es/standards-sdk.es134.js +8 -327
- package/dist/es/standards-sdk.es134.js.map +1 -1
- package/dist/es/standards-sdk.es135.js +74 -452
- package/dist/es/standards-sdk.es135.js.map +1 -1
- package/dist/es/standards-sdk.es136.js +61 -13
- package/dist/es/standards-sdk.es136.js.map +1 -1
- package/dist/es/standards-sdk.es137.js +30 -81
- package/dist/es/standards-sdk.es137.js.map +1 -1
- package/dist/es/standards-sdk.es138.js +34 -87
- package/dist/es/standards-sdk.es138.js.map +1 -1
- package/dist/es/standards-sdk.es139.js +28 -60
- package/dist/es/standards-sdk.es139.js.map +1 -1
- package/dist/es/standards-sdk.es140.js +12263 -133
- package/dist/es/standards-sdk.es140.js.map +1 -1
- package/dist/es/standards-sdk.es141.js +138 -7
- package/dist/es/standards-sdk.es141.js.map +1 -1
- package/dist/es/standards-sdk.es142.js +12 -81
- package/dist/es/standards-sdk.es142.js.map +1 -1
- package/dist/es/standards-sdk.es143.js +35 -58
- package/dist/es/standards-sdk.es143.js.map +1 -1
- package/dist/es/standards-sdk.es144.js +172 -30
- package/dist/es/standards-sdk.es144.js.map +1 -1
- package/dist/es/standards-sdk.es145.js +322 -34
- package/dist/es/standards-sdk.es145.js.map +1 -1
- package/dist/es/standards-sdk.es146.js +346 -28
- package/dist/es/standards-sdk.es146.js.map +1 -1
- package/dist/es/standards-sdk.es147.js +453 -959
- package/dist/es/standards-sdk.es147.js.map +1 -1
- package/dist/es/standards-sdk.es148.js +267 -12225
- package/dist/es/standards-sdk.es148.js.map +1 -1
- package/dist/es/standards-sdk.es149.js +66 -128
- package/dist/es/standards-sdk.es149.js.map +1 -1
- package/dist/es/standards-sdk.es150.js +50 -36
- package/dist/es/standards-sdk.es150.js.map +1 -1
- package/dist/es/standards-sdk.es151.js +76 -48
- package/dist/es/standards-sdk.es151.js.map +1 -1
- package/dist/es/standards-sdk.es152.js +153 -65
- package/dist/es/standards-sdk.es152.js.map +1 -1
- package/dist/es/standards-sdk.es153.js +219 -14
- package/dist/es/standards-sdk.es153.js.map +1 -1
- package/dist/es/standards-sdk.es154.js +223 -156
- package/dist/es/standards-sdk.es154.js.map +1 -1
- package/dist/es/standards-sdk.es155.js +112 -315
- package/dist/es/standards-sdk.es155.js.map +1 -1
- package/dist/es/standards-sdk.es156.js +116 -336
- package/dist/es/standards-sdk.es156.js.map +1 -1
- package/dist/es/standards-sdk.es157.js +151 -443
- package/dist/es/standards-sdk.es157.js.map +1 -1
- package/dist/es/standards-sdk.es158.js +170 -316
- package/dist/es/standards-sdk.es158.js.map +1 -1
- package/dist/es/standards-sdk.es159.js +132 -69
- package/dist/es/standards-sdk.es159.js.map +1 -1
- package/dist/es/standards-sdk.es16.js +3 -10
- package/dist/es/standards-sdk.es16.js.map +1 -1
- package/dist/es/standards-sdk.es160.js +300 -208
- package/dist/es/standards-sdk.es160.js.map +1 -1
- package/dist/es/standards-sdk.es161.js +16 -1
- package/dist/es/standards-sdk.es161.js.map +1 -1
- package/dist/es/standards-sdk.es18.js +6 -13
- package/dist/es/standards-sdk.es18.js.map +1 -1
- package/dist/es/standards-sdk.es19.js +4 -11
- package/dist/es/standards-sdk.es19.js.map +1 -1
- package/dist/es/standards-sdk.es22.js +1 -1
- package/dist/es/standards-sdk.es27.js +6 -13
- package/dist/es/standards-sdk.es27.js.map +1 -1
- package/dist/es/standards-sdk.es30.js +1 -1
- package/dist/es/standards-sdk.es31.js +1 -1
- package/dist/es/standards-sdk.es35.js +5 -11
- package/dist/es/standards-sdk.es35.js.map +1 -1
- package/dist/es/standards-sdk.es36.js +3 -3
- package/dist/es/standards-sdk.es37.js +1 -1
- package/dist/es/standards-sdk.es4.js +1 -1
- package/dist/es/standards-sdk.es53.js +1 -1
- package/dist/es/standards-sdk.es56.js +1 -1
- package/dist/es/standards-sdk.es58.js +1 -1
- package/dist/es/standards-sdk.es59.js +1 -1
- package/dist/es/standards-sdk.es60.js +4 -11
- package/dist/es/standards-sdk.es60.js.map +1 -1
- package/dist/es/standards-sdk.es62.js +1 -1
- package/dist/es/standards-sdk.es64.js +1 -1
- package/dist/es/standards-sdk.es65.js +2 -2
- package/dist/es/standards-sdk.es68.js +2 -2
- package/dist/es/standards-sdk.es69.js +1 -1
- package/dist/es/standards-sdk.es7.js +1 -1
- package/dist/es/standards-sdk.es71.js +1 -1
- package/dist/es/standards-sdk.es76.js +1 -1
- package/dist/es/standards-sdk.es77.js +3 -10
- package/dist/es/standards-sdk.es77.js.map +1 -1
- package/dist/es/standards-sdk.es78.js +1 -1
- package/dist/es/standards-sdk.es81.js +1 -1
- package/dist/es/standards-sdk.es83.js +1 -1
- package/dist/es/standards-sdk.es87.js +3 -3
- package/dist/es/standards-sdk.es91.js +1 -1
- package/dist/es/standards-sdk.es92.js +1 -1
- package/dist/es/standards-sdk.es97.js +1 -1
- package/dist/es/standards-sdk.es99.js +1 -1
- package/package.json +63 -73
|
@@ -1,456 +1,164 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
* Parse contract transaction from protobuf TransactionBody
|
|
49
|
-
* Handles all contract operations from decoded protobuf data
|
|
50
|
-
*/
|
|
51
|
-
static parseFromProtobufTxBody(txBody) {
|
|
52
|
-
if (txBody.contractCall) {
|
|
53
|
-
const contractCall = this.parseContractCall(txBody.contractCall);
|
|
54
|
-
if (contractCall) {
|
|
55
|
-
return {
|
|
56
|
-
type: "CONTRACTCALL",
|
|
57
|
-
humanReadableType: "Contract Call",
|
|
58
|
-
contractCall
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
if (txBody.contractCreateInstance) {
|
|
63
|
-
const contractCreate = this.parseContractCreate(
|
|
64
|
-
txBody.contractCreateInstance
|
|
65
|
-
);
|
|
66
|
-
if (contractCreate) {
|
|
67
|
-
return {
|
|
68
|
-
type: "CONTRACTCREATE",
|
|
69
|
-
humanReadableType: "Contract Create",
|
|
70
|
-
contractCreate
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
if (txBody.contractUpdateInstance) {
|
|
75
|
-
const contractUpdate = this.parseContractUpdate(
|
|
76
|
-
txBody.contractUpdateInstance
|
|
77
|
-
);
|
|
78
|
-
if (contractUpdate) {
|
|
79
|
-
return {
|
|
80
|
-
type: "CONTRACTUPDATE",
|
|
81
|
-
humanReadableType: "Contract Update",
|
|
82
|
-
contractUpdate
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
if (txBody.contractDeleteInstance) {
|
|
87
|
-
const contractDelete = this.parseContractDelete(
|
|
88
|
-
txBody.contractDeleteInstance
|
|
89
|
-
);
|
|
90
|
-
if (contractDelete) {
|
|
91
|
-
return {
|
|
92
|
-
type: "CONTRACTDELETE",
|
|
93
|
-
humanReadableType: "Contract Delete",
|
|
94
|
-
contractDelete
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
if (txBody.ethereumTransaction) {
|
|
99
|
-
const ethereumCall = this.parseEthereumTransaction(
|
|
100
|
-
txBody.ethereumTransaction
|
|
101
|
-
);
|
|
102
|
-
if (ethereumCall) {
|
|
103
|
-
return {
|
|
104
|
-
type: "ETHEREUMTRANSACTION",
|
|
105
|
-
humanReadableType: "Ethereum Transaction",
|
|
106
|
-
ethereumTransaction: ethereumCall
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
return {};
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Extract contract data from Transaction internal fields
|
|
114
|
-
* This handles cases where data is stored in Transaction object internals
|
|
115
|
-
*/
|
|
116
|
-
static parseFromTransactionInternals(transaction) {
|
|
117
|
-
try {
|
|
118
|
-
const tx = transaction;
|
|
119
|
-
if (tx._contractId && tx._gas) {
|
|
120
|
-
const contractCall = {
|
|
121
|
-
contractId: tx._contractId.toString(),
|
|
122
|
-
gas: typeof tx._gas === "number" ? tx._gas : Long.fromValue(tx._gas).toNumber(),
|
|
123
|
-
amount: tx._amount ? parseFloat(tx._amount.toString()) : 0
|
|
124
|
-
};
|
|
125
|
-
if (tx._functionParameters) {
|
|
126
|
-
const funcParams = Buffer.from(tx._functionParameters).toString(
|
|
127
|
-
"hex"
|
|
128
|
-
);
|
|
129
|
-
contractCall.functionParameters = funcParams;
|
|
130
|
-
contractCall.functionName = this.extractFunctionName(funcParams);
|
|
131
|
-
}
|
|
132
|
-
return {
|
|
133
|
-
type: "CONTRACTCALL",
|
|
134
|
-
humanReadableType: "Contract Call",
|
|
135
|
-
contractCall
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
if (hasTransactionType(transaction, "contractCreateInstance")) {
|
|
139
|
-
const contractCreate = {
|
|
140
|
-
gas: tx._gas.toString(),
|
|
141
|
-
initialBalance: tx._initialBalance?.toString() || "0"
|
|
142
|
-
};
|
|
143
|
-
if (tx._fileId) {
|
|
144
|
-
contractCreate.initcodeSource = "fileID";
|
|
145
|
-
contractCreate.initcode = tx._fileId.toString();
|
|
146
|
-
} else if (tx._bytecode) {
|
|
147
|
-
contractCreate.initcodeSource = "bytes";
|
|
148
|
-
contractCreate.initcode = Buffer.from(tx._bytecode).toString("hex");
|
|
149
|
-
}
|
|
150
|
-
if (tx._constructorParameters) {
|
|
151
|
-
contractCreate.constructorParameters = Buffer.from(
|
|
152
|
-
tx._constructorParameters
|
|
153
|
-
).toString("hex");
|
|
154
|
-
}
|
|
155
|
-
if (tx._memo) contractCreate.memo = tx._memo;
|
|
156
|
-
if (tx._adminKey) contractCreate.adminKey = parseKey(tx._adminKey);
|
|
157
|
-
if (tx._maxAutomaticTokenAssociations !== void 0) {
|
|
158
|
-
contractCreate.maxAutomaticTokenAssociations = tx._maxAutomaticTokenAssociations;
|
|
159
|
-
}
|
|
160
|
-
if (tx._stakedAccountId) {
|
|
161
|
-
contractCreate.stakedAccountId = tx._stakedAccountId.toString();
|
|
162
|
-
} else if (tx._stakedNodeId !== null && tx._stakedNodeId !== void 0) {
|
|
163
|
-
contractCreate.stakedNodeId = Long.fromValue(
|
|
164
|
-
tx._stakedNodeId
|
|
165
|
-
).toString();
|
|
166
|
-
}
|
|
167
|
-
if (tx._declineReward !== void 0)
|
|
168
|
-
contractCreate.declineReward = tx._declineReward;
|
|
169
|
-
if (tx._autoRenewPeriod)
|
|
170
|
-
contractCreate.autoRenewPeriod = tx._autoRenewPeriod.toString();
|
|
171
|
-
return {
|
|
172
|
-
type: "CONTRACTCREATE",
|
|
173
|
-
humanReadableType: "Contract Create",
|
|
174
|
-
contractCreate
|
|
175
|
-
};
|
|
176
|
-
}
|
|
177
|
-
if (hasTransactionType(transaction, "contractUpdateInstance")) {
|
|
178
|
-
const contractUpdate = {
|
|
179
|
-
contractIdToUpdate: tx._contractId.toString()
|
|
180
|
-
};
|
|
181
|
-
if (tx._memo) contractUpdate.memo = tx._memo;
|
|
182
|
-
if (tx._adminKey) contractUpdate.adminKey = parseKey(tx._adminKey);
|
|
183
|
-
if (tx._maxAutomaticTokenAssociations !== void 0) {
|
|
184
|
-
contractUpdate.maxAutomaticTokenAssociations = tx._maxAutomaticTokenAssociations;
|
|
185
|
-
}
|
|
186
|
-
if (tx._stakedAccountId) {
|
|
187
|
-
contractUpdate.stakedAccountId = tx._stakedAccountId.toString();
|
|
188
|
-
} else if (tx._stakedNodeId !== null && tx._stakedNodeId !== void 0) {
|
|
189
|
-
contractUpdate.stakedNodeId = Long.fromValue(
|
|
190
|
-
tx._stakedNodeId
|
|
191
|
-
).toString();
|
|
192
|
-
}
|
|
193
|
-
if (tx._declineReward !== void 0)
|
|
194
|
-
contractUpdate.declineReward = tx._declineReward;
|
|
195
|
-
if (tx._autoRenewPeriod)
|
|
196
|
-
contractUpdate.autoRenewPeriod = tx._autoRenewPeriod.toString();
|
|
197
|
-
return {
|
|
198
|
-
type: "CONTRACTUPDATE",
|
|
199
|
-
humanReadableType: "Contract Update",
|
|
200
|
-
contractUpdate
|
|
201
|
-
};
|
|
202
|
-
}
|
|
203
|
-
if (hasTransactionType(transaction, "contractDeleteInstance")) {
|
|
204
|
-
const contractDelete = {
|
|
205
|
-
contractIdToDelete: tx._contractId.toString()
|
|
206
|
-
};
|
|
207
|
-
if (tx._transferAccountId) {
|
|
208
|
-
contractDelete.transferAccountId = tx._transferAccountId.toString();
|
|
209
|
-
} else if (tx._transferContractId) {
|
|
210
|
-
contractDelete.transferContractId = tx._transferContractId.toString();
|
|
211
|
-
}
|
|
212
|
-
return {
|
|
213
|
-
type: "CONTRACTDELETE",
|
|
214
|
-
humanReadableType: "Contract Delete",
|
|
215
|
-
contractDelete
|
|
216
|
-
};
|
|
217
|
-
}
|
|
218
|
-
return {};
|
|
219
|
-
} catch (error) {
|
|
220
|
-
return {};
|
|
221
|
-
}
|
|
1
|
+
import { resolveResponseSchema, registrationQuoteResponseSchema, registerAgentResponseSchema, registrationProgressResponseSchema, uaidValidationResponseSchema, uaidConnectionStatusSchema, dashboardStatsResponseSchema } from "./standards-sdk.es127.js";
|
|
2
|
+
import { serialiseAgentRegistrationRequest, DEFAULT_PROGRESS_INTERVAL_MS, DEFAULT_PROGRESS_TIMEOUT_MS, createAbortError } from "./standards-sdk.es154.js";
|
|
3
|
+
import { RegistryBrokerError } from "./standards-sdk.es128.js";
|
|
4
|
+
async function resolveUaid(client, uaid) {
|
|
5
|
+
const raw = await client.requestJson(
|
|
6
|
+
`/resolve/${encodeURIComponent(uaid)}`,
|
|
7
|
+
{
|
|
8
|
+
method: "GET"
|
|
9
|
+
}
|
|
10
|
+
);
|
|
11
|
+
return client.parseWithSchema(
|
|
12
|
+
raw,
|
|
13
|
+
resolveResponseSchema,
|
|
14
|
+
"resolve UAID response"
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
async function getRegistrationQuote(client, payload) {
|
|
18
|
+
const raw = await client.requestJson("/register/quote", {
|
|
19
|
+
method: "POST",
|
|
20
|
+
body: serialiseAgentRegistrationRequest(payload),
|
|
21
|
+
headers: { "content-type": "application/json" }
|
|
22
|
+
});
|
|
23
|
+
return client.parseWithSchema(
|
|
24
|
+
raw,
|
|
25
|
+
registrationQuoteResponseSchema,
|
|
26
|
+
"registration quote response"
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
async function updateAgent(client, uaid, payload) {
|
|
30
|
+
const raw = await client.requestJson(
|
|
31
|
+
`/register/${encodeURIComponent(uaid)}`,
|
|
32
|
+
{
|
|
33
|
+
method: "PUT",
|
|
34
|
+
body: serialiseAgentRegistrationRequest(payload),
|
|
35
|
+
headers: { "content-type": "application/json" }
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
return client.parseWithSchema(
|
|
39
|
+
raw,
|
|
40
|
+
registerAgentResponseSchema,
|
|
41
|
+
"update agent response"
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
async function getRegistrationProgress(client, attemptId) {
|
|
45
|
+
const normalisedAttemptId = attemptId.trim();
|
|
46
|
+
if (!normalisedAttemptId) {
|
|
47
|
+
throw new Error("attemptId is required");
|
|
222
48
|
}
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
"313ce567": "decimals",
|
|
240
|
-
"42842e0e": "safeTransferFrom",
|
|
241
|
-
b88d4fde: "safeTransferFrom",
|
|
242
|
-
e985e9c5: "isApprovedForAll",
|
|
243
|
-
a22cb465: "setApprovalForAll",
|
|
244
|
-
"6352211e": "ownerOf",
|
|
245
|
-
c87b56dd: "tokenURI",
|
|
246
|
-
"01ffc9a7": "supportsInterface",
|
|
247
|
-
"40c10f19": "mint",
|
|
248
|
-
"42966c68": "burn",
|
|
249
|
-
f2fde38b: "transferOwnership",
|
|
250
|
-
"715018a6": "renounceOwnership",
|
|
251
|
-
"8da5cb5b": "owner"
|
|
252
|
-
};
|
|
253
|
-
return commonSelectors[selector] || selector;
|
|
49
|
+
try {
|
|
50
|
+
const raw = await client.requestJson(
|
|
51
|
+
`/register/progress/${encodeURIComponent(normalisedAttemptId)}`,
|
|
52
|
+
{ method: "GET" }
|
|
53
|
+
);
|
|
54
|
+
const parsed = client.parseWithSchema(
|
|
55
|
+
raw,
|
|
56
|
+
registrationProgressResponseSchema,
|
|
57
|
+
"registration progress response"
|
|
58
|
+
);
|
|
59
|
+
return parsed.progress;
|
|
60
|
+
} catch (error) {
|
|
61
|
+
if (error instanceof RegistryBrokerError && error.status === 404) {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
throw error;
|
|
254
65
|
}
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
const data = {
|
|
261
|
-
contractId: "EVM",
|
|
262
|
-
gas: body.maxGasAllowance ? Long.fromValue(body.maxGasAllowance).toNumber() : 0,
|
|
263
|
-
amount: 0
|
|
264
|
-
};
|
|
265
|
-
if (body.ethereumData && body.ethereumData.length > 0) {
|
|
266
|
-
const ethData = Buffer.from(body.ethereumData).toString("hex");
|
|
267
|
-
data.functionParameters = ethData;
|
|
268
|
-
if (ethData.length >= 8) {
|
|
269
|
-
data.functionName = this.extractFunctionName(ethData);
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
return data;
|
|
66
|
+
}
|
|
67
|
+
async function waitForRegistrationCompletion(client, attemptId, options = {}) {
|
|
68
|
+
const normalisedAttemptId = attemptId.trim();
|
|
69
|
+
if (!normalisedAttemptId) {
|
|
70
|
+
throw new Error("attemptId is required");
|
|
273
71
|
}
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
)
|
|
290
|
-
|
|
291
|
-
data.functionName = this.extractFunctionName(data.functionParameters);
|
|
72
|
+
const interval = Math.max(
|
|
73
|
+
250,
|
|
74
|
+
options.intervalMs ?? DEFAULT_PROGRESS_INTERVAL_MS
|
|
75
|
+
);
|
|
76
|
+
const timeoutMs = options.timeoutMs ?? DEFAULT_PROGRESS_TIMEOUT_MS;
|
|
77
|
+
const throwOnFailure = options.throwOnFailure ?? true;
|
|
78
|
+
const signal = options.signal;
|
|
79
|
+
const startedAt = Date.now();
|
|
80
|
+
while (true) {
|
|
81
|
+
if (signal?.aborted) {
|
|
82
|
+
throw createAbortError();
|
|
83
|
+
}
|
|
84
|
+
const progress = await client.getRegistrationProgress(normalisedAttemptId);
|
|
85
|
+
if (progress) {
|
|
86
|
+
options.onProgress?.(progress);
|
|
87
|
+
if (progress.status === "completed") {
|
|
88
|
+
return progress;
|
|
292
89
|
}
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
}
|
|
304
|
-
if (body.gas) {
|
|
305
|
-
data.gas = Long.fromValue(body.gas).toString();
|
|
306
|
-
}
|
|
307
|
-
if (body.adminKey) {
|
|
308
|
-
data.adminKey = parseKey(body.adminKey);
|
|
309
|
-
}
|
|
310
|
-
if (body.constructorParameters) {
|
|
311
|
-
data.constructorParameters = Buffer.from(
|
|
312
|
-
body.constructorParameters
|
|
313
|
-
).toString("hex");
|
|
314
|
-
}
|
|
315
|
-
if (body.memo) {
|
|
316
|
-
data.memo = body.memo;
|
|
317
|
-
}
|
|
318
|
-
if (body.autoRenewPeriod?.seconds) {
|
|
319
|
-
data.autoRenewPeriod = Long.fromValue(
|
|
320
|
-
body.autoRenewPeriod.seconds
|
|
321
|
-
).toString();
|
|
322
|
-
}
|
|
323
|
-
if (body.stakedAccountId) {
|
|
324
|
-
data.stakedAccountId = new AccountId(
|
|
325
|
-
body.stakedAccountId.shardNum ?? 0,
|
|
326
|
-
body.stakedAccountId.realmNum ?? 0,
|
|
327
|
-
body.stakedAccountId.accountNum ?? 0
|
|
328
|
-
).toString();
|
|
329
|
-
} else if (body.stakedNodeId !== null && body.stakedNodeId !== void 0) {
|
|
330
|
-
data.stakedNodeId = Long.fromValue(body.stakedNodeId).toString();
|
|
331
|
-
}
|
|
332
|
-
if (body.declineReward !== void 0) {
|
|
333
|
-
data.declineReward = body.declineReward;
|
|
334
|
-
}
|
|
335
|
-
if (body.maxAutomaticTokenAssociations !== void 0) {
|
|
336
|
-
data.maxAutomaticTokenAssociations = body.maxAutomaticTokenAssociations;
|
|
337
|
-
}
|
|
338
|
-
if (body.fileID) {
|
|
339
|
-
data.initcodeSource = "fileID";
|
|
340
|
-
data.initcode = new FileId(
|
|
341
|
-
body.fileID.shardNum ?? 0,
|
|
342
|
-
body.fileID.realmNum ?? 0,
|
|
343
|
-
body.fileID.fileNum ?? 0
|
|
344
|
-
).toString();
|
|
345
|
-
} else if (body.initcode && body.initcode.length > 0) {
|
|
346
|
-
data.initcodeSource = "bytes";
|
|
347
|
-
data.initcode = Buffer.from(body.initcode).toString("hex");
|
|
348
|
-
}
|
|
349
|
-
return data;
|
|
350
|
-
}
|
|
351
|
-
static parseContractUpdate(body) {
|
|
352
|
-
if (!body) return void 0;
|
|
353
|
-
const data = {};
|
|
354
|
-
if (body.contractID) {
|
|
355
|
-
data.contractIdToUpdate = new ContractId(
|
|
356
|
-
body.contractID.shardNum ?? 0,
|
|
357
|
-
body.contractID.realmNum ?? 0,
|
|
358
|
-
body.contractID.contractNum ?? 0
|
|
359
|
-
).toString();
|
|
360
|
-
}
|
|
361
|
-
if (body.adminKey) {
|
|
362
|
-
data.adminKey = parseKey(body.adminKey);
|
|
363
|
-
}
|
|
364
|
-
if (body.expirationTime?.seconds) {
|
|
365
|
-
data.expirationTime = `${Long.fromValue(
|
|
366
|
-
body.expirationTime.seconds
|
|
367
|
-
).toString()}.${body.expirationTime.nanos}`;
|
|
368
|
-
}
|
|
369
|
-
if (body.autoRenewPeriod?.seconds) {
|
|
370
|
-
data.autoRenewPeriod = Long.fromValue(
|
|
371
|
-
body.autoRenewPeriod.seconds
|
|
372
|
-
).toString();
|
|
373
|
-
}
|
|
374
|
-
if (body.memo) {
|
|
375
|
-
const memoUnion = body.memo;
|
|
376
|
-
if (memoUnion && typeof memoUnion === "object" && Object.prototype.hasOwnProperty.call(memoUnion, "value")) {
|
|
377
|
-
const value = memoUnion.value;
|
|
378
|
-
if (value === null || value === void 0) {
|
|
379
|
-
data.memo = void 0;
|
|
380
|
-
} else {
|
|
381
|
-
data.memo = String(value);
|
|
90
|
+
if (progress.status === "partial" || progress.status === "failed") {
|
|
91
|
+
if (throwOnFailure) {
|
|
92
|
+
throw new RegistryBrokerError(
|
|
93
|
+
"Registration did not complete successfully",
|
|
94
|
+
{
|
|
95
|
+
status: 409,
|
|
96
|
+
statusText: progress.status,
|
|
97
|
+
body: progress
|
|
98
|
+
}
|
|
99
|
+
);
|
|
382
100
|
}
|
|
383
|
-
|
|
384
|
-
data.memo = memoUnion;
|
|
385
|
-
} else {
|
|
386
|
-
data.memo = void 0;
|
|
101
|
+
return progress;
|
|
387
102
|
}
|
|
388
|
-
} else {
|
|
389
|
-
data.memo = void 0;
|
|
390
|
-
}
|
|
391
|
-
if (body.stakedAccountId) {
|
|
392
|
-
data.stakedAccountId = new AccountId(
|
|
393
|
-
body.stakedAccountId.shardNum ?? 0,
|
|
394
|
-
body.stakedAccountId.realmNum ?? 0,
|
|
395
|
-
body.stakedAccountId.accountNum ?? 0
|
|
396
|
-
).toString();
|
|
397
|
-
data.stakedNodeId = void 0;
|
|
398
|
-
} else if (body.stakedNodeId !== null && body.stakedNodeId !== void 0 && Long.fromValue(body.stakedNodeId).notEquals(-1)) {
|
|
399
|
-
data.stakedNodeId = Long.fromValue(body.stakedNodeId).toString();
|
|
400
|
-
data.stakedAccountId = void 0;
|
|
401
|
-
} else {
|
|
402
|
-
data.stakedNodeId = void 0;
|
|
403
|
-
data.stakedAccountId = void 0;
|
|
404
|
-
}
|
|
405
|
-
if (body.declineReward?.value !== void 0) {
|
|
406
|
-
data.declineReward = body.declineReward.value;
|
|
407
|
-
}
|
|
408
|
-
if (body.maxAutomaticTokenAssociations?.value !== void 0) {
|
|
409
|
-
data.maxAutomaticTokenAssociations = body.maxAutomaticTokenAssociations.value;
|
|
410
103
|
}
|
|
411
|
-
if (
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
body.autoRenewAccountId.accountNum ?? 0
|
|
416
|
-
).toString();
|
|
417
|
-
}
|
|
418
|
-
return data;
|
|
419
|
-
}
|
|
420
|
-
static parseContractDelete(body) {
|
|
421
|
-
if (!body) return void 0;
|
|
422
|
-
const data = {};
|
|
423
|
-
if (body.contractID) {
|
|
424
|
-
data.contractIdToDelete = new ContractId(
|
|
425
|
-
body.contractID.shardNum ?? 0,
|
|
426
|
-
body.contractID.realmNum ?? 0,
|
|
427
|
-
body.contractID.contractNum ?? 0
|
|
428
|
-
).toString();
|
|
429
|
-
}
|
|
430
|
-
if (body.transferAccountID) {
|
|
431
|
-
data.transferAccountId = new AccountId(
|
|
432
|
-
body.transferAccountID.shardNum ?? 0,
|
|
433
|
-
body.transferAccountID.realmNum ?? 0,
|
|
434
|
-
body.transferAccountID.accountNum ?? 0
|
|
435
|
-
).toString();
|
|
436
|
-
} else if (body.transferContractID) {
|
|
437
|
-
data.transferContractId = new ContractId(
|
|
438
|
-
body.transferContractID.shardNum ?? 0,
|
|
439
|
-
body.transferContractID.realmNum ?? 0,
|
|
440
|
-
body.transferContractID.contractNum ?? 0
|
|
441
|
-
).toString();
|
|
104
|
+
if (Date.now() - startedAt >= timeoutMs) {
|
|
105
|
+
throw new Error(
|
|
106
|
+
`Registration progress polling timed out after ${timeoutMs}ms`
|
|
107
|
+
);
|
|
442
108
|
}
|
|
443
|
-
|
|
444
|
-
}
|
|
445
|
-
/**
|
|
446
|
-
* Parse SCS (Smart Contract Service) transaction from Transaction object
|
|
447
|
-
* This is the unified entry point that delegates to the comprehensive parsing logic
|
|
448
|
-
*/
|
|
449
|
-
static parseFromTransactionObject(transaction) {
|
|
450
|
-
return this.parseSCSTransaction(transaction);
|
|
109
|
+
await client.delay(interval, signal);
|
|
451
110
|
}
|
|
452
111
|
}
|
|
112
|
+
async function validateUaid(client, uaid) {
|
|
113
|
+
const raw = await client.requestJson(
|
|
114
|
+
`/uaids/validate/${encodeURIComponent(uaid)}`,
|
|
115
|
+
{
|
|
116
|
+
method: "GET"
|
|
117
|
+
}
|
|
118
|
+
);
|
|
119
|
+
return client.parseWithSchema(
|
|
120
|
+
raw,
|
|
121
|
+
uaidValidationResponseSchema,
|
|
122
|
+
"UAID validation response"
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
async function getUaidConnectionStatus(client, uaid) {
|
|
126
|
+
const raw = await client.requestJson(
|
|
127
|
+
`/uaids/connections/${encodeURIComponent(uaid)}/status`,
|
|
128
|
+
{
|
|
129
|
+
method: "GET"
|
|
130
|
+
}
|
|
131
|
+
);
|
|
132
|
+
return client.parseWithSchema(
|
|
133
|
+
raw,
|
|
134
|
+
uaidConnectionStatusSchema,
|
|
135
|
+
"UAID connection status"
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
async function closeUaidConnection(client, uaid) {
|
|
139
|
+
await client.request(`/uaids/connections/${encodeURIComponent(uaid)}`, {
|
|
140
|
+
method: "DELETE"
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
async function dashboardStats(client) {
|
|
144
|
+
const raw = await client.requestJson("/dashboard/stats", {
|
|
145
|
+
method: "GET"
|
|
146
|
+
});
|
|
147
|
+
return client.parseWithSchema(
|
|
148
|
+
raw,
|
|
149
|
+
dashboardStatsResponseSchema,
|
|
150
|
+
"dashboard stats response"
|
|
151
|
+
);
|
|
152
|
+
}
|
|
453
153
|
export {
|
|
454
|
-
|
|
154
|
+
closeUaidConnection,
|
|
155
|
+
dashboardStats,
|
|
156
|
+
getRegistrationProgress,
|
|
157
|
+
getRegistrationQuote,
|
|
158
|
+
getUaidConnectionStatus,
|
|
159
|
+
resolveUaid,
|
|
160
|
+
updateAgent,
|
|
161
|
+
validateUaid,
|
|
162
|
+
waitForRegistrationCompletion
|
|
455
163
|
};
|
|
456
164
|
//# sourceMappingURL=standards-sdk.es157.js.map
|