@kontor/kontor-sdk 1.0.0-alpha.14 → 1.0.0-alpha.16
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/exports/index.js +17 -1
- package/dist/cjs/exports/index.js.map +1 -1
- package/dist/cjs/sdk/actions/kontor/public/{build-compose-call.js → build-compose-query.js} +8 -9
- package/dist/cjs/sdk/actions/kontor/public/build-compose-query.js.map +1 -0
- package/dist/{src/sdk/actions/kontor/public/build-instruction.js → cjs/sdk/actions/kontor/public/build-instruction-query.js} +5 -8
- package/dist/cjs/sdk/actions/kontor/public/build-instruction-query.js.map +1 -0
- package/dist/cjs/sdk/actions/kontor/public/{call-proc.js → call-compose.js} +7 -9
- package/dist/cjs/sdk/actions/kontor/public/call-compose.js.map +1 -0
- package/dist/cjs/sdk/actions/kontor/public/proc-contract.js +8 -5
- package/dist/cjs/sdk/actions/kontor/public/proc-contract.js.map +1 -1
- package/dist/cjs/sdk/actions/kontor/wallet/sign-reveal.js +1 -1
- package/dist/cjs/sdk/actions/kontor/wallet/sign-reveal.js.map +1 -1
- package/dist/cjs/sdk/clients/decorators/kontor/public.js +6 -6
- package/dist/cjs/sdk/clients/decorators/kontor/public.js.map +1 -1
- package/dist/cjs/sdk/contracts/wits.js.map +1 -1
- package/dist/cjs/sdk/types/kontor.js +28 -0
- package/dist/cjs/sdk/types/kontor.js.map +1 -1
- package/dist/cjs/tsconfig.build.tsbuildinfo +1 -1
- package/dist/esm/exports/index.js +8 -0
- package/dist/esm/exports/index.js.map +1 -1
- package/dist/esm/sdk/actions/kontor/public/proc-contract.js +8 -5
- package/dist/esm/sdk/actions/kontor/public/proc-contract.js.map +1 -1
- package/dist/esm/sdk/actions/kontor/wallet/sign-reveal.js +4 -6
- package/dist/esm/sdk/actions/kontor/wallet/sign-reveal.js.map +1 -1
- package/dist/esm/sdk/clients/decorators/kontor/public.js +6 -6
- package/dist/esm/sdk/clients/decorators/kontor/public.js.map +1 -1
- package/dist/esm/sdk/contracts/wits.js.map +1 -1
- package/dist/esm/sdk/types/kontor.js +27 -1
- package/dist/esm/sdk/types/kontor.js.map +1 -1
- package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/exports/index.d.ts +8 -0
- package/dist/types/exports/index.d.ts.map +1 -1
- package/dist/types/sdk/actions/kontor/public/build-compose-query.d.ts +16 -0
- package/dist/types/sdk/actions/kontor/public/build-compose-query.d.ts.map +1 -0
- package/dist/types/sdk/actions/kontor/public/build-instruction-query.d.ts +25 -0
- package/dist/types/sdk/actions/kontor/public/build-instruction-query.d.ts.map +1 -0
- package/dist/types/sdk/actions/kontor/public/call-compose.d.ts +20 -0
- package/dist/types/sdk/actions/kontor/public/call-compose.d.ts.map +1 -0
- package/dist/types/sdk/actions/kontor/public/proc-contract.d.ts +2 -2
- package/dist/types/sdk/actions/kontor/public/proc-contract.d.ts.map +1 -1
- package/dist/types/sdk/actions/kontor/wallet/sign-reveal.d.ts.map +1 -1
- package/dist/types/sdk/clients/decorators/kontor/public.d.ts +6 -6
- package/dist/types/sdk/clients/decorators/kontor/public.d.ts.map +1 -1
- package/dist/types/sdk/contracts/wits.d.ts +6 -5
- package/dist/types/sdk/contracts/wits.d.ts.map +1 -1
- package/dist/types/sdk/types/kontor.d.ts +15 -1
- package/dist/types/sdk/types/kontor.d.ts.map +1 -1
- package/package.json +2 -6
- package/src/exports/index.ts +44 -0
- package/src/sdk/actions/kontor/public/build-compose-query.ts +1 -1
- package/dist/cjs/sdk/actions/kontor/public/build-compose-call.js.map +0 -1
- package/dist/cjs/sdk/actions/kontor/public/build-instruction.js +0 -48
- package/dist/cjs/sdk/actions/kontor/public/build-instruction.js.map +0 -1
- package/dist/cjs/sdk/actions/kontor/public/call-proc.js.map +0 -1
- package/dist/esm/sdk/actions/kontor/public/build-compose-call.js +0 -31
- package/dist/esm/sdk/actions/kontor/public/build-compose-call.js.map +0 -1
- package/dist/esm/sdk/actions/kontor/public/build-instruction.js +0 -49
- package/dist/esm/sdk/actions/kontor/public/build-instruction.js.map +0 -1
- package/dist/esm/sdk/actions/kontor/public/call-proc.js +0 -39
- package/dist/esm/sdk/actions/kontor/public/call-proc.js.map +0 -1
- package/dist/src/exports/index.js +0 -11
- package/dist/src/exports/index.js.map +0 -1
- package/dist/src/sdk/accounts/private-key-to-account.js +0 -42
- package/dist/src/sdk/accounts/private-key-to-account.js.map +0 -1
- package/dist/src/sdk/actions/get-contract.js +0 -50
- package/dist/src/sdk/actions/get-contract.js.map +0 -1
- package/dist/src/sdk/actions/get-contract.test-d.js +0 -43
- package/dist/src/sdk/actions/get-contract.test-d.js.map +0 -1
- package/dist/src/sdk/actions/kontor/public/build-compose-call.js +0 -30
- package/dist/src/sdk/actions/kontor/public/build-compose-call.js.map +0 -1
- package/dist/src/sdk/actions/kontor/public/build-instruction.js.map +0 -1
- package/dist/src/sdk/actions/kontor/public/call-proc.js +0 -43
- package/dist/src/sdk/actions/kontor/public/call-proc.js.map +0 -1
- package/dist/src/sdk/actions/kontor/public/call-view.js +0 -21
- package/dist/src/sdk/actions/kontor/public/call-view.js.map +0 -1
- package/dist/src/sdk/actions/kontor/public/inspect.js +0 -20
- package/dist/src/sdk/actions/kontor/public/inspect.js.map +0 -1
- package/dist/src/sdk/actions/kontor/public/proc-contract.js +0 -54
- package/dist/src/sdk/actions/kontor/public/proc-contract.js.map +0 -1
- package/dist/src/sdk/actions/kontor/public/proc-contract.test.js +0 -47
- package/dist/src/sdk/actions/kontor/public/proc-contract.test.js.map +0 -1
- package/dist/src/sdk/actions/kontor/public/view-contract.js +0 -43
- package/dist/src/sdk/actions/kontor/public/view-contract.js.map +0 -1
- package/dist/src/sdk/actions/kontor/public/view-contract.test-d.js +0 -43
- package/dist/src/sdk/actions/kontor/public/view-contract.test-d.js.map +0 -1
- package/dist/src/sdk/actions/kontor/wallet/sign-reveal.js +0 -88
- package/dist/src/sdk/actions/kontor/wallet/sign-reveal.js.map +0 -1
- package/dist/src/sdk/actions/wallet/get-addresses.js +0 -20
- package/dist/src/sdk/actions/wallet/get-addresses.js.map +0 -1
- package/dist/src/sdk/actions/wallet/sign-psbt.js +0 -28
- package/dist/src/sdk/actions/wallet/sign-psbt.js.map +0 -1
- package/dist/src/sdk/clients/base/create-http-client.js +0 -41
- package/dist/src/sdk/clients/base/create-http-client.js.map +0 -1
- package/dist/src/sdk/clients/base/create-rpc-client.js +0 -41
- package/dist/src/sdk/clients/base/create-rpc-client.js.map +0 -1
- package/dist/src/sdk/clients/create-public-client.js +0 -13
- package/dist/src/sdk/clients/create-public-client.js.map +0 -1
- package/dist/src/sdk/clients/create-wallet-client.js +0 -14
- package/dist/src/sdk/clients/create-wallet-client.js.map +0 -1
- package/dist/src/sdk/clients/decorators/kontor/public.js +0 -19
- package/dist/src/sdk/clients/decorators/kontor/public.js.map +0 -1
- package/dist/src/sdk/clients/kontor/create-public-client.js +0 -14
- package/dist/src/sdk/clients/kontor/create-public-client.js.map +0 -1
- package/dist/src/sdk/clients/transports/create-rpc-transport.js +0 -36
- package/dist/src/sdk/clients/transports/create-rpc-transport.js.map +0 -1
- package/dist/src/sdk/contracts/wits.js +0 -26
- package/dist/src/sdk/contracts/wits.js.map +0 -1
- package/dist/src/sdk/test/e2e.test.js +0 -166
- package/dist/src/sdk/test/e2e.test.js.map +0 -1
- package/dist/src/sdk/types/chain.js +0 -2
- package/dist/src/sdk/types/chain.js.map +0 -1
- package/dist/src/sdk/types/contract.js +0 -2
- package/dist/src/sdk/types/contract.js.map +0 -1
- package/dist/src/sdk/types/http-schema.js +0 -73
- package/dist/src/sdk/types/http-schema.js.map +0 -1
- package/dist/src/sdk/types/kontor.js +0 -28
- package/dist/src/sdk/types/kontor.js.map +0 -1
- package/dist/src/sdk/types/rpc-schema.js +0 -2
- package/dist/src/sdk/types/rpc-schema.js.map +0 -1
- package/dist/src/sdk/utils/chain/defineChain.js +0 -9
- package/dist/src/sdk/utils/chain/defineChain.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/dist/types/sdk/actions/kontor/public/build-compose-call.d.ts +0 -21
- package/dist/types/sdk/actions/kontor/public/build-compose-call.d.ts.map +0 -1
- package/dist/types/sdk/actions/kontor/public/build-instruction.d.ts +0 -17
- package/dist/types/sdk/actions/kontor/public/build-instruction.d.ts.map +0 -1
- package/dist/types/sdk/actions/kontor/public/call-proc.d.ts +0 -23
- package/dist/types/sdk/actions/kontor/public/call-proc.d.ts.map +0 -1
- /package/dist/{src → esm}/sdk/actions/kontor/public/build-compose-query.js +0 -0
- /package/dist/{src → esm}/sdk/actions/kontor/public/build-compose-query.js.map +0 -0
- /package/dist/{src → esm}/sdk/actions/kontor/public/build-instruction-query.js +0 -0
- /package/dist/{src → esm}/sdk/actions/kontor/public/build-instruction-query.js.map +0 -0
- /package/dist/{src → esm}/sdk/actions/kontor/public/call-compose.js +0 -0
- /package/dist/{src → esm}/sdk/actions/kontor/public/call-compose.js.map +0 -0
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
// import { getAction } from "../utils/getAction.js";
|
|
2
|
-
import {} from "./kontor/public/view-contract.js";
|
|
3
|
-
// TODO: move to utils
|
|
4
|
-
function camelToKebab(str) {
|
|
5
|
-
return str.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
6
|
-
}
|
|
7
|
-
export function getContract({ wit: wit, }) {
|
|
8
|
-
const hasPublicClient = true;
|
|
9
|
-
const contract = {};
|
|
10
|
-
// TODO: actually introspect this
|
|
11
|
-
let hasReadFunction = true;
|
|
12
|
-
if (hasPublicClient) {
|
|
13
|
-
if (hasReadFunction) {
|
|
14
|
-
console.log("we are defining a proxy");
|
|
15
|
-
contract.view = new Proxy({}, {
|
|
16
|
-
get(_, functionName) {
|
|
17
|
-
// @ts-ignore
|
|
18
|
-
const witFunctionName = camelToKebab(functionName);
|
|
19
|
-
return (...parameters) => {
|
|
20
|
-
// @ts-ignore
|
|
21
|
-
const { args, options } = getFunctionParameters(parameters);
|
|
22
|
-
// return getAction(
|
|
23
|
-
// {
|
|
24
|
-
// viewContract: () => {},
|
|
25
|
-
// call: () => {},
|
|
26
|
-
// },
|
|
27
|
-
// viewContract,
|
|
28
|
-
// "viewContract",
|
|
29
|
-
// )({
|
|
30
|
-
// wit,
|
|
31
|
-
// functionName: witFunctionName,
|
|
32
|
-
// // address,
|
|
33
|
-
// args,
|
|
34
|
-
// ...options,
|
|
35
|
-
// } as ViewContractParameters);
|
|
36
|
-
};
|
|
37
|
-
},
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
contract.wit = wit;
|
|
42
|
-
return contract;
|
|
43
|
-
}
|
|
44
|
-
export function getFunctionParameters(values) {
|
|
45
|
-
const hasArgs = values.length && Array.isArray(values[0]);
|
|
46
|
-
const args = hasArgs ? values[0] : [];
|
|
47
|
-
const options = (hasArgs ? values[1] : values[0]) ?? {};
|
|
48
|
-
return { args, options };
|
|
49
|
-
}
|
|
50
|
-
//# sourceMappingURL=get-contract.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-contract.js","sourceRoot":"","sources":["../../../../src/sdk/actions/get-contract.ts"],"names":[],"mappings":"AAiBA,qDAAqD;AACrD,OAAO,EAIN,MAAM,kCAAkC,CAAC;AAE1C,sBAAsB;AACtB,SAAS,YAAY,CAAC,GAAW;IAC/B,OAAO,GAAG,CAAC,OAAO,CAAC,oBAAoB,EAAE,OAAO,CAAC,CAAC,WAAW,EAAE,CAAC;AAClE,CAAC;AAqED,MAAM,UAAU,WAAW,CAA6C,EACtE,GAAG,EAAE,GAAG,GACmB;IAC3B,MAAM,eAAe,GAAG,IAAI,CAAC;IAE7B,MAAM,QAAQ,GAEV,EAAE,CAAC;IAEP,iCAAiC;IACjC,IAAI,eAAe,GAAG,IAAI,CAAC;IAE3B,IAAI,eAAe,EAAE,CAAC;QACpB,IAAI,eAAe,EAAE,CAAC;YACpB,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;YA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-
import {} from "./get-contract.js";
|
|
4
|
-
const input = [
|
|
5
|
-
// TODO: build in record defs should be defined under the hood
|
|
6
|
-
// "record tool { name: string, isHammer: bool }",
|
|
7
|
-
"export fib: func(ctx: borrow<proc-context>, arith-address: contract-address, n: u64) -> u64;",
|
|
8
|
-
"export fib-of-sub: func(ctx: borrow<proc-context>, arith-address: contract-address, x: string, y: string) -> result<u64, error>;",
|
|
9
|
-
"export cached-values: func(ctx: borrow<view-context>) -> list<u64>;",
|
|
10
|
-
"export fib-as-view: func(ctx: borrow<view-context>, n: u64) -> u64;",
|
|
11
|
-
"export read-with-record-arg: func(ctx: borrow<view-context>, contract-address: contract-address) -> u64;",
|
|
12
|
-
// "export read-tools: func(ctx: borrow<view-context>) -> list<tool>;",
|
|
13
|
-
];
|
|
14
|
-
const wit = parseWit(input);
|
|
15
|
-
test("KebabToCamel basic mapping", () => {
|
|
16
|
-
expectTypeOf().toEqualTypeOf();
|
|
17
|
-
expectTypeOf().toEqualTypeOf();
|
|
18
|
-
expectTypeOf().toEqualTypeOf();
|
|
19
|
-
});
|
|
20
|
-
test("GetContractReturnType", () => {
|
|
21
|
-
expectTypeOf().toEqualTypeOf;
|
|
22
|
-
});
|
|
23
|
-
test("GetContractReturnType view keys are camelCased", () => {
|
|
24
|
-
// For FibAbi, the only view fn is "cached-values", so this should be just "cachedValues"
|
|
25
|
-
expectTypeOf().toEqualTypeOf();
|
|
26
|
-
});
|
|
27
|
-
test("getContract", async () => {
|
|
28
|
-
// const contract = getContract({
|
|
29
|
-
// wit: wit,
|
|
30
|
-
// });
|
|
31
|
-
// const res0 = contract.view.readWithRecordArg(["token_10_11"]);
|
|
32
|
-
//
|
|
33
|
-
// const res = contract.view.cachedValues();
|
|
34
|
-
//
|
|
35
|
-
// const res_2 = contract.view.fibAsView([10n]);
|
|
36
|
-
// const re3 = contract.view.readTools();
|
|
37
|
-
});
|
|
38
|
-
test("GetViewFunction for cached-values (no inputs)", () => {
|
|
39
|
-
// return type: Promise<ViewContractReturnType<...>>
|
|
40
|
-
// kay
|
|
41
|
-
expectTypeOf().toEqualTypeOf();
|
|
42
|
-
});
|
|
43
|
-
//# sourceMappingURL=get-contract.test-d.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-contract.test-d.js","sourceRoot":"","sources":["../../../../src/sdk/actions/get-contract.test-d.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAC7D,OAAO,EAMN,MAAM,mBAAmB,CAAC;AAE3B,MAAM,KAAK,GAAG;IACZ,8DAA8D;IAC9D,mDAAmD;IACnD,8FAA8F;IAC9F,kIAAkI;IAClI,qEAAqE;IACrE,qEAAqE;IACrE,0GAA0G;IAC1G,uEAAuE;CAC/D,CAAC;AAEX,MAAM,GAAG,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;AAE5B,IAAI,CAAC,4BAA4B,EAAE,GAAG,EAAE;IAKtC,YAAY,EAAK,CAAC,aAAa,EAAkB,CAAC;IAClD,YAAY,EAAK,CAAC,aAAa,EAAc,CAAC;IAC9C,YAAY,EAAK,CAAC,aAAa,EAAS,CAAC;AAC3C,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,uBAAuB,EAAE,GAAG,EAAE;IACjC,YAAY,EAAqC,CAAC,aAOhD,CAAC;AACL,CAAC,CAAC,CAAC;AACH,IAAI,CAAC,gDAAgD,EAAE,GAAG,EAAE;IAG1D,yFAAyF;IACzF,YAAY,EAAY,CAAC,aAAa,EAEnC,CAAC;AACN,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,aAAa,EAAE,KAAK,IAAI,EAAE;IAC7B,iCAAiC;IACjC,cAAc;IACd,MAAM;IACN,iEAAiE;IACjE,EAAE;IACF,4CAA4C;IAC5C,EAAE;IACF,gDAAgD;IAChD,yCAAyC;AAC3C,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,+CAA+C,EAAE,GAAG,EAAE;IAGzD,oDAAoD;IACpD,MAAM;IACN,YAAY,EAA2B,CAAC,aAAa,EAAqB,CAAC;AAC7E,CAAC,CAAC,CAAC"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { buildInstructionQuery } from "./build-instruction-query.js";
|
|
2
|
-
import { getKontorAction } from "../../../utils/get-action.js";
|
|
3
|
-
export async function buildComposeCall(client, params) {
|
|
4
|
-
const account = client.account;
|
|
5
|
-
const { instruction: inst, utxos, address = account?.address, xOnlyPubKey = account?.xOnlyPubKey, } = params;
|
|
6
|
-
if (!xOnlyPubKey) {
|
|
7
|
-
// TODO: add custom error
|
|
8
|
-
throw new Error("x_only_public_key is required");
|
|
9
|
-
}
|
|
10
|
-
if (!address) {
|
|
11
|
-
// TODO: add custom error
|
|
12
|
-
throw new Error("address is required");
|
|
13
|
-
}
|
|
14
|
-
if (utxos.length === 0) {
|
|
15
|
-
// TODO: add custom error
|
|
16
|
-
throw new Error("at least one funding UTXO is required");
|
|
17
|
-
}
|
|
18
|
-
const instruction = await getKontorAction(client, buildInstructionQuery, "buildInstructionQuery")({
|
|
19
|
-
instruction: inst,
|
|
20
|
-
utxos,
|
|
21
|
-
xOnlyPubKey,
|
|
22
|
-
address,
|
|
23
|
-
});
|
|
24
|
-
return {
|
|
25
|
-
instructions: [instruction],
|
|
26
|
-
sat_per_vbyte: params.satsPerVByte,
|
|
27
|
-
envelope: null,
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
//# sourceMappingURL=build-compose-call.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build-compose-call.js","sourceRoot":"","sources":["../../../../../../src/sdk/actions/kontor/public/build-compose-call.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAiB/D,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAGpC,MAAgD,EAChD,MAAyC;IAEzC,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;IAE/B,MAAM,EACJ,WAAW,EAAE,IAAI,EACjB,KAAK,EACL,OAAO,GAAG,OAAO,EAAE,OAAO,EAC1B,WAAW,GAAG,OAAO,EAAE,WAAW,GACnC,GAAG,MAAM,CAAC;IAEX,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,yBAAyB;QACzB,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;IACnD,CAAC;IAED,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,yBAAyB;QACzB,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACzC,CAAC;IAED,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,yBAAyB;QACzB,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;IAC3D,CAAC;IAED,MAAM,WAAW,GAAG,MAAM,eAAe,CACvC,MAAM,EACN,qBAAqB,EACrB,uBAAuB,CACxB,CAAC;QACA,WAAW,EAAE,IAAI;QACjB,KAAK;QACL,WAAW;QACX,OAAO;KACR,CAAC,CAAC;IAEH,OAAO;QACL,YAAY,EAAE,CAAC,WAAW,CAAC;QAC3B,aAAa,EAAE,MAAM,CAAC,YAAY;QAClC,QAAQ,EAAE,IAAI;KACf,CAAC;AACJ,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build-instruction.js","sourceRoot":"","sources":["../../../../../../src/sdk/actions/kontor/public/build-instruction.ts"],"names":[],"mappings":"AAsCA,gDAAgD;AAEhD,SAAS,cAAc,CAAC,GAAW;IACjC,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CACb,gEAAgE,CACjE,CAAC;IACJ,CAAC;IACD,OAAO,GAAG,CAAC,WAAW,EAAE,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AC,WAAW,CAAC,CAAC;IAC1C,MAAM,UAAU,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAE3C,OAAO;QACL,OAAO;QACP,iBAAiB,EAAE,KAAK;QACxB,gBAAgB,EAAE,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC;QACtC,WAAW;QACX,mBAAmB,EAAE,kBAAkB,IAAI,IAAI;KAChD,CAAC;IACJ,CAAC,CAAA;AACD,CAAC,AADA"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { buildComposeCall } from "./build-compose-call.js";
|
|
2
|
-
import { getKontorAction } from "../../../utils/get-action.js";
|
|
3
|
-
import { Instruction, } from "../../../types/kontor.js";
|
|
4
|
-
export async function callProc(client, params) {
|
|
5
|
-
const account = client.account;
|
|
6
|
-
const { contractAddress, wave, gas, utxos, address = account?.address, xOnlyPubKey = account?.xOnlyPubKey, satsPerVByte, } = params;
|
|
7
|
-
if (!xOnlyPubKey) {
|
|
8
|
-
// TODO: add custom error
|
|
9
|
-
throw new Error("x_only_public_key is required");
|
|
10
|
-
}
|
|
11
|
-
if (!address) {
|
|
12
|
-
// TODO: add custom error
|
|
13
|
-
throw new Error("address is required");
|
|
14
|
-
}
|
|
15
|
-
if (utxos.length === 0) {
|
|
16
|
-
// TODO: add custom error
|
|
17
|
-
throw new Error("at least one funding UTXO is required");
|
|
18
|
-
}
|
|
19
|
-
// TODO: wrap in try-catch
|
|
20
|
-
const composeCall = await getKontorAction(client, buildComposeCall, "buildComposeCall")({
|
|
21
|
-
contractAddress,
|
|
22
|
-
instruction: Instruction.call({
|
|
23
|
-
contract: contractAddress,
|
|
24
|
-
expr: wave,
|
|
25
|
-
gasLimit: gas,
|
|
26
|
-
}),
|
|
27
|
-
utxos,
|
|
28
|
-
xOnlyPubKey,
|
|
29
|
-
address,
|
|
30
|
-
satsPerVByte,
|
|
31
|
-
});
|
|
32
|
-
console.log(client);
|
|
33
|
-
console.log(composeCall);
|
|
34
|
-
const response = await client.request({
|
|
35
|
-
route: "/transactions/compose",
|
|
36
|
-
method: "POST",
|
|
37
|
-
// TODO: body type checking is broken
|
|
38
|
-
body: composeCall,
|
|
39
|
-
});
|
|
40
|
-
console.log("resopnse", response);
|
|
41
|
-
return response;
|
|
42
|
-
}
|
|
43
|
-
//# sourceMappingURL=call-proc.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"call-proc.js","sourceRoot":"","sources":["../../../../../../src/sdk/actions/kontor/public/call-proc.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAGL,WAAW,GACZ,MAAM,0BAA0B,CAAC;AAuBlC,MAAM,CAAC,KAAK,UAAU,QAAQ,CAG5B,MAAgD,EAChD,MAAiC;IAEjC,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;IAE/B,MAAM,EACJ,eAAe,EACf,IAAI,EACJ,GAAG,EACH,KAAK,EACL,OAAO,GAAG,OAAO,EAAE,OAAO,EAC1B,WAAW,GAAG,OAAO,EAAE,WAAW,EAClC,YAAY,GACb,GAAG,MAAM,CAAC;IAEX,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,yBAAyB;QACzB,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;IACnD,CAAC;IAED,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,yBAAyB;QACzB,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACzC,CAAC;IAED,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,yBAAyB;QACzB,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;IAC3D,CAAC;IACD,0BAA0B;IAE1B,MAAM,WAAW,GAAG,MAAM,eAAe,CACvC,MAAM,EACN,gBAAgB,EAChB,kBAAkB,CACnB,CAAC;QACA,eAAe;QACf,WAAW,EAAE,WAAW,CAAC,IAAI,CAAC;YAC5B,QAAQ,EAAE,eAAe;YACzB,IAAI,EAAE,IAAI;YACV,QAAQ,EAAE,GAAG;SACd,CAAC;QACF,KAAK;QACL,WAAW;QACX,OAAO;QACP,YAAY;KACb,CAAC,CAAC;IAEH,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACpB,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAEzB,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC;QACpC,KAAK,EAAE,uBAAuB;QAC9B,MAAM,EAAE,MAAM;QACd,qCAAqC;QACrC,IAAI,EAAE,WAAW;KAClB,CAAC,CAAC;IACH,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;IAElC,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export async function callView(client, params) {
|
|
2
|
-
const { contractAddress, wave } = params;
|
|
3
|
-
try {
|
|
4
|
-
const response = await client.request({
|
|
5
|
-
route: "/contracts/:contractAddress",
|
|
6
|
-
method: "POST",
|
|
7
|
-
path: { contractAddress },
|
|
8
|
-
// TODO: body tdype checking is busted
|
|
9
|
-
body: { expr: wave },
|
|
10
|
-
});
|
|
11
|
-
console.log("callView response:", response);
|
|
12
|
-
// TODO: fix CallViwewReturnType
|
|
13
|
-
// @ts-ignore
|
|
14
|
-
return response;
|
|
15
|
-
}
|
|
16
|
-
catch (e) {
|
|
17
|
-
// TODO: augment error handling
|
|
18
|
-
throw e;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=call-view.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"call-view.js","sourceRoot":"","sources":["../../../../../../src/sdk/actions/kontor/public/call-view.ts"],"names":[],"mappings":"AA2BA,MAAM,CAAC,KAAK,UAAU,QAAQ,CAG5B,MAAgD,EAChD,MAAiC;IAEjC,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;IAEzC,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC;YACpC,KAAK,EAAE,6BAA6B;YACpC,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,EAAE,eAAe,EAAE;YACzB,sCAAsC;YACtC,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE;SACrB,CAAC,CAAC;QAEH,OAAO,CAAC,GAAG,CAAC,oBAAoB,EAAE,QAAQ,CAAC,CAAC;QAE5C,gCAAgC;QAChC,aAAa;QACb,OAAO,QAAQ,CAAC;IAClB,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,+BAA+B;QAC/B,MAAM,CAAC,CAAC;IACV,CAAC;AACH,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export async function inspect(client, params) {
|
|
2
|
-
const { hex } = params;
|
|
3
|
-
try {
|
|
4
|
-
const response = await client.request({
|
|
5
|
-
route: "/transactions/inspect",
|
|
6
|
-
method: "POST",
|
|
7
|
-
// TODO: body tdype checking is busted
|
|
8
|
-
body: { hex: hex },
|
|
9
|
-
});
|
|
10
|
-
console.log("callView response:", response);
|
|
11
|
-
// TODO: fix CallViwewReturnType
|
|
12
|
-
// @ts-ignore
|
|
13
|
-
return response;
|
|
14
|
-
}
|
|
15
|
-
catch (e) {
|
|
16
|
-
// TODO: augment error handling
|
|
17
|
-
throw e;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=inspect.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"inspect.js","sourceRoot":"","sources":["../../../../../../src/sdk/actions/kontor/public/inspect.ts"],"names":[],"mappings":"AAaA,MAAM,CAAC,KAAK,UAAU,OAAO,CAG3B,MAAgD,EAChD,MAAyB;IAEzB,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,CAAC;IAEvB,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC;YACpC,KAAK,EAAE,uBAAuB;YAC9B,MAAM,EAAE,MAAM;YACd,sCAAsC;YACtC,IAAI,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE;SACnB,CAAC,CAAC;QAEH,OAAO,CAAC,GAAG,CAAC,oBAAoB,EAAE,QAAQ,CAAC,CAAC;QAE5C,gCAAgC;QAChC,aAAa;QACb,OAAO,QAAQ,CAAC;IAClB,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,+BAA+B;QAC/B,MAAM,CAAC,CAAC;IACV,CAAC;AACH,CAAC"}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { Instruction } from "../../../../sdk/types/kontor.js";
|
|
2
|
-
import { getKontorAction } from "../../../utils/get-action.js";
|
|
3
|
-
import { encodeFunctionData, } from "../../../utils/wit/encode-function-data.js";
|
|
4
|
-
import { callCompose } from "./call-compose.js";
|
|
5
|
-
export async function procContract(client, parameters) {
|
|
6
|
-
const { wit: wit, contractAddress, args, functionName, utxos, gas, satsPerVByte, address = client.account?.address, xOnlyPubKey = client.account?.xOnlyPubKey,
|
|
7
|
-
// @ts-ignore
|
|
8
|
-
...rest } = parameters;
|
|
9
|
-
// @ts-ignore
|
|
10
|
-
const wave = encodeFunctionData({
|
|
11
|
-
wit: wit,
|
|
12
|
-
args,
|
|
13
|
-
functionName,
|
|
14
|
-
});
|
|
15
|
-
if (!xOnlyPubKey) {
|
|
16
|
-
// TODO: add custom error
|
|
17
|
-
throw new Error("x_only_public_key is required");
|
|
18
|
-
}
|
|
19
|
-
if (!address) {
|
|
20
|
-
// TODO: add custom error
|
|
21
|
-
throw new Error("address is required");
|
|
22
|
-
}
|
|
23
|
-
if (utxos.length === 0) {
|
|
24
|
-
// TODO: add custom error
|
|
25
|
-
throw new Error("at least one funding UTXO is required");
|
|
26
|
-
}
|
|
27
|
-
try {
|
|
28
|
-
const response = await getKontorAction(client, callCompose, "callCompose")({
|
|
29
|
-
utxos,
|
|
30
|
-
satsPerVByte,
|
|
31
|
-
address,
|
|
32
|
-
xOnlyPubKey,
|
|
33
|
-
instruction: Instruction.call({
|
|
34
|
-
contract: contractAddress,
|
|
35
|
-
gasLimit: gas,
|
|
36
|
-
expr: wave,
|
|
37
|
-
}),
|
|
38
|
-
});
|
|
39
|
-
return response;
|
|
40
|
-
}
|
|
41
|
-
catch (error) {
|
|
42
|
-
console.log(error);
|
|
43
|
-
throw error;
|
|
44
|
-
// throw getContractError(error as BaseError, {
|
|
45
|
-
//
|
|
46
|
-
// abi: wit,
|
|
47
|
-
// address,
|
|
48
|
-
// args,
|
|
49
|
-
// docsPath: "/docs/contract/readContract",
|
|
50
|
-
// functionName,
|
|
51
|
-
// });
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
//# sourceMappingURL=proc-contract.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"proc-contract.js","sourceRoot":"","sources":["../../../../../../src/sdk/actions/kontor/public/proc-contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAW9D,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EACL,kBAAkB,GAEnB,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAE,WAAW,EAA8B,MAAM,mBAAmB,CAAC;AAuB5E,MAAM,CAAC,KAAK,UAAU,YAAY,CAOhC,MAAgD,EAChD,UAA2D;IAE3D,MAAM,EACJ,GAAG,EAAE,GAAG,EACR,eAAe,EACf,IAAI,EACJ,YAAY,EACZ,KAAK,EACL,GAAG,EACH,YAAY,EACZ,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,OAAO,EACjC,WAAW,GAAG,MAAM,CAAC,OAAO,EAAE,WAAW;IACzC,aAAa;IACb,GAAG,IAAI,EACR,GAAG,UAAoC,CAAC;IAEzC,aAAa;IACb,MAAM,IAAI,GAAG,kBAAkB,CAAC;QAC9B,GAAG,EAAE,GAAG;QACR,IAAI;QACJ,YAAY;KACmB,CAAC,CAAC;IAEnC,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,yBAAyB;QACzB,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;IACnD,CAAC;IAED,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,yBAAyB;QACzB,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACzC,CAAC;IAED,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,yBAAyB;QACzB,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;IAC3D,CAAC;IAED,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,eAAe,CACpC,MAAM,EACN,WAAW,EACX,aAAa,CACd,CAAC;YACA,KAAK;YACL,YAAY;YACZ,OAAO;YACP,WAAW;YACX,WAAW,EAAE,WAAW,CAAC,IAAI,CAAC;gBAC5B,QAAQ,EAAE,eAAe;gBACzB,QAAQ,EAAE,GAAG;gBACb,IAAI,EAAE,IAAI;aACX,CAAC;SACH,CAAC,CAAC;QAEH,OAAO,QAAQ,CAAC;IAClB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACnB,MAAM,KAAK,CAAC;QACZ,+CAA+C;QAC/C,EAAE;QACF,cAAc;QACd,aAAa;QACb,UAAU;QACV,6CAA6C;QAC7C,kBAAkB;QAClB,MAAM;IACR,CAAC;AACH,CAAC"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { test } from "vitest";
|
|
2
|
-
// import { procContract } from "./proc-contract.js";
|
|
3
|
-
import { parseWit } from "../../../../wit/wit-parser/parse-wit.js";
|
|
4
|
-
import { createPublicClient } from "../../../clients/kontor/create-public-client.js";
|
|
5
|
-
import { http } from "../../../clients/transports/http.js";
|
|
6
|
-
// define the wit
|
|
7
|
-
const input = [
|
|
8
|
-
"record balance { key: string, value: decimal }",
|
|
9
|
-
// TODO: barfing on core-context
|
|
10
|
-
// "export issuance: func(ctx: borrow<core-context>, n: decimal) -> result<_, error>;",
|
|
11
|
-
// "export hold: func(ctx: borrow<core-context>, n: decimal) -> result<_, error>;",
|
|
12
|
-
// "export burn-and-release: func(ctx: borrow<core-context>, n: decimal) -> result<_, error>;",
|
|
13
|
-
"export init: func(ctx: borrow<proc-context>);",
|
|
14
|
-
"export mint: func(ctx: borrow<proc-context>, n: decimal) -> result<_, error>;",
|
|
15
|
-
"export burn: func(ctx: borrow<proc-context>, n: decimal) -> result<_, error>;",
|
|
16
|
-
"export transfer: func(ctx: borrow<proc-context>, to: string, n: decimal) -> result<_, error>;",
|
|
17
|
-
"export balance: func(ctx: borrow<view-context>, acc: string) -> option<decimal>;",
|
|
18
|
-
"export balances: func(ctx: borrow<view-context>) -> list<balance>;",
|
|
19
|
-
"export total-supply: func(ctx: borrow<view-context>) -> decimal;",
|
|
20
|
-
];
|
|
21
|
-
const wit = parseWit(input);
|
|
22
|
-
test("e2e", async () => {
|
|
23
|
-
const client = createPublicClient({
|
|
24
|
-
transport: http("https://signet.kontor.network:35000/api"),
|
|
25
|
-
// optional parameter
|
|
26
|
-
account: [
|
|
27
|
-
"tb1pj2wrjsg0ksmmflec0myf3j7qnqm9myvk2pesqn7y8cqn6sgdg9ls9u6tar",
|
|
28
|
-
"2c7b730daa0036e8276cdd8fabe844b2dd324a6d227dd209663805189d03e51f",
|
|
29
|
-
],
|
|
30
|
-
});
|
|
31
|
-
// proc contract action defined on client
|
|
32
|
-
// response is correctly typed
|
|
33
|
-
const res = await client.procContract({
|
|
34
|
-
wit: wit,
|
|
35
|
-
// can also be injected
|
|
36
|
-
functionName: "mint", // functin name is only valid if it's got a proc-context
|
|
37
|
-
contractAddress: "token_0_0",
|
|
38
|
-
args: [[7n, 18]],
|
|
39
|
-
satsPerVByte: 1,
|
|
40
|
-
utxos: [
|
|
41
|
-
"57f1f46857ab12e20f32ecaac780b4096b0951458e15ab08e2ce0992f0521323:0",
|
|
42
|
-
],
|
|
43
|
-
gas: 10n,
|
|
44
|
-
});
|
|
45
|
-
console.log({ callproc: res.result });
|
|
46
|
-
});
|
|
47
|
-
//# sourceMappingURL=proc-contract.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"proc-contract.test.js","sourceRoot":"","sources":["../../../../../../src/sdk/actions/kontor/public/proc-contract.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,qDAAqD;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,yCAAyC,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iDAAiD,CAAC;AACrF,OAAO,EAAE,IAAI,EAAE,MAAM,qCAAqC,CAAC;AAE3D,iBAAiB;AACjB,MAAM,KAAK,GAAG;IACZ,gDAAgD;IAChD,gCAAgC;IAChC,uFAAuF;IACvF,mFAAmF;IACnF,+FAA+F;IAC/F,+CAA+C;IAC/C,+EAA+E;IAC/E,+EAA+E;IAC/E,+FAA+F;IAC/F,kFAAkF;IAClF,oEAAoE;IACpE,kEAAkE;CAC1D,CAAC;AAEX,MAAM,GAAG,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;AAE5B,IAAI,CAAC,KAAK,EAAE,KAAK,IAAI,EAAE;IACrB,MAAM,MAAM,GAAG,kBAAkB,CAAC;QAChC,SAAS,EAAE,IAAI,CAAC,yCAAyC,CAAC;QAC1D,qBAAqB;QACrB,OAAO,EAAE;YACP,gEAAgE;YAChE,kEAAkE;SACnE;KACF,CAAC,CAAC;IAEH,yCAAyC;IACzC,8BAA8B;IAC9B,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC;QACpC,GAAG,EAAE,GAAG;QACR,uBAAuB;QAEvB,YAAY,EAAE,MAAM,EAAE,wDAAwD;QAC9E,eAAe,EAAE,WAAW;QAC5B,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;QAChB,YAAY,EAAE,CAAC;QACf,KAAK,EAAE;YACL,oEAAoE;SACrE;QACD,GAAG,EAAE,GAAG;KACT,CAAC,CAAC;IAEH,OAAO,CAAC,GAAG,CAAC,EAAE,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;AACxC,CAAC,CAAC,CAAC"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { getKontorAction } from "../../../utils/get-action.js";
|
|
2
|
-
import { decodeFunctionResult } from "../../../utils/wit/decode-function-result.js";
|
|
3
|
-
// import { getAction } from "../../utils/getAction.js";
|
|
4
|
-
import { encodeFunctionData, } from "../../../utils/wit/encode-function-data.js";
|
|
5
|
-
import { callView } from "./call-view.js";
|
|
6
|
-
export async function viewContract(client, parameters) {
|
|
7
|
-
const { wit: wit, contractAddress, args, functionName,
|
|
8
|
-
// @ts-ignore
|
|
9
|
-
...rest } = parameters;
|
|
10
|
-
// @ts-ignore
|
|
11
|
-
const wave = encodeFunctionData({
|
|
12
|
-
wit: wit,
|
|
13
|
-
args,
|
|
14
|
-
functionName,
|
|
15
|
-
});
|
|
16
|
-
try {
|
|
17
|
-
const response = await getKontorAction(client, callView, "callView")({
|
|
18
|
-
contractAddress: contractAddress,
|
|
19
|
-
wave: wave,
|
|
20
|
-
});
|
|
21
|
-
if ("Err" in response.result) {
|
|
22
|
-
throw new Error("Contract view call failed");
|
|
23
|
-
}
|
|
24
|
-
const value = response.result.Ok.value;
|
|
25
|
-
return decodeFunctionResult({
|
|
26
|
-
wit: wit,
|
|
27
|
-
functionName,
|
|
28
|
-
data: value,
|
|
29
|
-
});
|
|
30
|
-
//
|
|
31
|
-
}
|
|
32
|
-
catch (error) {
|
|
33
|
-
throw new Error("problems");
|
|
34
|
-
// throw getContractError(error as BaseError, {
|
|
35
|
-
// abi: wit,
|
|
36
|
-
// address,
|
|
37
|
-
// args,
|
|
38
|
-
// docsPath: "/docs/contract/readContract",
|
|
39
|
-
// functionName,
|
|
40
|
-
// });
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
//# sourceMappingURL=view-contract.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"view-contract.js","sourceRoot":"","sources":["../../../../../../src/sdk/actions/kontor/public/view-contract.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,8CAA8C,CAAC;AACpF,wDAAwD;AACxD,OAAO,EACL,kBAAkB,GAEnB,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AA6B1C,MAAM,CAAC,KAAK,UAAU,YAAY,CAOhC,MAAgD,EAChD,UAA2D;IAE3D,MAAM,EACJ,GAAG,EAAE,GAAG,EACR,eAAe,EACf,IAAI,EACJ,YAAY;IAEZ,aAAa;IACb,GAAG,IAAI,EACR,GAAG,UAAoC,CAAC;IAEzC,aAAa;IACb,MAAM,IAAI,GAAG,kBAAkB,CAAC;QAC9B,GAAG,EAAE,GAAG;QACR,IAAI;QACJ,YAAY;KACmB,CAAC,CAAC;IAEnC,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,eAAe,CACpC,MAAM,EACN,QAAQ,EACR,UAAU,CACX,CAAC;YACA,eAAe,EAAE,eAAe;YAChC,IAAI,EAAE,IAAI;SACX,CAAC,CAAC;QAEH,IAAI,KAAK,IAAI,QAAQ,CAAC,MAAM,EAAE,CAAC;YAC7B,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;QAC/C,CAAC;QAED,MAAM,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC;QAEvC,OAAO,oBAAoB,CAAC;YAC1B,GAAG,EAAE,GAAG;YACR,YAAY;YACZ,IAAI,EAAE,KAAK;SACZ,CAA8C,CAAC;QAChD,EAAE;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,UAAU,CAAC,CAAC;QAC5B,+CAA+C;QAC/C,cAAc;QACd,aAAa;QACb,UAAU;QACV,6CAA6C;QAC7C,kBAAkB;QAClB,MAAM;IACR,CAAC;AACH,CAAC"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { test } from "vitest";
|
|
2
|
-
import { viewContract } from "./view-contract.js";
|
|
3
|
-
import { parseWit } from "../../../../wit/wit-parser/parse-wit.js";
|
|
4
|
-
import { createPublicClient } from "../../../clients/kontor/create-public-client.js";
|
|
5
|
-
import { http } from "../../../clients/transports/http.js";
|
|
6
|
-
// define the wit
|
|
7
|
-
const input = [
|
|
8
|
-
"record balance { key: string, value: decimal }",
|
|
9
|
-
// TODO: barfing on core-context
|
|
10
|
-
// "export issuance: func(ctx: borrow<core-context>, n: decimal) -> result<_, error>;",
|
|
11
|
-
// "export hold: func(ctx: borrow<core-context>, n: decimal) -> result<_, error>;",
|
|
12
|
-
// "export burn-and-release: func(ctx: borrow<core-context>, n: decimal) -> result<_, error>;",
|
|
13
|
-
"export init: func(ctx: borrow<proc-context>);",
|
|
14
|
-
"export mint: func(ctx: borrow<proc-context>, n: decimal) -> result<_, error>;",
|
|
15
|
-
"export burn: func(ctx: borrow<proc-context>, n: decimal) -> result<_, error>;",
|
|
16
|
-
"export transfer: func(ctx: borrow<proc-context>, to: string, n: decimal) -> result<_, error>;",
|
|
17
|
-
"export balance: func(ctx: borrow<view-context>, acc: string) -> option<decimal>;",
|
|
18
|
-
"export balances: func(ctx: borrow<view-context>) -> list<balance>;",
|
|
19
|
-
"export total-supply: func(ctx: borrow<view-context>) -> decimal;",
|
|
20
|
-
];
|
|
21
|
-
const wit = parseWit(input);
|
|
22
|
-
test("e2e", async () => {
|
|
23
|
-
const client = createPublicClient({
|
|
24
|
-
transport: http("https://signet-staging.kontor.network:35000/api"),
|
|
25
|
-
});
|
|
26
|
-
// view contract action defined on client
|
|
27
|
-
// response is correctly typed
|
|
28
|
-
const res = await client.viewContract({
|
|
29
|
-
wit: wit,
|
|
30
|
-
functionName: "balances", // functin name is only valid if it's got a view-context
|
|
31
|
-
contractAddress: "token_0_0",
|
|
32
|
-
});
|
|
33
|
-
console.log("res:", res);
|
|
34
|
-
// inject client directly into view contract action
|
|
35
|
-
const res2 = await viewContract(client, {
|
|
36
|
-
wit: wit,
|
|
37
|
-
functionName: "balance",
|
|
38
|
-
contractAddress: "token_0_0",
|
|
39
|
-
args: ["252a90b16b5c25b9f366ab4b518f9f2ce3624d23c05dc26f7649f51515c76e2d"],
|
|
40
|
-
});
|
|
41
|
-
console.log("res2:", res2);
|
|
42
|
-
});
|
|
43
|
-
//# sourceMappingURL=view-contract.test-d.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"view-contract.test-d.js","sourceRoot":"","sources":["../../../../../../src/sdk/actions/kontor/public/view-contract.test-d.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,yCAAyC,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iDAAiD,CAAC;AACrF,OAAO,EAAE,IAAI,EAAE,MAAM,qCAAqC,CAAC;AAE3D,iBAAiB;AACjB,MAAM,KAAK,GAAG;IACZ,gDAAgD;IAChD,gCAAgC;IAChC,uFAAuF;IACvF,mFAAmF;IACnF,+FAA+F;IAC/F,+CAA+C;IAC/C,+EAA+E;IAC/E,+EAA+E;IAC/E,+FAA+F;IAC/F,kFAAkF;IAClF,oEAAoE;IACpE,kEAAkE;CAC1D,CAAC;AAEX,MAAM,GAAG,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;AAE5B,IAAI,CAAC,KAAK,EAAE,KAAK,IAAI,EAAE;IACrB,MAAM,MAAM,GAAG,kBAAkB,CAAC;QAChC,SAAS,EAAE,IAAI,CAAC,iDAAiD,CAAC;KACnE,CAAC,CAAC;IAEH,yCAAyC;IACzC,8BAA8B;IAC9B,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC;QACpC,GAAG,EAAE,GAAG;QACR,YAAY,EAAE,UAAU,EAAE,wDAAwD;QAClF,eAAe,EAAE,WAAW;KAC7B,CAAC,CAAC;IAEH,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACzB,mDAAmD;IACnD,MAAM,IAAI,GAAG,MAAM,YAAY,CAAC,MAAM,EAAE;QACtC,GAAG,EAAE,GAAG;QACR,YAAY,EAAE,SAAS;QACvB,eAAe,EAAE,WAAW;QAC5B,IAAI,EAAE,CAAC,kEAAkE,CAAC;KAC3E,CAAC,CAAC;IAEH,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;AAC7B,CAAC,CAAC,CAAC"}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { parseAccount } from "../../../accounts/utils/parse-account.js";
|
|
2
|
-
import { getAction } from "../../../utils/get-action.js";
|
|
3
|
-
import { signPsbt } from "../../wallet/sign-psbt.js";
|
|
4
|
-
import { TaprootControlBlock, Transaction, utils as u, } from "@scure/btc-signer";
|
|
5
|
-
import { hex } from "@scure/base";
|
|
6
|
-
export async function signReveal(client, parameters) {
|
|
7
|
-
const { account: account_ = client.account, chain = client.chain, ...params } = parameters;
|
|
8
|
-
if (!account_)
|
|
9
|
-
throw new Error("AccountNotFoundError");
|
|
10
|
-
const account = parseAccount(account_);
|
|
11
|
-
// TODO: assertRequest(account, paramatetrs )
|
|
12
|
-
// TODO: assertCurrentChain(chanId, chain)
|
|
13
|
-
const tx = Transaction.fromPSBT(hex.decode(params.psbt), {
|
|
14
|
-
allowUnknownInputs: true,
|
|
15
|
-
});
|
|
16
|
-
for (let i = 0; i < params.parcipantScripts.length; i++) {
|
|
17
|
-
const { commit_tap_leaf_script } = params.parcipantScripts[i];
|
|
18
|
-
const scriptBytes = hex.decode(commit_tap_leaf_script.script);
|
|
19
|
-
const controlBlockBytes = hex.decode(commit_tap_leaf_script.controlBlock);
|
|
20
|
-
const leafVersion = commit_tap_leaf_script.leafVersion;
|
|
21
|
-
// scure expects script || leafVersion as one buffer
|
|
22
|
-
const scriptWithVersion = u.concatBytes(scriptBytes, new Uint8Array([leafVersion]));
|
|
23
|
-
const controlBlockStruct = TaprootControlBlock.decode(controlBlockBytes);
|
|
24
|
-
tx.updateInput(i, {
|
|
25
|
-
tapLeafScript: [[controlBlockStruct, scriptWithVersion]],
|
|
26
|
-
}, true);
|
|
27
|
-
}
|
|
28
|
-
const signInputs = Array.from({
|
|
29
|
-
length: tx.inputsLength,
|
|
30
|
-
}, (_, i) => i);
|
|
31
|
-
const preparedPsbt = hex.encode(tx.toPSBT());
|
|
32
|
-
const signed = account.signPsbt
|
|
33
|
-
? await account.signPsbt({
|
|
34
|
-
psbt: preparedPsbt,
|
|
35
|
-
signInputs,
|
|
36
|
-
broadcast: false,
|
|
37
|
-
})
|
|
38
|
-
: await getAction(client, signPsbt, "signPsbt")({
|
|
39
|
-
account: account,
|
|
40
|
-
chain: chain,
|
|
41
|
-
psbt: preparedPsbt,
|
|
42
|
-
signInputs: signInputs,
|
|
43
|
-
broadcast: false,
|
|
44
|
-
});
|
|
45
|
-
const signedTx = Transaction.fromPSBT(hex.decode(signed.psbt), {
|
|
46
|
-
allowUnknownInputs: true,
|
|
47
|
-
});
|
|
48
|
-
// for (let i = 0; i < signedTx.inputsLength; i++) {
|
|
49
|
-
// const input = signedTx.getInput(i);
|
|
50
|
-
// if (input.tapLeafScript && input.tapLeafScript.length > 0) {
|
|
51
|
-
// const [cbStruct, scriptWithVersion] = input.tapLeafScript[0]!;
|
|
52
|
-
// console.log("SIGNED TAPLEAF", i, {
|
|
53
|
-
// cbStruct,
|
|
54
|
-
// cbEncoded: hex.encode(TaprootControlBlock.encode(cbStruct)),
|
|
55
|
-
// scriptWithVersion: hex.encode(scriptWithVersion),
|
|
56
|
-
// });
|
|
57
|
-
// }
|
|
58
|
-
// }
|
|
59
|
-
//
|
|
60
|
-
//
|
|
61
|
-
// finalize
|
|
62
|
-
for (let i = 0; i < params.parcipantScripts.length; i++) {
|
|
63
|
-
const input = signedTx.getInput(i);
|
|
64
|
-
const p = params.parcipantScripts[i];
|
|
65
|
-
const scriptHex = p.commit_tap_leaf_script.script;
|
|
66
|
-
const cbHex = p.commit_tap_leaf_script.controlBlock;
|
|
67
|
-
// console.log("USING SCRIPT/CB", {
|
|
68
|
-
// scriptHex,
|
|
69
|
-
// cbHex,
|
|
70
|
-
// cbDecodedRoundtrip: hex.encode(hex.decode(cbHex)),
|
|
71
|
-
// });
|
|
72
|
-
signedTx.updateInput(i, {
|
|
73
|
-
finalScriptWitness: [
|
|
74
|
-
input.tapScriptSig[0][1],
|
|
75
|
-
hex.decode(scriptHex),
|
|
76
|
-
hex.decode(cbHex),
|
|
77
|
-
],
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
// for (let i = 0; i < signedTx.inputsLength; i++) {
|
|
81
|
-
// const input = signedTx.getInput(i);
|
|
82
|
-
// console.log("FINAL INPUT", i, {
|
|
83
|
-
// finalScriptWitness: input.finalScriptWitness?.map((w) => hex.encode(w)),
|
|
84
|
-
// });
|
|
85
|
-
// }
|
|
86
|
-
return signedTx;
|
|
87
|
-
}
|
|
88
|
-
//# sourceMappingURL=sign-reveal.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sign-reveal.js","sourceRoot":"","sources":["../../../../../../src/sdk/actions/kontor/wallet/sign-reveal.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AAKxE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,QA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C,gBAAgB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACxD,MAAM,KAAK,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QACnC,MAAM,CAAC,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAE,CAAC;QAEtC,MAAM,SAAS,GAAG,CAAC,CAAC,sBAAsB,CAAC,MAAM,CAAC;QAClD,MAAM,KAAK,GAAG,CAAC,CAAC,sBAAsB,CAAC,YAAY,CAAC;QAEpD,mCAAmC;QACnC,eAAe;QACf,WAAW;QACX,uDAAuD;QACvD,MAAM;QAEN,QAAQ,CAAC,WAAW,CAAC,CAAC,EAAE;YACtB,kBAAkB,EAAE;gBAClB,KAAK,CAAC,YAAa,CAAC,CAAC,CAAE,CAAC,CAAC,CAAC;gBAC1B,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC;gBACrB,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC;aAClB;SACF,CAAC,CAAC;IACL,CAAC;IAED,oDAAoD;IACpD,wCAAwC;IACxC,oCAAoC;IACpC,+EAA+E;IAC/E,QAAQ;IACR,IAAI;IAEJ,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export async function getAddresses(client) {
|
|
2
|
-
if (client.account?.type === "local")
|
|
3
|
-
return {
|
|
4
|
-
result: {
|
|
5
|
-
addresses: [
|
|
6
|
-
{
|
|
7
|
-
address: client.account.address,
|
|
8
|
-
publicKey: client.account.xOnlyPubKey,
|
|
9
|
-
// TODO: add type
|
|
10
|
-
},
|
|
11
|
-
],
|
|
12
|
-
},
|
|
13
|
-
};
|
|
14
|
-
const addresses = await client.request({
|
|
15
|
-
method: "getAddresses",
|
|
16
|
-
params: undefined,
|
|
17
|
-
});
|
|
18
|
-
return addresses;
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=get-addresses.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-addresses.js","sourceRoot":"","sources":["../../../../../src/sdk/actions/wallet/get-addresses.ts"],"names":[],"mappings":"AAQA,MAAM,CAAC,KAAK,UAAU,YAAY,CAIhC,MAAkD;IAElD,IAAI,MAAM,CAAC,OAAO,EAAE,IAAI,KAAK,OAAO;QAClC,OAAO;YACL,MAAM,EAAE;gBACN,SAAS,EAAE;oBACT;wBACE,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,OAAO;wBAC/B,SAAS,EAAE,MAAM,CAAC,OAAO,CAAC,WAAW;wBACrC,iBAAiB;qBAClB;iBACF;aACF;SACF,CAAC;IACJ,MAAM,SAAS,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC;QACrC,MAAM,EAAE,cAAc;QACtB,MAAM,EAAE,SAAS;KAClB,CAAC,CAAC;IAEH,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { parseAccount } from "../../accounts/utils/parse-account.js";
|
|
2
|
-
export async function signPsbt(client, parameters) {
|
|
3
|
-
const { account: account_ = client.account, chain = client.chain, ...params } = parameters;
|
|
4
|
-
if (!account_)
|
|
5
|
-
throw new Error("AccountNotFoundError");
|
|
6
|
-
const account = parseAccount(account_);
|
|
7
|
-
// TODO: assertRequest(account, paramatetrs )
|
|
8
|
-
// TODO: assertCurrentChain(chanId, chain)
|
|
9
|
-
if (account.signPsbt) {
|
|
10
|
-
const res = await account.signPsbt({
|
|
11
|
-
psbt: params.psbt,
|
|
12
|
-
broadcast: params.broadcast,
|
|
13
|
-
signInputs: params.signInputs,
|
|
14
|
-
});
|
|
15
|
-
return res;
|
|
16
|
-
}
|
|
17
|
-
const res = await client.request({
|
|
18
|
-
method: "signPsbt",
|
|
19
|
-
params: {
|
|
20
|
-
psbt: params.psbt,
|
|
21
|
-
broadcast: params.broadcast,
|
|
22
|
-
signInputs: params.signInputs,
|
|
23
|
-
},
|
|
24
|
-
}, { retryCount: 0 });
|
|
25
|
-
// TODO: handle errors here
|
|
26
|
-
return res.result;
|
|
27
|
-
}
|
|
28
|
-
//# sourceMappingURL=sign-psbt.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sign-psbt.js","sourceRoot":"","sources":["../../../../../src/sdk/actions/wallet/sign-psbt.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAoBrE,MAAM,CAAC,KAAK,UAAU,QAAQ,CAK5B,MAAkD,EAClD,UAA8C;IAE9C,MAAM,EACJ,OAAO,EAAE,QAAQ,GAAG,MAAM,CAAC,OAAO,EAClC,KAAK,GAAG,MAAM,CAAC,KAAK,EACpB,GAAG,MAAM,EACV,GAAG,UAAU,CAAC;IAEf,IAAI,CAAC,QAAQ;QAAE,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;IAEvD,MAAM,OAAO,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC;IAEvC,6CAA6C;IAC7C,0CAA0C;IAE1C,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;QACrB,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC;YACjC,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,SAAS,EAAE,MAAM,CAAC,SAAS;YAC3B,UAAU,EAAE,MAAM,CAAC,UAAU;SAC9B,CAAC,CAAC;QACH,OAAO,GAAG,CAAC;IACb,CAAC;IAED,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,OAAO,CAC9B;QACE,MAAM,EAAE,UAAU;QAClB,MAAM,EAAE;YACN,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,SAAS,EAAE,MAAM,CAAC,SAAS;YAC3B,UAAU,EAAE,MAAM,CAAC,UAAU;SAC9B;KACF,EACD,EAAE,UAAU,EAAE,CAAC,EAAE,CAClB,CAAC;IAEF,2BAA2B;IAC3B,OAAO,GAAG,CAAC,MAAM,CAAC;AACpB,CAAC"}
|