@alephium/web3 0.12.3 → 0.12.5-rc.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/dist/alephium-web3.min.js +1 -1
- package/dist/alephium-web3.min.js.map +1 -1
- package/dist/src/contract/contract.d.ts +11 -6
- package/dist/src/contract/contract.js +28 -14
- package/dist/src/utils/webcrypto.d.ts +1 -0
- package/package.json +1 -1
- package/src/contract/contract.ts +43 -13
- package/src/utils/webcrypto.ts +5 -1
|
@@ -128,18 +128,18 @@ export declare class Contract extends Artifact {
|
|
|
128
128
|
toApiContractStates(states?: ContractState[]): node.ContractState[] | undefined;
|
|
129
129
|
toApiTestContractParams(funcName: string, params: TestContractParams): node.TestContract;
|
|
130
130
|
fromApiContractState(state: node.ContractState): ContractState<Fields>;
|
|
131
|
-
static fromApiContractState(state: node.ContractState): ContractState;
|
|
131
|
+
static fromApiContractState(state: node.ContractState, getContractByCodeHash?: (codeHash: string) => Contract): ContractState;
|
|
132
132
|
static ContractCreatedEventIndex: number;
|
|
133
133
|
static ContractCreatedEvent: EventSig;
|
|
134
134
|
static ContractDestroyedEventIndex: number;
|
|
135
135
|
static ContractDestroyedEvent: EventSig;
|
|
136
|
-
static fromApiEvent(event: node.ContractEventByTxId, codeHash: string | undefined, txId: string): ContractEvent;
|
|
136
|
+
static fromApiEvent(event: node.ContractEventByTxId, codeHash: string | undefined, txId: string, getContractByCodeHash?: (codeHash: string) => Contract): ContractEvent;
|
|
137
137
|
fromApiTestContractResult(methodName: string, result: node.TestContractResult, txId: string): TestContractResult<unknown>;
|
|
138
138
|
txParamsForDeployment<P extends Fields>(signer: SignerProvider, params: DeployContractParams<P>): Promise<SignDeployContractTxParams>;
|
|
139
139
|
buildByteCodeToDeploy(initialFields: Fields): string;
|
|
140
|
-
static fromApiEvents(events: node.ContractEventByTxId[], addressToCodeHash: Map<string, string>, txId: string): ContractEvent[];
|
|
140
|
+
static fromApiEvents(events: node.ContractEventByTxId[], addressToCodeHash: Map<string, string>, txId: string, getContractByCodeHash?: (codeHash: string) => Contract): ContractEvent[];
|
|
141
141
|
toApiCallContract<T extends Arguments>(params: CallContractParams<T>, groupIndex: number, contractAddress: string, methodIndex: number): node.CallContract;
|
|
142
|
-
fromApiCallContractResult(result: node.CallContractResult, txId: string, methodIndex: number): CallContractResult<unknown>;
|
|
142
|
+
fromApiCallContractResult(result: node.CallContractResult, txId: string, methodIndex: number, getContractByCodeHash?: (codeHash: string) => Contract): CallContractResult<unknown>;
|
|
143
143
|
}
|
|
144
144
|
export declare class Script extends Artifact {
|
|
145
145
|
readonly bytecodeTemplate: string;
|
|
@@ -235,6 +235,11 @@ export declare abstract class ContractFactory<I extends ContractInstance, F exte
|
|
|
235
235
|
deploy(signer: SignerProvider, deployParams: DeployContractParams<F>): Promise<DeployContractResult<I>>;
|
|
236
236
|
stateForTest(initFields: F, asset?: Asset, address?: string): ContractState<F>;
|
|
237
237
|
}
|
|
238
|
+
export declare class ExecutableScript<P extends Fields = Fields> {
|
|
239
|
+
readonly script: Script;
|
|
240
|
+
constructor(script: Script);
|
|
241
|
+
execute(signer: SignerProvider, params: ExecuteScriptParams<P>): Promise<ExecuteScriptResult>;
|
|
242
|
+
}
|
|
238
243
|
export interface ExecuteScriptParams<P extends Fields = Fields> {
|
|
239
244
|
initialFields: P;
|
|
240
245
|
attoAlphAmount?: Number256;
|
|
@@ -296,7 +301,7 @@ export declare function subscribeContractDestroyedEvent(options: SubscribeOption
|
|
|
296
301
|
export declare function decodeEvent<F extends Fields, M extends ContractEvent<F>>(contract: Contract, instance: ContractInstance, event: node.ContractEvent, targetEventIndex: number): M;
|
|
297
302
|
export declare function subscribeContractEvent<F extends Fields, M extends ContractEvent<F>>(contract: Contract, instance: ContractInstance, options: SubscribeOptions<M>, eventName: string, fromCount?: number): EventSubscription;
|
|
298
303
|
export declare function subscribeContractEvents(contract: Contract, instance: ContractInstance, options: SubscribeOptions<ContractEvent<any>>, fromCount?: number): EventSubscription;
|
|
299
|
-
export declare function callMethod<I extends ContractInstance, F extends Fields, A extends Arguments, R>(contract: ContractFactory<I, F>, instance: ContractInstance, methodName: string, params: Optional<CallContractParams<A>, 'args'
|
|
300
|
-
export declare function multicallMethods<I extends ContractInstance, F extends Fields>(contract: ContractFactory<I, F>, instance: ContractInstance, calls: Record<string, Optional<CallContractParams<any>, 'args'
|
|
304
|
+
export declare function callMethod<I extends ContractInstance, F extends Fields, A extends Arguments, R>(contract: ContractFactory<I, F>, instance: ContractInstance, methodName: string, params: Optional<CallContractParams<A>, 'args'>, getContractByCodeHash?: (codeHash: string) => Contract): Promise<CallContractResult<R>>;
|
|
305
|
+
export declare function multicallMethods<I extends ContractInstance, F extends Fields>(contract: ContractFactory<I, F>, instance: ContractInstance, calls: Record<string, Optional<CallContractParams<any>, 'args'>>, getContractByCodeHash?: (codeHash: string) => Contract): Promise<Record<string, CallContractResult<any>>>;
|
|
301
306
|
export declare function getContractEventsCurrentCount(contractAddress: Address): Promise<number>;
|
|
302
307
|
export {};
|
|
@@ -43,7 +43,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
43
43
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
44
44
|
};
|
|
45
45
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
-
exports.getContractEventsCurrentCount = exports.multicallMethods = exports.callMethod = exports.subscribeContractEvents = exports.subscribeContractEvent = exports.decodeEvent = exports.subscribeContractDestroyedEvent = exports.subscribeContractCreatedEvent = exports.fetchContractState = exports.ContractInstance = exports.testMethod = exports.addStdIdToFields = exports.subscribeEventsFromContract = exports.decodeContractDestroyedEvent = exports.decodeContractCreatedEvent = exports.DestroyContractEventAddress = exports.CreateContractEventAddress = exports.ContractFactory = exports.randomTxId = exports.toApiVals = exports.Script = exports.Contract = exports.Artifact = exports.Project = exports.DEFAULT_COMPILER_OPTIONS = exports.DEFAULT_NODE_COMPILER_OPTIONS = exports.StdIdFieldName = void 0;
|
|
46
|
+
exports.getContractEventsCurrentCount = exports.multicallMethods = exports.callMethod = exports.subscribeContractEvents = exports.subscribeContractEvent = exports.decodeEvent = exports.subscribeContractDestroyedEvent = exports.subscribeContractCreatedEvent = exports.fetchContractState = exports.ContractInstance = exports.testMethod = exports.addStdIdToFields = exports.subscribeEventsFromContract = exports.decodeContractDestroyedEvent = exports.decodeContractCreatedEvent = exports.DestroyContractEventAddress = exports.CreateContractEventAddress = exports.ExecutableScript = exports.ContractFactory = exports.randomTxId = exports.toApiVals = exports.Script = exports.Contract = exports.Artifact = exports.Project = exports.DEFAULT_COMPILER_OPTIONS = exports.DEFAULT_NODE_COMPILER_OPTIONS = exports.StdIdFieldName = void 0;
|
|
47
47
|
const buffer_1 = require("buffer/");
|
|
48
48
|
const fs_1 = __importDefault(require("fs"));
|
|
49
49
|
const fs_2 = require("fs");
|
|
@@ -620,11 +620,13 @@ class Contract extends Artifact {
|
|
|
620
620
|
asset: fromApiAsset(state.asset)
|
|
621
621
|
};
|
|
622
622
|
}
|
|
623
|
-
static fromApiContractState(state) {
|
|
624
|
-
const contract =
|
|
623
|
+
static fromApiContractState(state, getContractByCodeHash) {
|
|
624
|
+
const contract = getContractByCodeHash
|
|
625
|
+
? getContractByCodeHash(state.codeHash)
|
|
626
|
+
: Project.currentProject.contractByCodeHash(state.codeHash);
|
|
625
627
|
return contract.fromApiContractState(state);
|
|
626
628
|
}
|
|
627
|
-
static fromApiEvent(event, codeHash, txId) {
|
|
629
|
+
static fromApiEvent(event, codeHash, txId, getContractByCodeHash) {
|
|
628
630
|
let fields;
|
|
629
631
|
let name;
|
|
630
632
|
if (event.eventIndex == Contract.ContractCreatedEventIndex) {
|
|
@@ -636,7 +638,9 @@ class Contract extends Artifact {
|
|
|
636
638
|
name = Contract.ContractDestroyedEvent.name;
|
|
637
639
|
}
|
|
638
640
|
else {
|
|
639
|
-
const contract =
|
|
641
|
+
const contract = getContractByCodeHash
|
|
642
|
+
? getContractByCodeHash(codeHash)
|
|
643
|
+
: Project.currentProject.contractByCodeHash(codeHash);
|
|
640
644
|
const eventSig = contract.eventsSig[event.eventIndex];
|
|
641
645
|
fields = fromApiEventFields(event.fields, eventSig);
|
|
642
646
|
name = eventSig.name;
|
|
@@ -688,12 +692,12 @@ class Contract extends Artifact {
|
|
|
688
692
|
buildByteCodeToDeploy(initialFields) {
|
|
689
693
|
return ralph.buildContractByteCode(this.bytecode, initialFields, this.fieldsSig);
|
|
690
694
|
}
|
|
691
|
-
static fromApiEvents(events, addressToCodeHash, txId) {
|
|
695
|
+
static fromApiEvents(events, addressToCodeHash, txId, getContractByCodeHash) {
|
|
692
696
|
return events.map((event) => {
|
|
693
697
|
const contractAddress = event.contractAddress;
|
|
694
698
|
const codeHash = addressToCodeHash.get(contractAddress);
|
|
695
699
|
if (typeof codeHash !== 'undefined' || event.eventIndex < 0) {
|
|
696
|
-
return Contract.fromApiEvent(event, codeHash, txId);
|
|
700
|
+
return Contract.fromApiEvent(event, codeHash, txId, getContractByCodeHash);
|
|
697
701
|
}
|
|
698
702
|
else {
|
|
699
703
|
throw Error(`Cannot find codeHash for the contract address: ${contractAddress}`);
|
|
@@ -711,7 +715,7 @@ class Contract extends Artifact {
|
|
|
711
715
|
args: args
|
|
712
716
|
};
|
|
713
717
|
}
|
|
714
|
-
fromApiCallContractResult(result, txId, methodIndex) {
|
|
718
|
+
fromApiCallContractResult(result, txId, methodIndex, getContractByCodeHash) {
|
|
715
719
|
const returnTypes = this.functions[`${methodIndex}`].returnTypes;
|
|
716
720
|
const rawReturn = (0, api_1.fromApiArray)(result.returns, returnTypes);
|
|
717
721
|
const returns = rawReturn.length === 0 ? null : rawReturn.length === 1 ? rawReturn[0] : rawReturn;
|
|
@@ -720,10 +724,10 @@ class Contract extends Artifact {
|
|
|
720
724
|
return {
|
|
721
725
|
returns: returns,
|
|
722
726
|
gasUsed: result.gasUsed,
|
|
723
|
-
contracts: result.contracts.map((state) => Contract.fromApiContractState(state)),
|
|
727
|
+
contracts: result.contracts.map((state) => Contract.fromApiContractState(state, getContractByCodeHash)),
|
|
724
728
|
txInputs: result.txInputs,
|
|
725
729
|
txOutputs: result.txOutputs.map((output) => fromApiOutput(output)),
|
|
726
|
-
events: Contract.fromApiEvents(result.events, addressToCodeHash, txId)
|
|
730
|
+
events: Contract.fromApiEvents(result.events, addressToCodeHash, txId, getContractByCodeHash)
|
|
727
731
|
};
|
|
728
732
|
}
|
|
729
733
|
}
|
|
@@ -931,6 +935,16 @@ class ContractFactory {
|
|
|
931
935
|
}
|
|
932
936
|
}
|
|
933
937
|
exports.ContractFactory = ContractFactory;
|
|
938
|
+
class ExecutableScript {
|
|
939
|
+
constructor(script) {
|
|
940
|
+
this.script = script;
|
|
941
|
+
}
|
|
942
|
+
async execute(signer, params) {
|
|
943
|
+
const signerParams = await this.script.txParamsForExecution(signer, params);
|
|
944
|
+
return await signer.signAndSubmitExecuteScriptTx(signerParams);
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
exports.ExecutableScript = ExecutableScript;
|
|
934
948
|
function specialContractAddress(n) {
|
|
935
949
|
const bytes = new Uint8Array(32).fill(0);
|
|
936
950
|
bytes[31] = n;
|
|
@@ -1094,16 +1108,16 @@ function subscribeContractEvents(contract, instance, options, fromCount) {
|
|
|
1094
1108
|
return (0, events_1.subscribeToEvents)(opt, instance.address, fromCount);
|
|
1095
1109
|
}
|
|
1096
1110
|
exports.subscribeContractEvents = subscribeContractEvents;
|
|
1097
|
-
async function callMethod(contract, instance, methodName, params) {
|
|
1111
|
+
async function callMethod(contract, instance, methodName, params, getContractByCodeHash) {
|
|
1098
1112
|
const methodIndex = contract.contract.getMethodIndex(methodName);
|
|
1099
1113
|
const txId = params?.txId ?? randomTxId();
|
|
1100
1114
|
const callParams = contract.contract.toApiCallContract({ ...params, txId: txId, args: params.args === undefined ? {} : params.args }, instance.groupIndex, instance.address, methodIndex);
|
|
1101
1115
|
const result = await (0, global_1.getCurrentNodeProvider)().contracts.postContractsCallContract(callParams);
|
|
1102
|
-
const callResult = contract.contract.fromApiCallContractResult(result, txId, methodIndex);
|
|
1116
|
+
const callResult = contract.contract.fromApiCallContractResult(result, txId, methodIndex, getContractByCodeHash);
|
|
1103
1117
|
return callResult;
|
|
1104
1118
|
}
|
|
1105
1119
|
exports.callMethod = callMethod;
|
|
1106
|
-
async function multicallMethods(contract, instance, calls) {
|
|
1120
|
+
async function multicallMethods(contract, instance, calls, getContractByCodeHash) {
|
|
1107
1121
|
const callEntries = Object.entries(calls);
|
|
1108
1122
|
const callsParams = callEntries.map((entry) => {
|
|
1109
1123
|
const [methodName, params] = entry;
|
|
@@ -1117,7 +1131,7 @@ async function multicallMethods(contract, instance, calls) {
|
|
|
1117
1131
|
const methodIndex = call.methodIndex;
|
|
1118
1132
|
const callResult = result.results[`${methodIndex}`];
|
|
1119
1133
|
const methodName = callEntries[`${index}`][`0`];
|
|
1120
|
-
callsResult[`${methodName}`] = contract.contract.fromApiCallContractResult(callResult, call.txId, methodIndex);
|
|
1134
|
+
callsResult[`${methodName}`] = contract.contract.fromApiCallContractResult(callResult, call.txId, methodIndex, getContractByCodeHash);
|
|
1121
1135
|
});
|
|
1122
1136
|
return callsResult;
|
|
1123
1137
|
}
|
package/package.json
CHANGED
package/src/contract/contract.ts
CHANGED
|
@@ -922,8 +922,13 @@ export class Contract extends Artifact {
|
|
|
922
922
|
}
|
|
923
923
|
}
|
|
924
924
|
|
|
925
|
-
static fromApiContractState(
|
|
926
|
-
|
|
925
|
+
static fromApiContractState(
|
|
926
|
+
state: node.ContractState,
|
|
927
|
+
getContractByCodeHash?: (codeHash: string) => Contract
|
|
928
|
+
): ContractState {
|
|
929
|
+
const contract = getContractByCodeHash
|
|
930
|
+
? getContractByCodeHash(state.codeHash)
|
|
931
|
+
: Project.currentProject.contractByCodeHash(state.codeHash)
|
|
927
932
|
return contract.fromApiContractState(state)
|
|
928
933
|
}
|
|
929
934
|
|
|
@@ -941,7 +946,12 @@ export class Contract extends Artifact {
|
|
|
941
946
|
fieldTypes: ['Address']
|
|
942
947
|
}
|
|
943
948
|
|
|
944
|
-
static fromApiEvent(
|
|
949
|
+
static fromApiEvent(
|
|
950
|
+
event: node.ContractEventByTxId,
|
|
951
|
+
codeHash: string | undefined,
|
|
952
|
+
txId: string,
|
|
953
|
+
getContractByCodeHash?: (codeHash: string) => Contract
|
|
954
|
+
): ContractEvent {
|
|
945
955
|
let fields: Fields
|
|
946
956
|
let name: string
|
|
947
957
|
|
|
@@ -952,7 +962,9 @@ export class Contract extends Artifact {
|
|
|
952
962
|
fields = fromApiEventFields(event.fields, Contract.ContractDestroyedEvent, true)
|
|
953
963
|
name = Contract.ContractDestroyedEvent.name
|
|
954
964
|
} else {
|
|
955
|
-
const contract =
|
|
965
|
+
const contract = getContractByCodeHash
|
|
966
|
+
? getContractByCodeHash(codeHash!)
|
|
967
|
+
: Project.currentProject.contractByCodeHash(codeHash!)
|
|
956
968
|
const eventSig = contract.eventsSig[event.eventIndex]
|
|
957
969
|
fields = fromApiEventFields(event.fields, eventSig)
|
|
958
970
|
name = eventSig.name
|
|
@@ -1020,13 +1032,14 @@ export class Contract extends Artifact {
|
|
|
1020
1032
|
static fromApiEvents(
|
|
1021
1033
|
events: node.ContractEventByTxId[],
|
|
1022
1034
|
addressToCodeHash: Map<string, string>,
|
|
1023
|
-
txId: string
|
|
1035
|
+
txId: string,
|
|
1036
|
+
getContractByCodeHash?: (codeHash: string) => Contract
|
|
1024
1037
|
): ContractEvent[] {
|
|
1025
1038
|
return events.map((event) => {
|
|
1026
1039
|
const contractAddress = event.contractAddress
|
|
1027
1040
|
const codeHash = addressToCodeHash.get(contractAddress)
|
|
1028
1041
|
if (typeof codeHash !== 'undefined' || event.eventIndex < 0) {
|
|
1029
|
-
return Contract.fromApiEvent(event, codeHash, txId)
|
|
1042
|
+
return Contract.fromApiEvent(event, codeHash, txId, getContractByCodeHash)
|
|
1030
1043
|
} else {
|
|
1031
1044
|
throw Error(`Cannot find codeHash for the contract address: ${contractAddress}`)
|
|
1032
1045
|
}
|
|
@@ -1053,7 +1066,8 @@ export class Contract extends Artifact {
|
|
|
1053
1066
|
fromApiCallContractResult(
|
|
1054
1067
|
result: node.CallContractResult,
|
|
1055
1068
|
txId: string,
|
|
1056
|
-
methodIndex: number
|
|
1069
|
+
methodIndex: number,
|
|
1070
|
+
getContractByCodeHash?: (codeHash: string) => Contract
|
|
1057
1071
|
): CallContractResult<unknown> {
|
|
1058
1072
|
const returnTypes = this.functions[`${methodIndex}`].returnTypes
|
|
1059
1073
|
const rawReturn = fromApiArray(result.returns, returnTypes)
|
|
@@ -1064,10 +1078,10 @@ export class Contract extends Artifact {
|
|
|
1064
1078
|
return {
|
|
1065
1079
|
returns: returns,
|
|
1066
1080
|
gasUsed: result.gasUsed,
|
|
1067
|
-
contracts: result.contracts.map((state) => Contract.fromApiContractState(state)),
|
|
1081
|
+
contracts: result.contracts.map((state) => Contract.fromApiContractState(state, getContractByCodeHash)),
|
|
1068
1082
|
txInputs: result.txInputs,
|
|
1069
1083
|
txOutputs: result.txOutputs.map((output) => fromApiOutput(output)),
|
|
1070
|
-
events: Contract.fromApiEvents(result.events, addressToCodeHash, txId)
|
|
1084
|
+
events: Contract.fromApiEvents(result.events, addressToCodeHash, txId, getContractByCodeHash)
|
|
1071
1085
|
}
|
|
1072
1086
|
}
|
|
1073
1087
|
}
|
|
@@ -1404,6 +1418,19 @@ export abstract class ContractFactory<I extends ContractInstance, F extends Fiel
|
|
|
1404
1418
|
}
|
|
1405
1419
|
}
|
|
1406
1420
|
|
|
1421
|
+
export class ExecutableScript<P extends Fields = Fields> {
|
|
1422
|
+
readonly script: Script
|
|
1423
|
+
|
|
1424
|
+
constructor(script: Script) {
|
|
1425
|
+
this.script = script
|
|
1426
|
+
}
|
|
1427
|
+
|
|
1428
|
+
async execute(signer: SignerProvider, params: ExecuteScriptParams<P>): Promise<ExecuteScriptResult> {
|
|
1429
|
+
const signerParams = await this.script.txParamsForExecution(signer, params)
|
|
1430
|
+
return await signer.signAndSubmitExecuteScriptTx(signerParams)
|
|
1431
|
+
}
|
|
1432
|
+
}
|
|
1433
|
+
|
|
1407
1434
|
export interface ExecuteScriptParams<P extends Fields = Fields> {
|
|
1408
1435
|
initialFields: P
|
|
1409
1436
|
attoAlphAmount?: Number256
|
|
@@ -1685,7 +1712,8 @@ export async function callMethod<I extends ContractInstance, F extends Fields, A
|
|
|
1685
1712
|
contract: ContractFactory<I, F>,
|
|
1686
1713
|
instance: ContractInstance,
|
|
1687
1714
|
methodName: string,
|
|
1688
|
-
params: Optional<CallContractParams<A>, 'args'
|
|
1715
|
+
params: Optional<CallContractParams<A>, 'args'>,
|
|
1716
|
+
getContractByCodeHash?: (codeHash: string) => Contract
|
|
1689
1717
|
): Promise<CallContractResult<R>> {
|
|
1690
1718
|
const methodIndex = contract.contract.getMethodIndex(methodName)
|
|
1691
1719
|
const txId = params?.txId ?? randomTxId()
|
|
@@ -1696,14 +1724,15 @@ export async function callMethod<I extends ContractInstance, F extends Fields, A
|
|
|
1696
1724
|
methodIndex
|
|
1697
1725
|
)
|
|
1698
1726
|
const result = await getCurrentNodeProvider().contracts.postContractsCallContract(callParams)
|
|
1699
|
-
const callResult = contract.contract.fromApiCallContractResult(result, txId, methodIndex)
|
|
1727
|
+
const callResult = contract.contract.fromApiCallContractResult(result, txId, methodIndex, getContractByCodeHash)
|
|
1700
1728
|
return callResult as CallContractResult<R>
|
|
1701
1729
|
}
|
|
1702
1730
|
|
|
1703
1731
|
export async function multicallMethods<I extends ContractInstance, F extends Fields>(
|
|
1704
1732
|
contract: ContractFactory<I, F>,
|
|
1705
1733
|
instance: ContractInstance,
|
|
1706
|
-
calls: Record<string, Optional<CallContractParams<any>, 'args'
|
|
1734
|
+
calls: Record<string, Optional<CallContractParams<any>, 'args'>>,
|
|
1735
|
+
getContractByCodeHash?: (codeHash: string) => Contract
|
|
1707
1736
|
): Promise<Record<string, CallContractResult<any>>> {
|
|
1708
1737
|
const callEntries = Object.entries(calls)
|
|
1709
1738
|
const callsParams = callEntries.map((entry) => {
|
|
@@ -1726,7 +1755,8 @@ export async function multicallMethods<I extends ContractInstance, F extends Fie
|
|
|
1726
1755
|
callsResult[`${methodName}`] = contract.contract.fromApiCallContractResult(
|
|
1727
1756
|
callResult,
|
|
1728
1757
|
call.txId!,
|
|
1729
|
-
methodIndex
|
|
1758
|
+
methodIndex,
|
|
1759
|
+
getContractByCodeHash
|
|
1730
1760
|
) as CallContractResult<any>
|
|
1731
1761
|
})
|
|
1732
1762
|
return callsResult
|
package/src/utils/webcrypto.ts
CHANGED
|
@@ -22,7 +22,11 @@ import { webcrypto, randomFillSync } from 'crypto'
|
|
|
22
22
|
const isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined'
|
|
23
23
|
|
|
24
24
|
export class WebCrypto {
|
|
25
|
-
subtle
|
|
25
|
+
subtle: SubtleCrypto
|
|
26
|
+
|
|
27
|
+
constructor() {
|
|
28
|
+
this.subtle = isBrowser ? globalThis.crypto.subtle : webcrypto.subtle
|
|
29
|
+
}
|
|
26
30
|
|
|
27
31
|
public getRandomValues<T extends ArrayBufferView | null>(array: T): T {
|
|
28
32
|
if (!ArrayBuffer.isView(array)) {
|