Skip to content

Commit 9c231ec

Browse files
committed
chore: fix bundling and test wasm-sdk
1 parent 6ffa2de commit 9c231ec

File tree

127 files changed

+2265
-20959
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

127 files changed

+2265
-20959
lines changed

.pnp.cjs

Lines changed: 199 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import * as wasm from './wasm';
2+
import { asJsonString } from './util';
3+
4+
export class ContractsFacade {
5+
private _sdk: wasm.WasmSdk;
6+
7+
constructor(sdk: wasm.WasmSdk) {
8+
this._sdk = sdk;
9+
}
10+
11+
fetch(contractId: string): Promise<wasm.DataContractWasm> {
12+
return wasm.data_contract_fetch(this._sdk, contractId);
13+
}
14+
15+
fetchWithProof(contractId: string): Promise<any> {
16+
return wasm.data_contract_fetch_with_proof_info(this._sdk, contractId);
17+
}
18+
19+
getHistory(args: { contractId: string; limit?: number; startAtMs?: number | bigint }): Promise<any> {
20+
const { contractId, limit, startAtMs } = args;
21+
return wasm.get_data_contract_history(this._sdk, contractId, limit ?? null, null, startAtMs ?? null);
22+
}
23+
24+
getHistoryWithProof(args: { contractId: string; limit?: number; startAtMs?: number | bigint }): Promise<any> {
25+
const { contractId, limit, startAtMs } = args;
26+
return wasm.get_data_contract_history_with_proof_info(this._sdk, contractId, limit ?? null, null, startAtMs ?? null);
27+
}
28+
29+
getMany(contractIds: string[]): Promise<any> {
30+
return wasm.get_data_contracts(this._sdk, contractIds);
31+
}
32+
33+
getManyWithProof(contractIds: string[]): Promise<any> {
34+
return wasm.get_data_contracts_with_proof_info(this._sdk, contractIds);
35+
}
36+
37+
create(args: { ownerId: string; definition: unknown; privateKeyWif: string; keyId?: number }): Promise<any> {
38+
const { ownerId, definition, privateKeyWif, keyId } = args;
39+
return this._sdk.contractCreate(ownerId, asJsonString(definition)!, privateKeyWif, keyId ?? null);
40+
}
41+
42+
update(args: { contractId: string; ownerId: string; updates: unknown; privateKeyWif: string; keyId?: number }): Promise<any> {
43+
const { contractId, ownerId, updates, privateKeyWif, keyId } = args;
44+
return this._sdk.contractUpdate(contractId, ownerId, asJsonString(updates)!, privateKeyWif, keyId ?? null);
45+
}
46+
}

0 commit comments

Comments
 (0)