@kontor/kontor-sdk 1.0.0-alpha.18 → 1.0.0-alpha.20
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/tsconfig.build.tsbuildinfo +1 -1
- package/dist/esm/exports/index.js.map +1 -1
- package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
- package/dist/src/exports/index.test.js +27 -0
- package/dist/src/exports/index.test.js.map +1 -0
- package/dist/src/sdk/accounts/private-key-to-account.js +42 -0
- package/dist/src/sdk/accounts/private-key-to-account.js.map +1 -0
- package/dist/src/sdk/actions/get-contract.js +50 -0
- package/dist/src/sdk/actions/get-contract.js.map +1 -0
- package/dist/src/sdk/actions/get-contract.test-d.js +43 -0
- package/dist/src/sdk/actions/get-contract.test-d.js.map +1 -0
- package/dist/src/sdk/actions/kontor/public/call-view.js +21 -0
- package/dist/src/sdk/actions/kontor/public/call-view.js.map +1 -0
- package/dist/src/sdk/actions/kontor/public/inspect.js +20 -0
- package/dist/src/sdk/actions/kontor/public/inspect.js.map +1 -0
- package/dist/src/sdk/actions/kontor/public/proc-contract.test.js +47 -0
- package/dist/src/sdk/actions/kontor/public/proc-contract.test.js.map +1 -0
- package/dist/src/sdk/actions/kontor/public/view-contract.js +47 -0
- package/dist/src/sdk/actions/kontor/public/view-contract.js.map +1 -0
- package/dist/src/sdk/actions/kontor/public/view-contract.test-d.js +29 -0
- package/dist/src/sdk/actions/kontor/public/view-contract.test-d.js.map +1 -0
- package/dist/src/sdk/actions/kontor/wallet/sign-reveal.js +59 -0
- package/dist/src/sdk/actions/kontor/wallet/sign-reveal.js.map +1 -0
- package/dist/src/sdk/actions/wallet/get-addresses.js +20 -0
- package/dist/src/sdk/actions/wallet/get-addresses.js.map +1 -0
- package/dist/src/sdk/actions/wallet/sign-psbt.js +28 -0
- package/dist/src/sdk/actions/wallet/sign-psbt.js.map +1 -0
- package/dist/src/sdk/clients/base/create-http-client.js +41 -0
- package/dist/src/sdk/clients/base/create-http-client.js.map +1 -0
- package/dist/src/sdk/clients/base/create-rpc-client.js +41 -0
- package/dist/src/sdk/clients/base/create-rpc-client.js.map +1 -0
- package/dist/src/sdk/clients/base/create-rpc-client.test.js +151 -0
- package/dist/src/sdk/clients/base/create-rpc-client.test.js.map +1 -0
- package/dist/src/sdk/clients/create-public-client.js +13 -0
- package/dist/src/sdk/clients/create-public-client.js.map +1 -0
- package/dist/src/sdk/clients/create-public-client.test.js +121 -0
- package/dist/src/sdk/clients/create-public-client.test.js.map +1 -0
- package/dist/src/sdk/clients/create-wallet-client.js +14 -0
- package/dist/src/sdk/clients/create-wallet-client.js.map +1 -0
- package/dist/src/sdk/clients/kontor/create-public-client.js +14 -0
- package/dist/src/sdk/clients/kontor/create-public-client.js.map +1 -0
- package/dist/src/sdk/clients/kontor/create-public-client.test.js +45 -0
- package/dist/src/sdk/clients/kontor/create-public-client.test.js.map +1 -0
- package/dist/src/sdk/clients/transports/create-rpc-transport.js +36 -0
- package/dist/src/sdk/clients/transports/create-rpc-transport.js.map +1 -0
- package/dist/src/sdk/contracts/wits.js +26 -0
- package/dist/src/sdk/contracts/wits.js.map +1 -0
- package/dist/src/sdk/types/chain.js +2 -0
- package/dist/src/sdk/types/chain.js.map +1 -0
- package/dist/src/sdk/types/contract.js +2 -0
- package/dist/src/sdk/types/contract.js.map +1 -0
- package/dist/src/sdk/types/contract.test-d.js +34 -0
- package/dist/src/sdk/types/contract.test-d.js.map +1 -0
- package/dist/src/sdk/types/http-schema.js +73 -0
- package/dist/src/sdk/types/http-schema.js.map +1 -0
- package/dist/src/sdk/types/rpc-schema.js +2 -0
- package/dist/src/sdk/types/rpc-schema.js.map +1 -0
- package/dist/src/sdk/utils/chain/defineChain.js +9 -0
- package/dist/src/sdk/utils/chain/defineChain.js.map +1 -0
- package/dist/src/sdk/utils/wit/codecs/u64.js +63 -0
- package/dist/src/sdk/utils/wit/codecs/u64.js.map +1 -0
- package/dist/src/sdk/utils/wit/decode-wit-parameter.js +289 -0
- package/dist/src/sdk/utils/wit/decode-wit-parameter.js.map +1 -0
- package/dist/src/sdk/utils/wit/encode-function-data.test-d.js +24 -0
- package/dist/src/sdk/utils/wit/encode-function-data.test-d.js.map +1 -0
- package/dist/src/sdk/utils/wit/encode-function-data.test.js +91 -0
- package/dist/src/sdk/utils/wit/encode-function-data.test.js.map +1 -0
- package/dist/src/sdk/utils/wit/encode-wit-parameters.js +261 -0
- package/dist/src/sdk/utils/wit/encode-wit-parameters.js.map +1 -0
- package/dist/src/sdk/utils/wit/get-wit-item.test.js +167 -0
- package/dist/src/sdk/utils/wit/get-wit-item.test.js.map +1 -0
- package/dist/src/wit/wit-parser/core/records.test.js +63 -0
- package/dist/src/wit/wit-parser/core/records.test.js.map +1 -0
- package/dist/src/wit/wit-parser/core/types/records.test-d.js +19 -0
- package/dist/src/wit/wit-parser/core/types/records.test-d.js.map +1 -0
- package/dist/src/wit/wit-parser/core/types/utils.js +2 -0
- package/dist/src/wit/wit-parser/core/types/utils.js.map +1 -0
- package/dist/src/wit/wit-parser/core/types/utils.test-d.js +159 -0
- package/dist/src/wit/wit-parser/core/types/utils.test-d.js.map +1 -0
- package/dist/src/wit/wit-parser/core/utils.js +213 -0
- package/dist/src/wit/wit-parser/core/utils.js.map +1 -0
- package/dist/src/wit/wit-parser/core/utils.test.js +316 -0
- package/dist/src/wit/wit-parser/core/utils.test.js.map +1 -0
- package/dist/src/wit/wit-parser/parse-wit-parameter.test.js +93 -0
- package/dist/src/wit/wit-parser/parse-wit-parameter.test.js.map +1 -0
- package/dist/src/wit/wit-parser/parse-wit.test.js +80 -0
- package/dist/src/wit/wit-parser/parse-wit.test.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/exports/index.d.ts +1 -1
- package/dist/types/exports/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/exports/index.test.ts +18 -1
- package/src/exports/index.ts +1 -1
- package/src/sdk/actions/kontor/public/call-view.ts +6 -14
- package/src/sdk/actions/kontor/public/proc-contract.test.ts +1 -1
- package/src/sdk/actions/kontor/public/view-contract.test-d.ts +2 -17
- package/src/sdk/actions/kontor/public/view-contract.ts +8 -3
- package/src/sdk/actions/kontor/wallet/sign-reveal.ts +3 -35
- package/src/sdk/clients/base/create-rpc-client.test.ts +10 -4
- package/src/sdk/clients/create-public-client.test.ts +11 -3
- package/src/sdk/clients/kontor/create-public-client.test.ts +4 -3
- package/src/sdk/contracts/wits.ts +1 -1
- package/src/sdk/types/contract.test-d.ts +29 -24
- package/src/sdk/utils/wit/codecs/u64.ts +73 -0
- package/src/sdk/utils/wit/decode-wit-parameter.ts +5 -0
- package/src/sdk/utils/wit/encode-function-data.test-d.ts +15 -11
- package/src/sdk/utils/wit/encode-function-data.test.ts +1 -1
- package/src/sdk/utils/wit/encode-wit-parameters.ts +16 -1
- package/src/sdk/utils/wit/get-wit-item.test.ts +58 -9
- package/src/wit/wit-parser/core/records.test.ts +24 -14
- package/src/wit/wit-parser/core/types/records.test-d.ts +141 -28
- package/src/wit/wit-parser/core/types/utils.test-d.ts +23 -2
- package/src/wit/wit-parser/core/types/utils.ts +8 -41
- package/src/wit/wit-parser/core/utils.test.ts +14 -0
- package/src/wit/wit-parser/core/utils.ts +1 -0
- package/src/wit/wit-parser/parse-wit-parameter.test.ts +30 -3
- package/src/wit/wit-parser/parse-wit.test.ts +93 -102
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { expect, it } from "vitest";
|
|
2
|
+
import * as Exports from "./index.js";
|
|
3
|
+
it("exports", () => {
|
|
4
|
+
expect(Object.keys(Exports)).toMatchInlineSnapshot(`
|
|
5
|
+
[
|
|
6
|
+
"parseWit",
|
|
7
|
+
"nativeToken",
|
|
8
|
+
"signet",
|
|
9
|
+
"custom",
|
|
10
|
+
"http",
|
|
11
|
+
"mnemonicToAccount",
|
|
12
|
+
"createKontorPublicClient",
|
|
13
|
+
"createKontorWalletClient",
|
|
14
|
+
"createBtcPublicClient",
|
|
15
|
+
"createBtcWalletClient",
|
|
16
|
+
"Instruction",
|
|
17
|
+
"viewContract",
|
|
18
|
+
"procContract",
|
|
19
|
+
"callView",
|
|
20
|
+
"callCompose",
|
|
21
|
+
"buildInstructionQuery",
|
|
22
|
+
"buildComposeQuery",
|
|
23
|
+
"inspect",
|
|
24
|
+
]
|
|
25
|
+
`);
|
|
26
|
+
});
|
|
27
|
+
//# sourceMappingURL=index.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.test.js","sourceRoot":"","sources":["../../../src/exports/index.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAEpC,OAAO,KAAK,OAAO,MAAM,YAAY,CAAC;AAEtC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE;IACjB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;GAqBlD,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { secp256k1 } from "@noble/curves/secp256k1.js";
|
|
2
|
+
import { hex } from "@scure/base";
|
|
3
|
+
import {
|
|
4
|
+
// type ToHexErrorType,
|
|
5
|
+
toHex, } from "../utils/encoding/to-hex.js";
|
|
6
|
+
import {
|
|
7
|
+
// type ToLocalAccountErrorType,
|
|
8
|
+
toLocalAccount, } from "./to-local-account.js";
|
|
9
|
+
import { publicKeyToP2TRPayment, } from "./utils/public-key-to-p2tr-payment.js";
|
|
10
|
+
import { signPsbt } from "./utils/sign-psbt.js";
|
|
11
|
+
//
|
|
12
|
+
// /**
|
|
13
|
+
// * @description Creates an Account from a private key.
|
|
14
|
+
// *
|
|
15
|
+
// * @returns A Private Key Account.
|
|
16
|
+
// */
|
|
17
|
+
const signet = {
|
|
18
|
+
bech32: "tb",
|
|
19
|
+
pubKeyHash: 0x6f, // 111 in decimal
|
|
20
|
+
scriptHash: 0xc4, // 196 in decimal
|
|
21
|
+
wif: 0xef, // 239 in decimal
|
|
22
|
+
};
|
|
23
|
+
export function privateKeyToAccount(privateKey, _options = {}) {
|
|
24
|
+
const publicKey = toHex(secp256k1.getPublicKey(hex.decode(privateKey.slice(2)), true));
|
|
25
|
+
// TODO: don't hardcode network
|
|
26
|
+
const address = publicKeyToP2TRPayment(publicKey.slice(2), signet);
|
|
27
|
+
const account = toLocalAccount({
|
|
28
|
+
address: address.address,
|
|
29
|
+
xOnlyPubKey: hex.encode(address.tapInternalKey),
|
|
30
|
+
signMessage: async (_) => {
|
|
31
|
+
throw new Error("signMessage not implemented for PrivateKeyAccount");
|
|
32
|
+
},
|
|
33
|
+
signPsbt: (params) => {
|
|
34
|
+
return signPsbt({ privateKey: privateKey.slice(2), ...params });
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
return {
|
|
38
|
+
...account,
|
|
39
|
+
source: "privateKey",
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=private-key-to-account.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"private-key-to-account.js","sourceRoot":"","sources":["../../../../src/sdk/accounts/private-key-to-account.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAKlC,OAAO;AACL,uBAAuB;AACvB,KAAK,GACN,MAAM,6BAA6B,CAAC;AAErC,OAAO;AACL,gCAAgC;AAChC,cAAc,GACf,MAAM,uBAAuB,CAAC;AAI/B,OAAO,EAEL,sBAAsB,GACvB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AA4BhD,EAAE;AACF,MAAM;AACN,yDAAyD;AACzD,KAAK;AACL,qCAAqC;AACrC,MAAM;AAEN,MAAM,MAAM,GAAe;IACzB,MAAM,EAAE,IAAI;IACZ,UAAU,EAAE,IAAI,EAAE,iBAAiB;IACnC,UAAU,EAAE,IAAI,EAAE,iBAAiB;IACnC,GAAG,EAAE,IAAI,EAAE,iBAAiB;CAC7B,CAAC;AACF,MAAM,UAAU,mBAAmB,CACjC,UAAe,EACf,WAAuC,EAAE;IAEzC,MAAM,SAAS,GAAG,KAAK,CACrB,SAAS,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAC9D,CAAC;IAEF,+BAA+B;IAC/B,MAAM,OAAO,GAAG,sBAAsB,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;IAEnE,MAAM,OAAO,GAAG,cAAc,CAAC;QAC7B,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC;QAC/C,WAAW,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;YACvB,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;QACvE,CAAC;QACD,QAAQ,EAAE,CAAC,MAAM,EAAE,EAAE;YACnB,OAAO,QAAQ,CAAC,EAAE,UAAU,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC;QAClE,CAAC;KACF,CAAC,CAAC;IAEH,OAAO;QACL,GAAG,OAAO;QACV,MAAM,EAAE,YAAY;KACA,CAAC;AACzB,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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,G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G,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACvC,MAAM,OAAO,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IACxD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;AAC3B,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { expectTypeOf, test } from "vitest";
|
|
2
|
+
import { parseWit } from "../../wit/wit-parser/parse-wit.js";
|
|
3
|
+
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,21 @@
|
|
|
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:", JSON.stringify(response, null, 2));
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"call-view.js","sourceRoot":"","sources":["../../../../../../src/sdk/actions/kontor/public/call-view.ts"],"names":[],"mappings":"AAmBA,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,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAErE,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"}
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,47 @@
|
|
|
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.skip("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
|
|
@@ -0,0 +1 @@
|
|
|
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,IAAI,CAAC,KAAK,EAAE,KAAK,IAAI,EAAE;IAC1B,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"}
|
|
@@ -0,0 +1,47 @@
|
|
|
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
|
+
console.log(response.result.type);
|
|
22
|
+
if (response.result.type == "Err") {
|
|
23
|
+
// TODO: add custom error
|
|
24
|
+
throw new Error(response.result.message);
|
|
25
|
+
}
|
|
26
|
+
const value = response.result.value;
|
|
27
|
+
return decodeFunctionResult({
|
|
28
|
+
wit: wit,
|
|
29
|
+
functionName,
|
|
30
|
+
data: value,
|
|
31
|
+
});
|
|
32
|
+
//
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
throw error;
|
|
36
|
+
throw new Error("problems");
|
|
37
|
+
// TODO: add custom error
|
|
38
|
+
// throw getContractError(error as BaseError, {
|
|
39
|
+
// abi: wit,
|
|
40
|
+
// address,
|
|
41
|
+
// args,
|
|
42
|
+
// docsPath: "/docs/contract/readContract",
|
|
43
|
+
// functionName,
|
|
44
|
+
// });
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=view-contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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,k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-0,0 +1,29 @@
|
|
|
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
|
+
import { nativeToken } from "../../../contracts/wits.js";
|
|
7
|
+
const wit = parseWit(nativeToken.raw);
|
|
8
|
+
test("e2e", async () => {
|
|
9
|
+
const client = createPublicClient({
|
|
10
|
+
transport: http("https://signet-staging.kontor.network:35000/api"),
|
|
11
|
+
});
|
|
12
|
+
// view contract action defined on client
|
|
13
|
+
// response is correctly typed
|
|
14
|
+
const res = await client.viewContract({
|
|
15
|
+
wit: wit,
|
|
16
|
+
functionName: "balances", // functin name is only valid if it's got a view-context
|
|
17
|
+
contractAddress: "token_0_0",
|
|
18
|
+
});
|
|
19
|
+
console.log("res:", res);
|
|
20
|
+
// inject client directly into view contract action
|
|
21
|
+
const res2 = await viewContract(client, {
|
|
22
|
+
wit: wit,
|
|
23
|
+
functionName: "balance",
|
|
24
|
+
contractAddress: "token_0_0",
|
|
25
|
+
args: ["252a90b16b5c25b9f366ab4b518f9f2ce3624d23c05dc26f7649f51515c76e2d"],
|
|
26
|
+
});
|
|
27
|
+
console.log("res2:", res2);
|
|
28
|
+
});
|
|
29
|
+
//# sourceMappingURL=view-contract.test-d.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEzD,MAAM,GAAG,GAAG,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;AAEtC,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"}
|
|
@@ -0,0 +1,59 @@
|
|
|
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
|
+
for (let i = 0; i < params.parcipantScripts.length; i++) {
|
|
15
|
+
const { commit_tap_leaf_script } = params.parcipantScripts[i];
|
|
16
|
+
const scriptBytes = hex.decode(commit_tap_leaf_script.script);
|
|
17
|
+
const controlBlockBytes = hex.decode(commit_tap_leaf_script.controlBlock);
|
|
18
|
+
const leafVersion = commit_tap_leaf_script.leafVersion;
|
|
19
|
+
// scure expects script || leafVersion as one buffer
|
|
20
|
+
const scriptWithVersion = u.concatBytes(scriptBytes, new Uint8Array([leafVersion]));
|
|
21
|
+
const controlBlockStruct = TaprootControlBlock.decode(controlBlockBytes);
|
|
22
|
+
tx.updateInput(i, {
|
|
23
|
+
tapLeafScript: [[controlBlockStruct, scriptWithVersion]],
|
|
24
|
+
}, true);
|
|
25
|
+
}
|
|
26
|
+
const signInputs = Array.from({
|
|
27
|
+
length: tx.inputsLength,
|
|
28
|
+
}, (_, i) => i);
|
|
29
|
+
const preparedPsbt = hex.encode(tx.toPSBT());
|
|
30
|
+
const signed = account.signPsbt
|
|
31
|
+
? await account.signPsbt({
|
|
32
|
+
psbt: preparedPsbt,
|
|
33
|
+
signInputs,
|
|
34
|
+
broadcast: false,
|
|
35
|
+
})
|
|
36
|
+
: await getAction(client, signPsbt, "signPsbt")({
|
|
37
|
+
account: account,
|
|
38
|
+
chain: chain,
|
|
39
|
+
psbt: preparedPsbt,
|
|
40
|
+
signInputs: signInputs,
|
|
41
|
+
broadcast: false,
|
|
42
|
+
});
|
|
43
|
+
const signedTx = Transaction.fromPSBT(hex.decode(signed.psbt));
|
|
44
|
+
for (let i = 0; i < params.parcipantScripts.length; i++) {
|
|
45
|
+
const input = signedTx.getInput(i);
|
|
46
|
+
const p = params.parcipantScripts[i];
|
|
47
|
+
const scriptHex = p.commit_tap_leaf_script.script;
|
|
48
|
+
const cbHex = p.commit_tap_leaf_script.controlBlock;
|
|
49
|
+
signedTx.updateInput(i, {
|
|
50
|
+
finalScriptWitness: [
|
|
51
|
+
input.tapScriptSig[0][1],
|
|
52
|
+
hex.decode(scriptHex),
|
|
53
|
+
hex.decode(cbHex),
|
|
54
|
+
],
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
return signedTx;
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=sign-reveal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EACL,mBAAmB,EACnB,WAAW,EACX,KAAK,IAAI,CAAC,GACX,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAelC,MAAM,CAAC,KAAK,UAAU,UAAU,CAK9B,MAAwD,EACxD,UAAgD;IAEhD,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,MAAM,EAAE,GAAG,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IAEzD,KAAK,IAA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YACA,OAAO,EAAE,OAAO;YAChB,KAAK,EAAE,KAAK;YACZ,IAAI,EAAE,YAAY;YAClB,UAAU,EAAE,UAAU;YACtB,SAAS,EAAE,KAAK;SACjB,CAAC,CAAC;IAEP,MAAM,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,IAAc,CAAC,CAAC,CAAC;IAEzE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,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,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,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { uid } from "../../utils/uid.js";
|
|
2
|
+
import { parseAccount, } from "../../accounts/utils/parse-account.js";
|
|
3
|
+
export function createHttpClient(parameters) {
|
|
4
|
+
const { chain, key = "base", name = "Base Client", type = "base", } = parameters;
|
|
5
|
+
const blockTime = chain?.blockTime ?? 10 * 60 * 1000;
|
|
6
|
+
const defaultPollingInterval = Math.min(Math.max(Math.floor(blockTime / 2), 500), 4_000);
|
|
7
|
+
const pollingInterval = parameters.pollingInterval ?? defaultPollingInterval;
|
|
8
|
+
const cacheTime = parameters.cacheTime ?? pollingInterval;
|
|
9
|
+
const account = parameters.account
|
|
10
|
+
? parseAccount(parameters.account)
|
|
11
|
+
: undefined;
|
|
12
|
+
const { config, request, value } = parameters.transport({
|
|
13
|
+
// account,
|
|
14
|
+
chain,
|
|
15
|
+
pollingInterval,
|
|
16
|
+
});
|
|
17
|
+
const transport = { ...config, ...value };
|
|
18
|
+
const client = {
|
|
19
|
+
account,
|
|
20
|
+
cacheTime,
|
|
21
|
+
chain,
|
|
22
|
+
key,
|
|
23
|
+
name,
|
|
24
|
+
pollingInterval,
|
|
25
|
+
request,
|
|
26
|
+
transport,
|
|
27
|
+
type,
|
|
28
|
+
uid: uid(),
|
|
29
|
+
};
|
|
30
|
+
function extend(base) {
|
|
31
|
+
return (extendFn) => {
|
|
32
|
+
const extended = extendFn(base);
|
|
33
|
+
for (const key in client)
|
|
34
|
+
delete extended[key];
|
|
35
|
+
const combined = { ...base, ...extended };
|
|
36
|
+
return Object.assign(combined, { extend: extend(combined) });
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
return Object.assign(client, { extend: extend(client) });
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=create-http-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-http-client.js","sourceRoot":"","sources":["../../../../../src/sdk/clients/base/create-http-client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAEzC,OAAO,EACL,YAAY,GAEb,MAAM,uCAAuC,CAAC;AA6H/C,MAAM,UAAU,gBAAgB,CAAC,UAA4B;IAC3D,MAAM,EACJ,KAAK,EACL,GAAG,GAAG,MAAM,EACZ,IAAI,GAAG,aAAa,EACpB,IAAI,GAAG,MAAM,GACd,GAAG,UAAU,CAAC;IAEf,MAAM,SAAS,GAAG,KAAK,EAAE,SAAS,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAErD,MAAM,sBAAsB,GAAG,IAAI,CAAC,GAAG,CACrC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,EACxC,KAAK,CACN,CAAC;IACF,MAAM,eAAe,GAAG,UAAU,CAAC,eAAe,IAAI,sBAAsB,CAAC;IAC7E,MAAM,SAAS,GAAG,UAAU,CAAC,SAAS,IAAI,eAAe,CAAC;IAE1D,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO;QAChC,CAAC,CAAC,YAAY,CAAC,UAAU,CAAC,OAAO,CAAC;QAClC,CAAC,CAAC,SAAS,CAAC;IACd,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,UAAU,CAAC,SAAS,CAAC;QACtD,WAAW;QACX,KAAK;QACL,eAAe;KAChB,CAAC,CAAC;IACH,MAAM,SAAS,GAAG,EAAE,GAAG,MAAM,EAAE,GAAG,KAAK,EAAE,CAAC;IAE1C,MAAM,MAAM,GAAG;QACb,OAAO;QACP,SAAS;QACT,KAAK;QACL,GAAG;QACH,IAAI;QACJ,eAAe;QACf,OAAO;QACP,SAAS;QACT,IAAI;QACJ,GAAG,EAAE,GAAG,EAAE;KACX,CAAC;IAEF,SAAS,MAAM,CAAC,IAAmB;QAEjC,OAAO,CAAC,QAAkB,EAAE,EAAE;YAC5B,MAAM,QAAQ,GAAG,QAAQ,CAAC,IAAI,CAAa,CAAC;YAC5C,KAAK,MAAM,GAAG,IAAI,MAAM;gBAAE,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC;YAC/C,MAAM,QAAQ,GAAG,EAAE,GAAG,IAAI,EAAE,GAAG,QAAQ,EAAE,CAAC;YAC1C,OAAO,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,QAAe,CAAC,EAAE,CAAC,CAAC;QACtE,CAAC,CAAC;IACJ,CAAC;IAED,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAQ,EAAE,CAAC,CAAC;AAClE,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { parseAccount, } from "../../accounts/utils/parse-account.js";
|
|
2
|
+
import { uid } from "../../utils/uid.js";
|
|
3
|
+
export function createRpcClient(parameters) {
|
|
4
|
+
const { chain, key = "base", name = "Base Client", type = "base", } = parameters;
|
|
5
|
+
const blockTime = chain?.blockTime ?? 10 * 60 * 1000;
|
|
6
|
+
const defaultPollingInterval = Math.min(Math.max(Math.floor(blockTime / 2), 500), 4_000);
|
|
7
|
+
const pollingInterval = parameters.pollingInterval ?? defaultPollingInterval;
|
|
8
|
+
const cacheTime = parameters.cacheTime ?? pollingInterval;
|
|
9
|
+
const account = parameters.account
|
|
10
|
+
? parseAccount(parameters.account)
|
|
11
|
+
: undefined;
|
|
12
|
+
const { config, request, value } = parameters.transport({
|
|
13
|
+
// account,
|
|
14
|
+
chain,
|
|
15
|
+
pollingInterval,
|
|
16
|
+
});
|
|
17
|
+
const transport = { ...config, ...value };
|
|
18
|
+
const client = {
|
|
19
|
+
account,
|
|
20
|
+
cacheTime,
|
|
21
|
+
chain,
|
|
22
|
+
key,
|
|
23
|
+
name,
|
|
24
|
+
pollingInterval,
|
|
25
|
+
request,
|
|
26
|
+
transport,
|
|
27
|
+
type,
|
|
28
|
+
uid: uid(),
|
|
29
|
+
};
|
|
30
|
+
function extend(base) {
|
|
31
|
+
return (extendFn) => {
|
|
32
|
+
const extended = extendFn(base);
|
|
33
|
+
for (const key in client)
|
|
34
|
+
delete extended[key];
|
|
35
|
+
const combined = { ...base, ...extended };
|
|
36
|
+
return Object.assign(combined, { extend: extend(combined) });
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
return Object.assign(client, { extend: extend(client) });
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=create-rpc-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-rpc-client.js","sourceRoot":"","sources":["../../../../../src/sdk/clients/base/create-rpc-client.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,YAAY,GAEb,MAAM,uCAAuC,CAAC;AAK/C,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAqIzC,MAAM,UAAU,eAAe,CAAC,UAA2B;IACzD,MAAM,EACJ,KAAK,EACL,GAAG,GAAG,MAAM,EACZ,IAAI,GAAG,aAAa,EACpB,IAAI,GAAG,MAAM,GACd,GAAG,UAAU,CAAC;IAEf,MAAM,SAAS,GAAG,KAAK,EAAE,SAAS,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAErD,MAAM,sBAAsB,GAAG,IAAI,CAAC,GAAG,CACrC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,EACxC,KAAK,CACN,CAAC;IACF,MAAM,eAAe,GAAG,UAAU,CAAC,eAAe,IAAI,sBAAsB,CAAC;IAC7E,MAAM,SAAS,GAAG,UAAU,CAAC,SAAS,IAAI,eAAe,CAAC;IAE1D,MAAM,OAAO,GAA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