wowok 2.2.5 → 2.2.7
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/bcs/bcs.d.ts +1 -1
- package/dist/cjs/bcs/bcs.js +1 -1
- package/dist/cjs/bcs/effects.d.ts +4 -4
- package/dist/cjs/bcs/effects.js +1 -1
- package/dist/cjs/bcs/index.d.ts +2 -2
- package/dist/cjs/bcs/index.js +1 -1
- package/dist/cjs/bcs/type-tag-serializer.js +1 -1
- package/dist/cjs/bcs/types.d.ts +4 -4
- package/dist/cjs/client/index.d.ts +4 -4
- package/dist/cjs/client/index.js +1 -1
- package/dist/cjs/cryptography/keypair.d.ts +2 -2
- package/dist/cjs/cryptography/publickey.js +1 -1
- package/dist/cjs/experimental/client.d.ts +4 -4
- package/dist/cjs/experimental/core.d.ts +17 -17
- package/dist/cjs/experimental/core.js +1 -1
- package/dist/cjs/experimental/errors.d.ts +2 -2
- package/dist/cjs/experimental/errors.js +1 -1
- package/dist/cjs/experimental/index.d.ts +2 -2
- package/dist/cjs/experimental/transports/utils.d.ts +3 -3
- package/dist/cjs/experimental/types.d.ts +3 -3
- package/dist/cjs/faucet/faucet.d.ts +3 -3
- package/dist/cjs/faucet/faucet.js +1 -1
- package/dist/cjs/faucet/index.d.ts +1 -1
- package/dist/cjs/faucet/index.js +1 -1
- package/dist/cjs/grpc/client.d.ts +7 -7
- package/dist/cjs/grpc/client.js +1 -1
- package/dist/cjs/grpc/core.d.ts +15 -15
- package/dist/cjs/grpc/core.js +1 -1
- package/dist/cjs/grpc/index.d.ts +2 -2
- package/dist/cjs/grpc/index.js +1 -1
- package/dist/cjs/index.d.ts +3 -3
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/jsonRpc/client.d.ts +24 -24
- package/dist/cjs/jsonRpc/client.js +1 -1
- package/dist/cjs/jsonRpc/core.d.ts +20 -20
- package/dist/cjs/jsonRpc/core.js +1 -1
- package/dist/cjs/jsonRpc/errors.d.ts +3 -3
- package/dist/cjs/jsonRpc/errors.js +1 -1
- package/dist/cjs/jsonRpc/http-transport.js +1 -1
- package/dist/cjs/jsonRpc/index.d.ts +2 -2
- package/dist/cjs/jsonRpc/index.js +1 -1
- package/dist/cjs/jsonRpc/json-rpc-resolver.d.ts +2 -2
- package/dist/cjs/jsonRpc/types/chain.d.ts +4 -4
- package/dist/cjs/jsonRpc/types/changes.d.ts +7 -7
- package/dist/cjs/jsonRpc/types/generated.d.ts +63 -63
- package/dist/cjs/jsonRpc/types/params.d.ts +13 -13
- package/dist/cjs/multisig/publickey.js +1 -1
- package/dist/cjs/transactions/Commands.js +1 -1
- package/dist/cjs/transactions/Inputs.js +1 -1
- package/dist/cjs/transactions/ObjectCache.js +1 -1
- package/dist/cjs/transactions/Transaction.js +1 -1
- package/dist/cjs/transactions/TransactionData.js +1 -1
- package/dist/cjs/transactions/__tests__/bcs.test.js +1 -1
- package/dist/cjs/transactions/data/internal.d.ts +1 -1
- package/dist/cjs/transactions/data/internal.js +1 -1
- package/dist/cjs/transactions/data/v2.js +1 -1
- package/dist/cjs/transactions/executor/caching.d.ts +4 -4
- package/dist/cjs/transactions/executor/parallel.d.ts +4 -4
- package/dist/cjs/transactions/executor/parallel.js +1 -1
- package/dist/cjs/transactions/executor/serial.d.ts +4 -4
- package/dist/cjs/transactions/intents/CoinWithBalance.d.ts +2 -2
- package/dist/cjs/transactions/intents/CoinWithBalance.js +1 -1
- package/dist/cjs/transactions/serializer.d.ts +2 -2
- package/dist/cjs/transactions/serializer.js +1 -1
- package/dist/cjs/transactions/utils.d.ts +4 -4
- package/dist/cjs/transactions/utils.js +1 -1
- package/dist/cjs/utils/constants.d.ts +0 -6
- package/dist/cjs/utils/constants.js +1 -1
- package/dist/cjs/utils/index.d.ts +1 -1
- package/dist/cjs/utils/index.js +1 -1
- package/dist/cjs/verify/index.d.ts +1 -1
- package/dist/cjs/verify/index.js +1 -1
- package/dist/cjs/verify/verify.d.ts +1 -1
- package/dist/cjs/verify/verify.js +1 -1
- package/dist/cjs/w/call/allocation.js +1 -1
- package/dist/cjs/w/call/arbitration.js +1 -1
- package/dist/cjs/w/call/base.d.ts +6 -6
- package/dist/cjs/w/call/base.js +1 -1
- package/dist/cjs/w/call/contact.js +1 -1
- package/dist/cjs/w/call/demand.js +1 -1
- package/dist/cjs/w/call/entity.js +1 -1
- package/dist/cjs/w/call/guard-ins.js +1 -1
- package/dist/cjs/w/call/guard.js +1 -1
- package/dist/cjs/w/call/passport.d.ts +2 -2
- package/dist/cjs/w/call/passport.js +1 -1
- package/dist/cjs/w/common.d.ts +7 -2
- package/dist/cjs/w/common.js +1 -1
- package/dist/cjs/w/local/account.d.ts +3 -3
- package/dist/cjs/w/local/account.js +1 -1
- package/dist/cjs/w/local/index.d.ts +2 -2
- package/dist/cjs/w/local/index.js +1 -1
- package/dist/cjs/w/local/local.js +1 -1
- package/dist/cjs/w/local/token.js +1 -1
- package/dist/cjs/w/messenger/messenger.js +1 -1
- package/dist/cjs/w/query/event.js +1 -1
- package/dist/cjs/w/query/object.js +1 -1
- package/dist/cjs/w/query/received.js +1 -1
- package/dist/cjs/w/util.js +1 -1
- package/dist/esm/bcs/bcs.d.ts +1 -1
- package/dist/esm/bcs/bcs.js +1 -1
- package/dist/esm/bcs/effects.d.ts +4 -4
- package/dist/esm/bcs/effects.js +1 -1
- package/dist/esm/bcs/index.d.ts +2 -2
- package/dist/esm/bcs/index.js +1 -1
- package/dist/esm/bcs/type-tag-serializer.js +1 -1
- package/dist/esm/bcs/types.d.ts +4 -4
- package/dist/esm/client/index.d.ts +4 -4
- package/dist/esm/client/index.js +1 -1
- package/dist/esm/cryptography/keypair.d.ts +2 -2
- package/dist/esm/cryptography/publickey.js +1 -1
- package/dist/esm/experimental/client.d.ts +4 -4
- package/dist/esm/experimental/core.d.ts +17 -17
- package/dist/esm/experimental/core.js +1 -1
- package/dist/esm/experimental/errors.d.ts +2 -2
- package/dist/esm/experimental/errors.js +1 -1
- package/dist/esm/experimental/index.d.ts +2 -2
- package/dist/esm/experimental/transports/utils.d.ts +3 -3
- package/dist/esm/experimental/types.d.ts +3 -3
- package/dist/esm/faucet/faucet.d.ts +3 -3
- package/dist/esm/faucet/faucet.js +1 -1
- package/dist/esm/faucet/index.d.ts +1 -1
- package/dist/esm/faucet/index.js +1 -1
- package/dist/esm/grpc/client.d.ts +7 -7
- package/dist/esm/grpc/client.js +1 -1
- package/dist/esm/grpc/core.d.ts +15 -15
- package/dist/esm/grpc/core.js +1 -1
- package/dist/esm/grpc/index.d.ts +2 -2
- package/dist/esm/grpc/index.js +1 -1
- package/dist/esm/index.d.ts +3 -3
- package/dist/esm/index.js +1 -1
- package/dist/esm/jsonRpc/client.d.ts +24 -24
- package/dist/esm/jsonRpc/client.js +1 -1
- package/dist/esm/jsonRpc/core.d.ts +20 -20
- package/dist/esm/jsonRpc/core.js +1 -1
- package/dist/esm/jsonRpc/errors.d.ts +3 -3
- package/dist/esm/jsonRpc/errors.js +1 -1
- package/dist/esm/jsonRpc/http-transport.js +1 -1
- package/dist/esm/jsonRpc/index.d.ts +2 -2
- package/dist/esm/jsonRpc/index.js +1 -1
- package/dist/esm/jsonRpc/json-rpc-resolver.d.ts +2 -2
- package/dist/esm/jsonRpc/types/chain.d.ts +4 -4
- package/dist/esm/jsonRpc/types/changes.d.ts +7 -7
- package/dist/esm/jsonRpc/types/generated.d.ts +63 -63
- package/dist/esm/jsonRpc/types/params.d.ts +13 -13
- package/dist/esm/multisig/publickey.js +1 -1
- package/dist/esm/transactions/Commands.js +1 -1
- package/dist/esm/transactions/Inputs.js +1 -1
- package/dist/esm/transactions/ObjectCache.js +1 -1
- package/dist/esm/transactions/Transaction.js +1 -1
- package/dist/esm/transactions/TransactionData.js +1 -1
- package/dist/esm/transactions/__tests__/bcs.test.js +1 -1
- package/dist/esm/transactions/data/internal.d.ts +1 -1
- package/dist/esm/transactions/data/internal.js +1 -1
- package/dist/esm/transactions/data/v2.js +1 -1
- package/dist/esm/transactions/executor/caching.d.ts +4 -4
- package/dist/esm/transactions/executor/parallel.d.ts +4 -4
- package/dist/esm/transactions/executor/parallel.js +1 -1
- package/dist/esm/transactions/executor/serial.d.ts +4 -4
- package/dist/esm/transactions/intents/CoinWithBalance.d.ts +2 -2
- package/dist/esm/transactions/intents/CoinWithBalance.js +1 -1
- package/dist/esm/transactions/serializer.d.ts +2 -2
- package/dist/esm/transactions/serializer.js +1 -1
- package/dist/esm/transactions/utils.d.ts +4 -4
- package/dist/esm/transactions/utils.js +1 -1
- package/dist/esm/utils/constants.d.ts +0 -6
- package/dist/esm/utils/constants.js +1 -1
- package/dist/esm/utils/index.d.ts +1 -1
- package/dist/esm/utils/index.js +1 -1
- package/dist/esm/verify/index.d.ts +1 -1
- package/dist/esm/verify/index.js +1 -1
- package/dist/esm/verify/verify.d.ts +1 -1
- package/dist/esm/verify/verify.js +1 -1
- package/dist/esm/w/call/allocation.js +1 -1
- package/dist/esm/w/call/arbitration.js +1 -1
- package/dist/esm/w/call/base.d.ts +6 -6
- package/dist/esm/w/call/base.js +1 -1
- package/dist/esm/w/call/contact.js +1 -1
- package/dist/esm/w/call/demand.js +1 -1
- package/dist/esm/w/call/entity.js +1 -1
- package/dist/esm/w/call/guard-ins.js +1 -1
- package/dist/esm/w/call/guard.js +1 -1
- package/dist/esm/w/call/passport.d.ts +2 -2
- package/dist/esm/w/call/passport.js +1 -1
- package/dist/esm/w/common.d.ts +7 -2
- package/dist/esm/w/common.js +1 -1
- package/dist/esm/w/local/account.d.ts +3 -3
- package/dist/esm/w/local/account.js +1 -1
- package/dist/esm/w/local/index.d.ts +2 -2
- package/dist/esm/w/local/index.js +1 -1
- package/dist/esm/w/local/local.js +1 -1
- package/dist/esm/w/local/token.js +1 -1
- package/dist/esm/w/messenger/messenger.js +1 -1
- package/dist/esm/w/query/event.js +1 -1
- package/dist/esm/w/query/object.js +1 -1
- package/dist/esm/w/query/received.js +1 -1
- package/dist/esm/w/util.js +1 -1
- package/package.json +4 -3
- /package/dist/cjs/utils/{sui-types.d.ts → wow-types.d.ts} +0 -0
- /package/dist/cjs/utils/{sui-types.js → wow-types.js} +0 -0
- /package/dist/esm/utils/{sui-types.d.ts → wow-types.d.ts} +0 -0
- /package/dist/esm/utils/{sui-types.js → wow-types.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Checkpoint, DynamicFieldInfo, SuiCallArg,
|
|
1
|
+
import type { Checkpoint, DynamicFieldInfo, SuiCallArg, WowMoveNormalizedModule, WowParsedData, SuiTransaction, SuiValidatorSummary } from "./generated.js";
|
|
2
2
|
export type EpochInfo = {
|
|
3
3
|
epoch: string;
|
|
4
4
|
validators: SuiValidatorSummary[];
|
|
@@ -81,11 +81,11 @@ export type DynamicFieldPage = {
|
|
|
81
81
|
nextCursor: string | null;
|
|
82
82
|
hasNextPage: boolean;
|
|
83
83
|
};
|
|
84
|
-
export type
|
|
85
|
-
export type SuiMoveObject = Extract<
|
|
84
|
+
export type WowMoveNormalizedModules = Record<string, WowMoveNormalizedModule>;
|
|
85
|
+
export type SuiMoveObject = Extract<WowParsedData, {
|
|
86
86
|
dataType: "moveObject";
|
|
87
87
|
}>;
|
|
88
|
-
export type SuiMovePackage = Extract<
|
|
88
|
+
export type SuiMovePackage = Extract<WowParsedData, {
|
|
89
89
|
dataType: "package";
|
|
90
90
|
}>;
|
|
91
91
|
export type ProgrammableTransaction = {
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export type
|
|
1
|
+
import type { WowObjectChange } from "./generated.js";
|
|
2
|
+
export type WowObjectChangePublished = Extract<WowObjectChange, {
|
|
3
3
|
type: "published";
|
|
4
4
|
}>;
|
|
5
|
-
export type
|
|
5
|
+
export type WowObjectChangeTransferred = Extract<WowObjectChange, {
|
|
6
6
|
type: "transferred";
|
|
7
7
|
}>;
|
|
8
|
-
export type
|
|
8
|
+
export type WowObjectChangeMutated = Extract<WowObjectChange, {
|
|
9
9
|
type: "mutated";
|
|
10
10
|
}>;
|
|
11
|
-
export type
|
|
11
|
+
export type WowObjectChangeDeleted = Extract<WowObjectChange, {
|
|
12
12
|
type: "deleted";
|
|
13
13
|
}>;
|
|
14
|
-
export type
|
|
14
|
+
export type WowObjectChangeWrapped = Extract<WowObjectChange, {
|
|
15
15
|
type: "wrapped";
|
|
16
16
|
}>;
|
|
17
|
-
export type
|
|
17
|
+
export type WowObjectChangeCreated = Extract<WowObjectChange, {
|
|
18
18
|
type: "created";
|
|
19
19
|
}>;
|
|
@@ -58,7 +58,7 @@ export type ConsensusDeterminedVersionAssignments = {
|
|
|
58
58
|
} | {
|
|
59
59
|
CancelledTransactionsV2: [string, [[string, string], string][]][];
|
|
60
60
|
};
|
|
61
|
-
export type
|
|
61
|
+
export type WowParsedData = {
|
|
62
62
|
dataType: "moveObject";
|
|
63
63
|
fields: MoveStruct;
|
|
64
64
|
hasPublicTransfer: boolean;
|
|
@@ -84,7 +84,7 @@ export interface DevInspectArgs {
|
|
|
84
84
|
export interface DevInspectResults {
|
|
85
85
|
effects: TransactionEffects;
|
|
86
86
|
error?: string | null;
|
|
87
|
-
events:
|
|
87
|
+
events: WowEvent[];
|
|
88
88
|
rawEffects?: number[];
|
|
89
89
|
rawTxnData?: number[];
|
|
90
90
|
results?: SuiExecutionResult[] | null;
|
|
@@ -98,10 +98,10 @@ export interface DisplayFieldsResponse {
|
|
|
98
98
|
export interface DryRunTransactionBlockResponse {
|
|
99
99
|
balanceChanges: BalanceChange[];
|
|
100
100
|
effects: TransactionEffects;
|
|
101
|
-
events:
|
|
101
|
+
events: WowEvent[];
|
|
102
102
|
executionErrorSource?: string | null;
|
|
103
103
|
input: TransactionBlockData;
|
|
104
|
-
objectChanges:
|
|
104
|
+
objectChanges: WowObjectChange[];
|
|
105
105
|
suggestedGasPrice?: string | null;
|
|
106
106
|
}
|
|
107
107
|
export type DynamicFieldInfo = {
|
|
@@ -136,7 +136,7 @@ export interface EndOfEpochData {
|
|
|
136
136
|
nextEpochCommittee: [string, string][];
|
|
137
137
|
nextEpochProtocolVersion: string;
|
|
138
138
|
}
|
|
139
|
-
export type
|
|
139
|
+
export type WowEvent = {
|
|
140
140
|
id: EventId;
|
|
141
141
|
packageId: string;
|
|
142
142
|
parsedJson: unknown;
|
|
@@ -157,10 +157,10 @@ export type SuiEvent = {
|
|
|
157
157
|
bcs: string;
|
|
158
158
|
bcsEncoding: "base58";
|
|
159
159
|
};
|
|
160
|
-
export type
|
|
160
|
+
export type WowEventFilter = {
|
|
161
161
|
All: [];
|
|
162
162
|
} | {
|
|
163
|
-
Any:
|
|
163
|
+
Any: WowEventFilter[];
|
|
164
164
|
} | {
|
|
165
165
|
Sender: string;
|
|
166
166
|
} | {
|
|
@@ -201,7 +201,7 @@ export interface GasCostSummary {
|
|
|
201
201
|
export interface SuiGasData {
|
|
202
202
|
budget: string;
|
|
203
203
|
owner: string;
|
|
204
|
-
payment:
|
|
204
|
+
payment: WowObjectRef[];
|
|
205
205
|
price: string;
|
|
206
206
|
}
|
|
207
207
|
export interface GetPastObjectRequest {
|
|
@@ -211,7 +211,7 @@ export interface GetPastObjectRequest {
|
|
|
211
211
|
export type InputObjectKind = {
|
|
212
212
|
MovePackage: string;
|
|
213
213
|
} | {
|
|
214
|
-
ImmOrOwnedMoveObject:
|
|
214
|
+
ImmOrOwnedMoveObject: WowObjectRef;
|
|
215
215
|
} | {
|
|
216
216
|
SharedMoveObject: {
|
|
217
217
|
id: string;
|
|
@@ -226,7 +226,7 @@ export interface MoveCallParams {
|
|
|
226
226
|
packageObjectId: string;
|
|
227
227
|
typeArguments?: string[];
|
|
228
228
|
}
|
|
229
|
-
export type
|
|
229
|
+
export type WowMoveFunctionArgType = "Pure" | {
|
|
230
230
|
Object: ObjectValueKind;
|
|
231
231
|
};
|
|
232
232
|
export type MoveStruct = MoveValue[] | {
|
|
@@ -265,7 +265,7 @@ export interface MultiSigPublicKeyLegacy {
|
|
|
265
265
|
pk_map: [PublicKey, number][];
|
|
266
266
|
threshold: number;
|
|
267
267
|
}
|
|
268
|
-
export type
|
|
268
|
+
export type WowObjectChange = {
|
|
269
269
|
digest: string;
|
|
270
270
|
modules: string[];
|
|
271
271
|
packageId: string;
|
|
@@ -309,9 +309,9 @@ export type SuiObjectChange = {
|
|
|
309
309
|
type: "created";
|
|
310
310
|
version: string;
|
|
311
311
|
};
|
|
312
|
-
export interface
|
|
312
|
+
export interface WowObjectData {
|
|
313
313
|
bcs?: RawData | null;
|
|
314
|
-
content?:
|
|
314
|
+
content?: WowParsedData | null;
|
|
315
315
|
digest: string;
|
|
316
316
|
display?: DisplayFieldsResponse | null;
|
|
317
317
|
objectId: string;
|
|
@@ -321,7 +321,7 @@ export interface SuiObjectData {
|
|
|
321
321
|
type?: string | null;
|
|
322
322
|
version: string;
|
|
323
323
|
}
|
|
324
|
-
export interface
|
|
324
|
+
export interface WowObjectDataOptions {
|
|
325
325
|
showBcs?: boolean;
|
|
326
326
|
showContent?: boolean;
|
|
327
327
|
showDisplay?: boolean;
|
|
@@ -331,13 +331,13 @@ export interface SuiObjectDataOptions {
|
|
|
331
331
|
showType?: boolean;
|
|
332
332
|
}
|
|
333
333
|
export type ObjectRead = {
|
|
334
|
-
details:
|
|
334
|
+
details: WowObjectData;
|
|
335
335
|
status: "VersionFound";
|
|
336
336
|
} | {
|
|
337
337
|
details: string;
|
|
338
338
|
status: "ObjectNotExists";
|
|
339
339
|
} | {
|
|
340
|
-
details:
|
|
340
|
+
details: WowObjectRef;
|
|
341
341
|
status: "ObjectDeleted";
|
|
342
342
|
} | {
|
|
343
343
|
details: [string, string];
|
|
@@ -350,7 +350,7 @@ export type ObjectRead = {
|
|
|
350
350
|
};
|
|
351
351
|
status: "VersionTooHigh";
|
|
352
352
|
};
|
|
353
|
-
export interface
|
|
353
|
+
export interface WowObjectRef {
|
|
354
354
|
digest: string;
|
|
355
355
|
objectId: string;
|
|
356
356
|
version: string;
|
|
@@ -372,14 +372,14 @@ export type ObjectResponseError = {
|
|
|
372
372
|
code: "displayError";
|
|
373
373
|
error: string;
|
|
374
374
|
};
|
|
375
|
-
export interface
|
|
376
|
-
filter?:
|
|
377
|
-
options?:
|
|
375
|
+
export interface WowObjectResponseQuery {
|
|
376
|
+
filter?: WowObjectDataFilter | null;
|
|
377
|
+
options?: WowObjectDataOptions | null;
|
|
378
378
|
}
|
|
379
379
|
export type ObjectValueKind = "ByImmutableReference" | "ByMutableReference" | "ByValue";
|
|
380
380
|
export interface OwnedObjectRef {
|
|
381
381
|
owner: ObjectOwner;
|
|
382
|
-
reference:
|
|
382
|
+
reference: WowObjectRef;
|
|
383
383
|
}
|
|
384
384
|
export type ObjectOwner = {
|
|
385
385
|
AddressOwner: string;
|
|
@@ -411,7 +411,7 @@ export interface PaginatedDynamicFieldInfos {
|
|
|
411
411
|
nextCursor?: string | null;
|
|
412
412
|
}
|
|
413
413
|
export interface PaginatedEvents {
|
|
414
|
-
data:
|
|
414
|
+
data: WowEvent[];
|
|
415
415
|
hasNextPage: boolean;
|
|
416
416
|
nextCursor?: EventId | null;
|
|
417
417
|
}
|
|
@@ -421,12 +421,12 @@ export interface PaginatedStrings {
|
|
|
421
421
|
nextCursor?: string | null;
|
|
422
422
|
}
|
|
423
423
|
export interface PaginatedObjectsResponse {
|
|
424
|
-
data:
|
|
424
|
+
data: WowObjectResponse[];
|
|
425
425
|
hasNextPage: boolean;
|
|
426
426
|
nextCursor?: string | null;
|
|
427
427
|
}
|
|
428
428
|
export interface PaginatedTransactionResponse {
|
|
429
|
-
data:
|
|
429
|
+
data: WowTransactionBlockResponse[];
|
|
430
430
|
hasNextPage: boolean;
|
|
431
431
|
nextCursor?: string | null;
|
|
432
432
|
}
|
|
@@ -570,7 +570,7 @@ export interface SuiExecutionResult {
|
|
|
570
570
|
returnValues?: [number[], string][];
|
|
571
571
|
}
|
|
572
572
|
export type SuiMoveAbility = "Copy" | "Drop" | "Store" | "Key";
|
|
573
|
-
export interface
|
|
573
|
+
export interface WowMoveAbilitySet {
|
|
574
574
|
abilities: SuiMoveAbility[];
|
|
575
575
|
}
|
|
576
576
|
export interface SuiMoveAbort {
|
|
@@ -584,7 +584,7 @@ export interface SuiMoveModuleId {
|
|
|
584
584
|
name: string;
|
|
585
585
|
}
|
|
586
586
|
export interface SuiMoveNormalizedEnum {
|
|
587
|
-
abilities:
|
|
587
|
+
abilities: WowMoveAbilitySet;
|
|
588
588
|
typeParameters: SuiMoveStructTypeParameter[];
|
|
589
589
|
variantDeclarationOrder?: string[] | null;
|
|
590
590
|
variants: {
|
|
@@ -593,62 +593,62 @@ export interface SuiMoveNormalizedEnum {
|
|
|
593
593
|
}
|
|
594
594
|
export interface SuiMoveNormalizedField {
|
|
595
595
|
name: string;
|
|
596
|
-
type:
|
|
596
|
+
type: WowMoveNormalizedType;
|
|
597
597
|
}
|
|
598
|
-
export interface
|
|
598
|
+
export interface WowMoveNormalizedFunction {
|
|
599
599
|
isEntry: boolean;
|
|
600
|
-
parameters:
|
|
601
|
-
return:
|
|
602
|
-
typeParameters:
|
|
603
|
-
visibility:
|
|
600
|
+
parameters: WowMoveNormalizedType[];
|
|
601
|
+
return: WowMoveNormalizedType[];
|
|
602
|
+
typeParameters: WowMoveAbilitySet[];
|
|
603
|
+
visibility: WowMoveVisibility;
|
|
604
604
|
}
|
|
605
|
-
export interface
|
|
605
|
+
export interface WowMoveNormalizedModule {
|
|
606
606
|
address: string;
|
|
607
607
|
enums?: {
|
|
608
608
|
[key: string]: SuiMoveNormalizedEnum;
|
|
609
609
|
};
|
|
610
610
|
exposedFunctions: {
|
|
611
|
-
[key: string]:
|
|
611
|
+
[key: string]: WowMoveNormalizedFunction;
|
|
612
612
|
};
|
|
613
613
|
fileFormatVersion: number;
|
|
614
614
|
friends: SuiMoveModuleId[];
|
|
615
615
|
name: string;
|
|
616
616
|
structs: {
|
|
617
|
-
[key: string]:
|
|
617
|
+
[key: string]: WowMoveNormalizedStruct;
|
|
618
618
|
};
|
|
619
619
|
}
|
|
620
|
-
export interface
|
|
621
|
-
abilities:
|
|
620
|
+
export interface WowMoveNormalizedStruct {
|
|
621
|
+
abilities: WowMoveAbilitySet;
|
|
622
622
|
fields: SuiMoveNormalizedField[];
|
|
623
623
|
typeParameters: SuiMoveStructTypeParameter[];
|
|
624
624
|
}
|
|
625
|
-
export type
|
|
625
|
+
export type WowMoveNormalizedType = "Bool" | "U8" | "U16" | "U32" | "U64" | "U128" | "U256" | "Address" | "Signer" | {
|
|
626
626
|
Struct: {
|
|
627
627
|
address: string;
|
|
628
628
|
module: string;
|
|
629
629
|
name: string;
|
|
630
|
-
typeArguments:
|
|
630
|
+
typeArguments: WowMoveNormalizedType[];
|
|
631
631
|
};
|
|
632
632
|
} | {
|
|
633
|
-
Vector:
|
|
633
|
+
Vector: WowMoveNormalizedType;
|
|
634
634
|
} | {
|
|
635
635
|
TypeParameter: number;
|
|
636
636
|
} | {
|
|
637
|
-
Reference:
|
|
637
|
+
Reference: WowMoveNormalizedType;
|
|
638
638
|
} | {
|
|
639
|
-
MutableReference:
|
|
639
|
+
MutableReference: WowMoveNormalizedType;
|
|
640
640
|
};
|
|
641
641
|
export interface SuiMoveStructTypeParameter {
|
|
642
|
-
constraints:
|
|
642
|
+
constraints: WowMoveAbilitySet;
|
|
643
643
|
isPhantom: boolean;
|
|
644
644
|
}
|
|
645
|
-
export type
|
|
646
|
-
export type
|
|
647
|
-
MatchAll:
|
|
645
|
+
export type WowMoveVisibility = "Private" | "Public" | "Friend";
|
|
646
|
+
export type WowObjectDataFilter = {
|
|
647
|
+
MatchAll: WowObjectDataFilter[];
|
|
648
648
|
} | {
|
|
649
|
-
MatchAny:
|
|
649
|
+
MatchAny: WowObjectDataFilter[];
|
|
650
650
|
} | {
|
|
651
|
-
MatchNone:
|
|
651
|
+
MatchNone: WowObjectDataFilter[];
|
|
652
652
|
} | {
|
|
653
653
|
Package: string;
|
|
654
654
|
} | {
|
|
@@ -669,8 +669,8 @@ export type SuiObjectDataFilter = {
|
|
|
669
669
|
} | {
|
|
670
670
|
Version: string;
|
|
671
671
|
};
|
|
672
|
-
export interface
|
|
673
|
-
data?:
|
|
672
|
+
export interface WowObjectResponse {
|
|
673
|
+
data?: WowObjectData | null;
|
|
674
674
|
error?: ObjectResponseError | null;
|
|
675
675
|
}
|
|
676
676
|
export interface MoveCallSuiTransaction {
|
|
@@ -680,7 +680,7 @@ export interface MoveCallSuiTransaction {
|
|
|
680
680
|
package: string;
|
|
681
681
|
type_arguments?: string[];
|
|
682
682
|
}
|
|
683
|
-
export interface
|
|
683
|
+
export interface WowSystemStateSummary {
|
|
684
684
|
activeValidators: SuiValidatorSummary[];
|
|
685
685
|
atRiskValidators: [string, string][];
|
|
686
686
|
epoch: string;
|
|
@@ -770,7 +770,7 @@ export interface SuiValidatorSummary {
|
|
|
770
770
|
stakingPoolActivationEpoch?: string | null;
|
|
771
771
|
stakingPoolDeactivationEpoch?: string | null;
|
|
772
772
|
stakingPoolId: string;
|
|
773
|
-
|
|
773
|
+
stakingPoolWowBalance: string;
|
|
774
774
|
wowAddress: string;
|
|
775
775
|
votingPower: string;
|
|
776
776
|
workerAddress: string;
|
|
@@ -784,7 +784,7 @@ export interface SuiTransactionBlock {
|
|
|
784
784
|
txSignatures: string[];
|
|
785
785
|
}
|
|
786
786
|
export interface TransactionBlockBytes {
|
|
787
|
-
gas:
|
|
787
|
+
gas: WowObjectRef[];
|
|
788
788
|
inputObjects: InputObjectKind[];
|
|
789
789
|
txBytes: string;
|
|
790
790
|
}
|
|
@@ -797,7 +797,7 @@ export type TransactionBlockData = {
|
|
|
797
797
|
export type TransactionEffects = {
|
|
798
798
|
abortError?: SuiMoveAbort | null;
|
|
799
799
|
created?: OwnedObjectRef[];
|
|
800
|
-
deleted?:
|
|
800
|
+
deleted?: WowObjectRef[];
|
|
801
801
|
dependencies?: string[];
|
|
802
802
|
eventsDigest?: string | null;
|
|
803
803
|
executedEpoch: string;
|
|
@@ -806,12 +806,12 @@ export type TransactionEffects = {
|
|
|
806
806
|
messageVersion: "v1";
|
|
807
807
|
modifiedAtVersions?: TransactionBlockEffectsModifiedAtVersions[];
|
|
808
808
|
mutated?: OwnedObjectRef[];
|
|
809
|
-
sharedObjects?:
|
|
809
|
+
sharedObjects?: WowObjectRef[];
|
|
810
810
|
status: ExecutionStatus;
|
|
811
811
|
transactionDigest: string;
|
|
812
812
|
unwrapped?: OwnedObjectRef[];
|
|
813
|
-
unwrappedThenDeleted?:
|
|
814
|
-
wrapped?:
|
|
813
|
+
unwrappedThenDeleted?: WowObjectRef[];
|
|
814
|
+
wrapped?: WowObjectRef[];
|
|
815
815
|
};
|
|
816
816
|
export interface TransactionBlockEffectsModifiedAtVersions {
|
|
817
817
|
objectId: string;
|
|
@@ -872,21 +872,21 @@ export type SuiTransactionBlockKind = {
|
|
|
872
872
|
kind: "ProgrammableSystemTransaction";
|
|
873
873
|
transactions: SuiTransaction[];
|
|
874
874
|
};
|
|
875
|
-
export interface
|
|
875
|
+
export interface WowTransactionBlockResponse {
|
|
876
876
|
balanceChanges?: BalanceChange[] | null;
|
|
877
877
|
checkpoint?: string | null;
|
|
878
878
|
confirmedLocalExecution?: boolean | null;
|
|
879
879
|
digest: string;
|
|
880
880
|
effects?: TransactionEffects | null;
|
|
881
881
|
errors?: string[];
|
|
882
|
-
events?:
|
|
883
|
-
objectChanges?:
|
|
882
|
+
events?: WowEvent[] | null;
|
|
883
|
+
objectChanges?: WowObjectChange[] | null;
|
|
884
884
|
rawEffects?: number[];
|
|
885
885
|
rawTransaction?: string;
|
|
886
886
|
timestampMs?: string | null;
|
|
887
887
|
transaction?: SuiTransactionBlock | null;
|
|
888
888
|
}
|
|
889
|
-
export interface
|
|
889
|
+
export interface WowTransactionBlockResponseOptions {
|
|
890
890
|
showBalanceChanges?: boolean;
|
|
891
891
|
showEffects?: boolean;
|
|
892
892
|
showEvents?: boolean;
|
|
@@ -895,9 +895,9 @@ export interface SuiTransactionBlockResponseOptions {
|
|
|
895
895
|
showRawEffects?: boolean;
|
|
896
896
|
showRawInput?: boolean;
|
|
897
897
|
}
|
|
898
|
-
export interface
|
|
898
|
+
export interface WowTransactionBlockResponseQuery {
|
|
899
899
|
filter?: TransactionFilter | null;
|
|
900
|
-
options?:
|
|
900
|
+
options?: WowTransactionBlockResponseOptions | null;
|
|
901
901
|
}
|
|
902
902
|
export type TransactionFilter = {
|
|
903
903
|
Checkpoint: string;
|
|
@@ -15,7 +15,7 @@ export interface DryRunTransactionBlockParams {
|
|
|
15
15
|
export interface ExecuteTransactionBlockParams {
|
|
16
16
|
transactionBlock: Uint8Array | string;
|
|
17
17
|
signature: string | string[];
|
|
18
|
-
options?: RpcTypes.
|
|
18
|
+
options?: RpcTypes.WowTransactionBlockResponseOptions | null | undefined;
|
|
19
19
|
requestType?: RpcTypes.ExecuteTransactionRequestType | null | undefined;
|
|
20
20
|
signal?: AbortSignal;
|
|
21
21
|
}
|
|
@@ -68,7 +68,7 @@ export interface GetNormalizedMoveStructParams {
|
|
|
68
68
|
}
|
|
69
69
|
export interface GetObjectParams {
|
|
70
70
|
id: string;
|
|
71
|
-
options?: RpcTypes.
|
|
71
|
+
options?: RpcTypes.WowObjectDataOptions | null | undefined;
|
|
72
72
|
signal?: AbortSignal;
|
|
73
73
|
}
|
|
74
74
|
export interface GetProtocolConfigParams {
|
|
@@ -80,28 +80,28 @@ export interface GetTotalTransactionBlocksParams {
|
|
|
80
80
|
}
|
|
81
81
|
export interface GetTransactionBlockParams {
|
|
82
82
|
digest: string;
|
|
83
|
-
options?: RpcTypes.
|
|
83
|
+
options?: RpcTypes.WowTransactionBlockResponseOptions | null | undefined;
|
|
84
84
|
signal?: AbortSignal;
|
|
85
85
|
}
|
|
86
86
|
export interface MultiGetObjectsParams {
|
|
87
87
|
ids: string[];
|
|
88
|
-
options?: RpcTypes.
|
|
88
|
+
options?: RpcTypes.WowObjectDataOptions | null | undefined;
|
|
89
89
|
signal?: AbortSignal;
|
|
90
90
|
}
|
|
91
91
|
export interface MultiGetTransactionBlocksParams {
|
|
92
92
|
digests: string[];
|
|
93
|
-
options?: RpcTypes.
|
|
93
|
+
options?: RpcTypes.WowTransactionBlockResponseOptions | null | undefined;
|
|
94
94
|
signal?: AbortSignal;
|
|
95
95
|
}
|
|
96
96
|
export interface TryGetPastObjectParams {
|
|
97
97
|
id: string;
|
|
98
98
|
version: number;
|
|
99
|
-
options?: RpcTypes.
|
|
99
|
+
options?: RpcTypes.WowObjectDataOptions | null | undefined;
|
|
100
100
|
signal?: AbortSignal;
|
|
101
101
|
}
|
|
102
102
|
export interface TryMultiGetPastObjectsParams {
|
|
103
103
|
pastObjects: RpcTypes.GetPastObjectRequest[];
|
|
104
|
-
options?: RpcTypes.
|
|
104
|
+
options?: RpcTypes.WowObjectDataOptions | null | undefined;
|
|
105
105
|
signal?: AbortSignal;
|
|
106
106
|
}
|
|
107
107
|
export interface GetAllBalancesParams {
|
|
@@ -145,7 +145,7 @@ export interface GetDynamicFieldsParams {
|
|
|
145
145
|
limit?: number | null | undefined;
|
|
146
146
|
signal?: AbortSignal;
|
|
147
147
|
}
|
|
148
|
-
export interface
|
|
148
|
+
export interface GetLatestWowSystemStateParams {
|
|
149
149
|
signal?: AbortSignal;
|
|
150
150
|
}
|
|
151
151
|
export type GetOwnedObjectsParams = {
|
|
@@ -153,7 +153,7 @@ export type GetOwnedObjectsParams = {
|
|
|
153
153
|
cursor?: string | null | undefined;
|
|
154
154
|
limit?: number | null | undefined;
|
|
155
155
|
signal?: AbortSignal;
|
|
156
|
-
} & RpcTypes.
|
|
156
|
+
} & RpcTypes.WowObjectResponseQuery;
|
|
157
157
|
export interface GetReferenceGasPriceParams {
|
|
158
158
|
signal?: AbortSignal;
|
|
159
159
|
}
|
|
@@ -162,7 +162,7 @@ export interface GetStakesParams {
|
|
|
162
162
|
signal?: AbortSignal;
|
|
163
163
|
}
|
|
164
164
|
export interface GetStakesByIdsParams {
|
|
165
|
-
|
|
165
|
+
stakedWowIds: string[];
|
|
166
166
|
signal?: AbortSignal;
|
|
167
167
|
}
|
|
168
168
|
export interface GetTotalSupplyParams {
|
|
@@ -173,7 +173,7 @@ export interface GetValidatorsApyParams {
|
|
|
173
173
|
signal?: AbortSignal;
|
|
174
174
|
}
|
|
175
175
|
export interface QueryEventsParams {
|
|
176
|
-
query: RpcTypes.
|
|
176
|
+
query: RpcTypes.WowEventFilter;
|
|
177
177
|
cursor?: RpcTypes.EventId | null | undefined;
|
|
178
178
|
limit?: number | null | undefined;
|
|
179
179
|
order?: "ascending" | "descending" | null | undefined;
|
|
@@ -184,9 +184,9 @@ export type QueryTransactionBlocksParams = {
|
|
|
184
184
|
limit?: number | null | undefined;
|
|
185
185
|
order?: "ascending" | "descending" | null | undefined;
|
|
186
186
|
signal?: AbortSignal;
|
|
187
|
-
} & RpcTypes.
|
|
187
|
+
} & RpcTypes.WowTransactionBlockResponseQuery;
|
|
188
188
|
export interface SubscribeEventParams {
|
|
189
|
-
filter: RpcTypes.
|
|
189
|
+
filter: RpcTypes.WowEventFilter;
|
|
190
190
|
signal?: AbortSignal;
|
|
191
191
|
}
|
|
192
192
|
export interface SubscribeTransactionParams {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{fromBase64,toBase64}from'../_deps/bcs/index.js';import{blake2b}from'@noble/hashes/blake2b';import{bytesToHex}from'@noble/hashes/utils';import{bcs}from'../bcs/index.js';import{bytesEqual,PublicKey}from'../cryptography/publickey.js';import{SIGNATURE_FLAG_TO_SCHEME,SIGNATURE_SCHEME_TO_FLAG}from'../cryptography/signature-scheme.js';import{parseSerializedSignature}from'../cryptography/signature.js';import{normalizeWowAddress}from'../utils/
|
|
1
|
+
import{fromBase64,toBase64}from'../_deps/bcs/index.js';import{blake2b}from'@noble/hashes/blake2b';import{bytesToHex}from'@noble/hashes/utils';import{bcs}from'../bcs/index.js';import{bytesEqual,PublicKey}from'../cryptography/publickey.js';import{SIGNATURE_FLAG_TO_SCHEME,SIGNATURE_SCHEME_TO_FLAG}from'../cryptography/signature-scheme.js';import{parseSerializedSignature}from'../cryptography/signature.js';import{normalizeWowAddress}from'../utils/wow-types.js';import{publicKeyFromRawBytes}from'../verify/index.js';import{MultiSigSigner}from'./signer.js';export const MAX_SIGNER_IN_MULTISIG=0xa;export const MIN_SIGNER_IN_MULTISIG=0x1;export class MultiSigPublicKey extends PublicKey{['rawBytes'];['multisigPublicKey'];['publicKeys'];constructor(a){super();if(typeof a==='string')this['rawBytes']=fromBase64(a),this['multisigPublicKey']=bcs['MultiSigPublicKey']['parse'](this['rawBytes']);else a instanceof Uint8Array?(this['rawBytes']=a,this['multisigPublicKey']=bcs['MultiSigPublicKey']['parse'](this['rawBytes'])):(this['multisigPublicKey']=a,this['rawBytes']=bcs['MultiSigPublicKey']['serialize'](a)['toBytes']());if(this['multisigPublicKey']['threshold']<0x1)throw new Error('Invalid\x20threshold');const b=new Set();this['publicKeys']=this['multisigPublicKey']['pk_map']['map'](({pubKey:d,weight:e})=>{const [f,g]=Object['entries'](d)['filter'](([i])=>i!=='$kind')[0x0],h=Uint8Array['from'](g)['toString']();if(b['has'](h))throw new Error('Multisig\x20does\x20not\x20support\x20duplicate\x20public\x20keys');b['add'](h);if(e<0x1)throw new Error('Invalid\x20weight');return{'publicKey':publicKeyFromRawBytes(f,Uint8Array['from'](g)),'weight':e};});const c=this['publicKeys']['reduce']((d,{weight:e})=>d+e,0x0);if(this['multisigPublicKey']['threshold']>c)throw new Error('Unreachable\x20threshold');if(this['publicKeys']['length']>MAX_SIGNER_IN_MULTISIG)throw new Error('Max\x20number\x20of\x20signers\x20in\x20a\x20multisig\x20is\x20'+MAX_SIGNER_IN_MULTISIG);if(this['publicKeys']['length']<MIN_SIGNER_IN_MULTISIG)throw new Error('Min\x20number\x20of\x20signers\x20in\x20a\x20multisig\x20is\x20'+MIN_SIGNER_IN_MULTISIG);}static['fromPublicKeys']({threshold:a,publicKeys:b}){return new MultiSigPublicKey({'pk_map':b['map'](({publicKey:c,weight:d})=>{const e=SIGNATURE_FLAG_TO_SCHEME[c['flag']()];return{'pubKey':{[e]:c['toRawBytes']()},'weight':d};}),'threshold':a});}['equals'](a){return super['equals'](a);}['toRawBytes'](){return this['rawBytes'];}['getPublicKeys'](){return this['publicKeys'];}['getThreshold'](){return this['multisigPublicKey']['threshold'];}['getSigner'](...a){return new MultiSigSigner(this,a);}['toWAddress'](){const a=0x1+(0x40+0x1)*MAX_SIGNER_IN_MULTISIG+0x2,b=new Uint8Array(a);b['set']([SIGNATURE_SCHEME_TO_FLAG['MultiSig']]),b['set'](bcs['u16']()['serialize'](this['multisigPublicKey']['threshold'])['toBytes'](),0x1);let c=0x3;for(const {publicKey:d,weight:e}of this['publicKeys']){const f=d['toWBytes']();b['set'](f,c),c+=f['length'],b['set']([e],c++);}return normalizeWowAddress(bytesToHex(blake2b(b['slice'](0x0,c),{'dkLen':0x20})));}['flag'](){return SIGNATURE_SCHEME_TO_FLAG['MultiSig'];}async['verify'](a,b){const c=parseSerializedSignature(b);if(c['signatureScheme']!=='MultiSig')throw new Error('Invalid\x20signature\x20scheme');const {multisig:d}=c;let e=0x0;if(!bytesEqual(bcs['MultiSigPublicKey']['serialize'](this['multisigPublicKey'])['toBytes'](),bcs['MultiSigPublicKey']['serialize'](d['multisig_pk'])['toBytes']()))return![];for(const {publicKey:f,weight:g,signature:h}of parsePartialSignatures(d)){if(!await f['verify'](a,h))return![];e+=g;}return e>=this['multisigPublicKey']['threshold'];}['combinePartialSignatures'](a){if(a['length']>MAX_SIGNER_IN_MULTISIG)throw new Error('Max\x20number\x20of\x20signatures\x20in\x20a\x20multisig\x20is\x20'+MAX_SIGNER_IN_MULTISIG);let b=0x0;const c=new Array(a['length']);for(let g=0x0;g<a['length'];g++){const h=parseSerializedSignature(a[g]);if(h['signatureScheme']==='MultiSig')throw new Error('MultiSig\x20is\x20not\x20supported\x20inside\x20MultiSig');const k=h['publicKey'];c[g]={[h['signatureScheme']]:h['signature']};let l;for(let m=0x0;m<this['publicKeys']['length'];m++){if(bytesEqual(k,this['publicKeys'][m]['publicKey']['toRawBytes']())){if(b&0x1<<m)throw new Error('Received\x20multiple\x20signatures\x20from\x20the\x20same\x20public\x20key');l=m;break;}}if(l===undefined)throw new Error('Received\x20signature\x20from\x20unknown\x20public\x20key');b|=0x1<<l;}const d={'sigs':c,'bitmap':b,'multisig_pk':this['multisigPublicKey']},e=bcs['MultiSig']['serialize'](d,{'maxSize':0x2000})['toBytes'](),f=new Uint8Array(e['length']+0x1);return f['set']([SIGNATURE_SCHEME_TO_FLAG['MultiSig']]),f['set'](e,0x1),toBase64(f);}}export function parsePartialSignatures(a){const b=new Array(a['sigs']['length']);for(let c=0x0;c<a['sigs']['length'];c++){const [d,e]=Object['entries'](a['sigs'][c])['filter'](([l])=>l!=='$kind')[0x0],f=asIndices(a['bitmap']),g=f[c],h=a['multisig_pk']['pk_map'][g],j=Uint8Array['from'](Object['values'](h['pubKey'])[0x0]);if(d==='MultiSig')throw new Error('MultiSig\x20is\x20not\x20supported\x20inside\x20MultiSig');const k=publicKeyFromRawBytes(d,j);b[c]={'signatureScheme':d,'signature':Uint8Array['from'](e),'publicKey':k,'weight':h['weight']};}return b;}function asIndices(a){if(a<0x0||a>0x400)throw new Error('Invalid\x20bitmap');const b=[];for(let c=0x0;c<0xa;c++){(a&0x1<<c)!==0x0&&b['push'](c);}return Uint8Array['from'](b);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{toBase64}from'../_deps/bcs/index.js';import{parse}from'valibot';import{normalizeWowObjectId}from'../utils/
|
|
1
|
+
import{toBase64}from'../_deps/bcs/index.js';import{parse}from'valibot';import{normalizeWowObjectId}from'../utils/wow-types.js';import{ArgumentSchema}from'./data/internal.js';export var UpgradePolicy;(function(a){a[a['COMPATIBLE']=0x0]='COMPATIBLE',a[a['ADDITIVE']=0x80]='ADDITIVE',a[a['DEP_ONLY']=0xc0]='DEP_ONLY';}(UpgradePolicy||(UpgradePolicy={})));export const Commands={'MoveCall'(a){const [b,c='',d='']='target'in a?a['target']['split']('::'):[a['package'],a['module'],a['function']];return{'$kind':'MoveCall','MoveCall':{'package':b,'module':c,'function':d,'typeArguments':a['typeArguments']??[],'arguments':a['arguments']??[]}};},'TransferObjects'(a,b){return{'$kind':'TransferObjects','TransferObjects':{'objects':a['map'](c=>parse(ArgumentSchema,c)),'address':parse(ArgumentSchema,b)}};},'SplitCoins'(a,b){return{'$kind':'SplitCoins','SplitCoins':{'coin':parse(ArgumentSchema,a),'amounts':b['map'](c=>parse(ArgumentSchema,c))}};},'MergeCoins'(a,b){return{'$kind':'MergeCoins','MergeCoins':{'destination':parse(ArgumentSchema,a),'sources':b['map'](c=>parse(ArgumentSchema,c))}};},'Publish'({modules:a,dependencies:b}){return{'$kind':'Publish','Publish':{'modules':a['map'](c=>typeof c==='string'?c:toBase64(new Uint8Array(c))),'dependencies':b['map'](c=>normalizeWowObjectId(c))}};},'Upgrade'({modules:a,dependencies:b,package:c,ticket:d}){return{'$kind':'Upgrade','Upgrade':{'modules':a['map'](e=>typeof e==='string'?e:toBase64(new Uint8Array(e))),'dependencies':b['map'](e=>normalizeWowObjectId(e)),'package':c,'ticket':parse(ArgumentSchema,d)}};},'MakeMoveVec'({type:a,elements:b}){return{'$kind':'MakeMoveVec','MakeMoveVec':{'type':a??null,'elements':b['map'](c=>parse(ArgumentSchema,c))}};},'Intent'({name:a,inputs:inputs={},data:data={}}){return{'$kind':'$Intent','$Intent':{'name':a,'inputs':Object['fromEntries'](Object['entries'](inputs)['map'](([b,c])=>[b,Array['isArray'](c)?c['map'](d=>parse(ArgumentSchema,d)):parse(ArgumentSchema,c)])),'data':data}};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{toBase64}from'../_deps/bcs/index.js';import{normalizeWowAddress}from'../utils/
|
|
1
|
+
import{toBase64}from'../_deps/bcs/index.js';import{normalizeWowAddress}from'../utils/wow-types.js';function Pure(a){return{'$kind':'Pure','Pure':{'bytes':a instanceof Uint8Array?toBase64(a):a['toBase64']()}};}export const Inputs={'Pure':Pure,'ObjectRef'({objectId:a,digest:b,version:c}){return{'$kind':'Object','Object':{'$kind':'ImmOrOwnedObject','ImmOrOwnedObject':{'digest':b,'version':c,'objectId':normalizeWowAddress(a)}}};},'SharedObjectRef'({objectId:a,mutable:b,initialSharedVersion:c}){return{'$kind':'Object','Object':{'$kind':'SharedObject','SharedObject':{'mutable':b,'initialSharedVersion':c,'objectId':normalizeWowAddress(a)}}};},'ReceivingRef'({objectId:a,digest:b,version:c}){return{'$kind':'Object','Object':{'$kind':'Receiving','Receiving':{'digest':b,'version':c,'objectId':normalizeWowAddress(a)}}};}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{normalizeWowAddress}from'../utils/
|
|
1
|
+
import{normalizeWowAddress}from'../utils/wow-types.js';export class AsyncCache{async['getObject'](a){const [b,c]=await Promise['all']([this['get']('OwnedObject',a),this['get']('SharedOrImmutableObject',a)]);return b??c??null;}async['getObjects'](a){return Promise['all'](a['map'](b=>this['getObject'](b)));}async['addObject'](a){return a['owner']?await this['set']('OwnedObject',a['objectId'],a):await this['set']('SharedOrImmutableObject',a['objectId'],a),a;}async['addObjects'](a){await Promise['all'](a['map'](async b=>this['addObject'](b)));}async['deleteObject'](a){await Promise['all']([this['delete']('OwnedObject',a),this['delete']('SharedOrImmutableObject',a)]);}async['deleteObjects'](a){await Promise['all'](a['map'](b=>this['deleteObject'](b)));}async['getMoveFunctionDefinition'](a){const b=normalizeWowAddress(a['package'])+'::'+a['module']+'::'+a['function'];return this['get']('MoveFunction',b);}async['addMoveFunctionDefinition'](a){const b=normalizeWowAddress(a['package']),c=b+'::'+a['module']+'::'+a['function'],d={...a,'package':b};return await this['set']('MoveFunction',c,d),d;}async['deleteMoveFunctionDefinition'](a){const b=normalizeWowAddress(a['package'])+'::'+a['module']+'::'+a['function'];await this['delete']('MoveFunction',b);}async['getCustom'](a){return this['get']('Custom',a);}async['setCustom'](a,b){return this['set']('Custom',a,b);}async['deleteCustom'](a){return this['delete']('Custom',a);}}export class InMemoryCache extends AsyncCache{#caches={'OwnedObject':new Map(),'SharedOrImmutableObject':new Map(),'MoveFunction':new Map(),'Custom':new Map()};async['get'](a,b){return this.#caches[a]['get'](b)??null;}async['set'](a,b,c){this.#caches[a]['set'](b,c);}async['delete'](a,b){this.#caches[a]['delete'](b);}async['clear'](a){if(a)this.#caches[a]['clear']();else for(const b of Object['values'](this.#caches)){b['clear']();}}}export class ObjectCache{#cache;#onEffects;constructor({cache:cache=new InMemoryCache(),onEffects:a}){this.#cache=cache,this.#onEffects=a;}['asPlugin'](){return async(a,b,c)=>{const d=a['inputs']['filter'](g=>g['UnresolvedObject'])['map'](g=>g['UnresolvedObject']['objectId']),e=(await this.#cache['getObjects'](d))['filter'](g=>g!==null),f=new Map(e['map'](g=>[g['objectId'],g]));for(const g of a['inputs']){if(!g['UnresolvedObject'])continue;const h=f['get'](g['UnresolvedObject']['objectId']);if(!h)continue;h['initialSharedVersion']&&!g['UnresolvedObject']['initialSharedVersion']?g['UnresolvedObject']['initialSharedVersion']=h['initialSharedVersion']:(h['version']&&!g['UnresolvedObject']['version']&&(g['UnresolvedObject']['version']=h['version']),h['digest']&&!g['UnresolvedObject']['digest']&&(g['UnresolvedObject']['digest']=h['digest']));}await Promise['all'](a['commands']['map'](async i=>{if(i['MoveCall']){const j=await this['getMoveFunctionDefinition']({'package':i['MoveCall']['package'],'module':i['MoveCall']['module'],'function':i['MoveCall']['function']});j&&(i['MoveCall']['_argumentTypes']=j['parameters']);}})),await c(),await Promise['all'](a['commands']['map'](async i=>{i['MoveCall']?.['_argumentTypes']&&await this.#cache['addMoveFunctionDefinition']({'package':i['MoveCall']['package'],'module':i['MoveCall']['module'],'function':i['MoveCall']['function'],'parameters':i['MoveCall']['_argumentTypes']});}));};}async['clear'](){await this.#cache['clear']();}async['getMoveFunctionDefinition'](a){return this.#cache['getMoveFunctionDefinition'](a);}async['getObjects'](a){return this.#cache['getObjects'](a);}async['deleteObjects'](a){return this.#cache['deleteObjects'](a);}async['clearOwnedObjects'](){await this.#cache['clear']('OwnedObject');}async['clearCustom'](){await this.#cache['clear']('Custom');}async['getCustom'](a){return this.#cache['getCustom'](a);}async['setCustom'](a,b){return this.#cache['setCustom'](a,b);}async['deleteCustom'](a){return this.#cache['deleteCustom'](a);}async['applyEffects'](a){if(!a['V2'])throw new Error('Unsupported\x20transaction\x20effects\x20version\x20'+a['$kind']);const {lamportVersion:b,changedObjects:c}=a['V2'],d=[],e=[];c['forEach'](([f,g])=>{if(g['outputState']['NotExist'])d['push'](f);else{if(g['outputState']['ObjectWrite']){const [h,i]=g['outputState']['ObjectWrite'];e['push']({'objectId':f,'digest':h,'version':b,'owner':i['AddressOwner']??i['ObjectOwner']??null,'initialSharedVersion':i['Shared']?.['initialSharedVersion']??null});}}}),await Promise['all']([this.#cache['addObjects'](e),this.#cache['deleteObjects'](d),this.#onEffects?.(a)]);}}
|