@kontor/kontor-sdk 1.0.0-alpha.26 → 1.0.0-alpha.28
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/sdk/actions/kontor/public/build-compose-query.js +9 -12
- package/dist/cjs/sdk/actions/kontor/public/build-compose-query.js.map +1 -1
- package/dist/cjs/sdk/actions/kontor/public/build-instruction-query.js +13 -33
- package/dist/cjs/sdk/actions/kontor/public/build-instruction-query.js.map +1 -1
- package/dist/cjs/sdk/actions/kontor/public/call-compose.js +9 -9
- package/dist/cjs/sdk/actions/kontor/public/call-compose.js.map +1 -1
- package/dist/cjs/sdk/actions/kontor/public/call-view.js.map +1 -1
- package/dist/cjs/sdk/actions/kontor/public/inspect.js +1 -2
- package/dist/cjs/sdk/actions/kontor/public/inspect.js.map +1 -1
- package/dist/cjs/sdk/actions/kontor/public/proc-contract.js +9 -12
- package/dist/cjs/sdk/actions/kontor/public/proc-contract.js.map +1 -1
- package/dist/cjs/sdk/actions/kontor/public/view-contract.js +2 -1
- package/dist/cjs/sdk/actions/kontor/public/view-contract.js.map +1 -1
- package/dist/cjs/sdk/actions/kontor/wallet/sign-commit.js.map +1 -1
- package/dist/cjs/sdk/chains/definitions/signet.js +0 -1
- package/dist/cjs/sdk/chains/definitions/signet.js.map +1 -1
- package/dist/cjs/sdk/clients/decorators/kontor/public.js.map +1 -1
- package/dist/cjs/sdk/errors/chain.js +44 -0
- package/dist/cjs/sdk/errors/chain.js.map +1 -0
- package/dist/cjs/sdk/utils/chain/assert-current-chain.js +11 -0
- package/dist/cjs/sdk/utils/chain/assert-current-chain.js.map +1 -0
- package/dist/cjs/sdk/utils/kontor/build-compose-query.js +19 -0
- package/dist/cjs/sdk/utils/kontor/build-compose-query.js.map +1 -0
- package/dist/cjs/sdk/utils/kontor/build-instruction-query.js +36 -0
- package/dist/cjs/sdk/utils/kontor/build-instruction-query.js.map +1 -0
- package/dist/cjs/tsconfig.build.tsbuildinfo +1 -1
- package/dist/cjs/wit/wit-parser/core/utils.js.map +1 -1
- package/dist/cjs/wit/wit-parser/parse-wit.js.map +1 -1
- package/dist/esm/sdk/actions/kontor/public/build-compose-query.js +9 -13
- package/dist/esm/sdk/actions/kontor/public/build-compose-query.js.map +1 -1
- package/dist/esm/sdk/actions/kontor/public/build-instruction-query.js +13 -36
- package/dist/esm/sdk/actions/kontor/public/build-instruction-query.js.map +1 -1
- package/dist/esm/sdk/actions/kontor/public/call-compose.js +10 -10
- package/dist/esm/sdk/actions/kontor/public/call-compose.js.map +1 -1
- package/dist/esm/sdk/actions/kontor/public/call-view.js +1 -0
- package/dist/esm/sdk/actions/kontor/public/call-view.js.map +1 -1
- package/dist/esm/sdk/actions/kontor/public/inspect.js +9 -4
- package/dist/esm/sdk/actions/kontor/public/inspect.js.map +1 -1
- package/dist/esm/sdk/actions/kontor/public/proc-contract.js +10 -15
- package/dist/esm/sdk/actions/kontor/public/proc-contract.js.map +1 -1
- package/dist/esm/sdk/actions/kontor/public/view-contract.js +3 -5
- package/dist/esm/sdk/actions/kontor/public/view-contract.js.map +1 -1
- package/dist/esm/sdk/actions/kontor/wallet/sign-commit.js +1 -0
- package/dist/esm/sdk/actions/kontor/wallet/sign-commit.js.map +1 -1
- package/dist/esm/sdk/chains/definitions/signet.js +0 -1
- package/dist/esm/sdk/chains/definitions/signet.js.map +1 -1
- package/dist/esm/sdk/clients/decorators/kontor/public.js.map +1 -1
- package/dist/esm/sdk/errors/chain.js +37 -0
- package/dist/esm/sdk/errors/chain.js.map +1 -0
- package/dist/esm/sdk/utils/chain/assert-current-chain.js +8 -0
- package/dist/esm/sdk/utils/chain/assert-current-chain.js.map +1 -0
- package/dist/esm/sdk/utils/kontor/build-compose-query.js +16 -0
- package/dist/esm/sdk/utils/kontor/build-compose-query.js.map +1 -0
- package/dist/esm/sdk/utils/kontor/build-instruction-query.js +36 -0
- package/dist/esm/sdk/utils/kontor/build-instruction-query.js.map +1 -0
- package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
- package/dist/esm/wit/wit-parser/core/utils.js +0 -5
- package/dist/esm/wit/wit-parser/core/utils.js.map +1 -1
- package/dist/esm/wit/wit-parser/parse-wit.js.map +1 -1
- package/dist/types/sdk/actions/kontor/public/build-compose-query.d.ts +5 -3
- package/dist/types/sdk/actions/kontor/public/build-compose-query.d.ts.map +1 -1
- package/dist/types/sdk/actions/kontor/public/build-instruction-query.d.ts +6 -6
- package/dist/types/sdk/actions/kontor/public/build-instruction-query.d.ts.map +1 -1
- package/dist/types/sdk/actions/kontor/public/call-compose.d.ts +6 -5
- package/dist/types/sdk/actions/kontor/public/call-compose.d.ts.map +1 -1
- package/dist/types/sdk/actions/kontor/public/call-view.d.ts +3 -3
- package/dist/types/sdk/actions/kontor/public/call-view.d.ts.map +1 -1
- package/dist/types/sdk/actions/kontor/public/inspect.d.ts +3 -3
- package/dist/types/sdk/actions/kontor/public/inspect.d.ts.map +1 -1
- package/dist/types/sdk/actions/kontor/public/proc-contract.d.ts +6 -6
- package/dist/types/sdk/actions/kontor/public/proc-contract.d.ts.map +1 -1
- package/dist/types/sdk/actions/kontor/public/view-contract.d.ts +3 -3
- package/dist/types/sdk/actions/kontor/public/view-contract.d.ts.map +1 -1
- package/dist/types/sdk/actions/kontor/wallet/sign-commit.d.ts +4 -2
- package/dist/types/sdk/actions/kontor/wallet/sign-commit.d.ts.map +1 -1
- package/dist/types/sdk/actions/kontor/wallet/sign-reveal.d.ts +1 -1
- package/dist/types/sdk/actions/kontor/wallet/sign-reveal.d.ts.map +1 -1
- package/dist/types/sdk/chains/definitions/signet.d.ts +0 -1
- package/dist/types/sdk/chains/definitions/signet.d.ts.map +1 -1
- package/dist/types/sdk/clients/decorators/kontor/public.d.ts +8 -8
- package/dist/types/sdk/clients/decorators/kontor/public.d.ts.map +1 -1
- package/dist/types/sdk/clients/decorators/kontor/wallet.d.ts +1 -1
- package/dist/types/sdk/clients/decorators/kontor/wallet.d.ts.map +1 -1
- package/dist/types/sdk/clients/kontor/create-public-client.d.ts +1 -1
- package/dist/types/sdk/clients/kontor/create-public-client.d.ts.map +1 -1
- package/dist/types/sdk/clients/kontor/create-wallet-client.d.ts +1 -1
- package/dist/types/sdk/clients/kontor/create-wallet-client.d.ts.map +1 -1
- package/dist/types/sdk/errors/chain.d.ts +32 -0
- package/dist/types/sdk/errors/chain.d.ts.map +1 -0
- package/dist/types/sdk/types/chain.d.ts +1 -2
- package/dist/types/sdk/types/chain.d.ts.map +1 -1
- package/dist/types/sdk/utils/chain/assert-current-chain.d.ts +10 -0
- package/dist/types/sdk/utils/chain/assert-current-chain.d.ts.map +1 -0
- package/dist/types/sdk/utils/kontor/build-compose-query.d.ts +13 -0
- package/dist/types/sdk/utils/kontor/build-compose-query.d.ts.map +1 -0
- package/dist/types/sdk/utils/kontor/build-instruction-query.d.ts +22 -0
- package/dist/types/sdk/utils/kontor/build-instruction-query.d.ts.map +1 -0
- package/dist/types/wit/type-utils.d.ts.map +1 -1
- package/dist/types/wit/utils.d.ts.map +1 -1
- package/dist/types/wit/wit-parser/core/utils.d.ts.map +1 -1
- package/dist/types/wit/wit-parser/parse-wit.d.ts +0 -15
- package/dist/types/wit/wit-parser/parse-wit.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/sdk/actions/kontor/public/build-compose-query.ts +23 -22
- package/src/sdk/actions/kontor/public/build-instruction-query.ts +27 -53
- package/src/sdk/actions/kontor/public/call-compose.ts +32 -21
- package/src/sdk/actions/kontor/public/call-view.ts +5 -4
- package/src/sdk/actions/kontor/public/inspect.ts +20 -9
- package/src/sdk/actions/kontor/public/proc-contract.test.ts +2 -0
- package/src/sdk/actions/kontor/public/proc-contract.ts +34 -23
- package/src/sdk/actions/kontor/public/{view-contract.test-d.ts → view-contract.test.ts} +2 -2
- package/src/sdk/actions/kontor/public/view-contract.ts +10 -9
- package/src/sdk/actions/kontor/wallet/sign-commit.ts +18 -7
- package/src/sdk/actions/kontor/wallet/sign-reveal.ts +1 -1
- package/src/sdk/chains/definitions/signet.ts +0 -1
- package/src/sdk/clients/base/create-rpc-client.test.ts +0 -1
- package/src/sdk/clients/create-public-client.test.ts +0 -1
- package/src/sdk/clients/decorators/kontor/public.ts +25 -16
- package/src/sdk/clients/decorators/kontor/wallet.ts +2 -2
- package/src/sdk/clients/kontor/create-public-client.test.ts +0 -7
- package/src/sdk/clients/kontor/create-public-client.ts +3 -3
- package/src/sdk/clients/kontor/create-wallet-client.ts +3 -3
- package/src/sdk/errors/chain.ts +64 -0
- package/src/sdk/test/e2e.test.ts +28 -11
- package/src/sdk/types/chain.ts +5 -2
- package/src/sdk/utils/chain/assert-current-chain.ts +28 -0
- package/src/sdk/utils/kontor/build-compose-query.ts +33 -0
- package/src/sdk/utils/kontor/build-instruction-query.ts +75 -0
- package/src/wit/type-utils.ts +0 -2
- package/src/wit/utils.ts +3 -6
- package/src/wit/wit-parser/core/utils.ts +1 -5
- package/src/wit/wit-parser/parse-wit.ts +0 -15
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Inst, InstructionQuery } from "../../types/kontor.js";
|
|
2
|
+
import type { Address, UtxoId, XOnlyPubKey } from "../../types/misc.js";
|
|
3
|
+
export type BuildInstructionQueryReturnType = InstructionQuery;
|
|
4
|
+
export type BuildInstructionQueryParameters = {
|
|
5
|
+
address: Address;
|
|
6
|
+
xOnlyPubKey: XOnlyPubKey;
|
|
7
|
+
utxos: UtxoId[];
|
|
8
|
+
/**
|
|
9
|
+
* The concrete instruction to send (Publish | Call | Issuance).
|
|
10
|
+
* Example:
|
|
11
|
+
* { Call: { gas_limit: 100000, contract: "addr", expr: "balance(...)" } }
|
|
12
|
+
* { Publish: { gas_limit: 100000, name: "token", bytes: [0,1,2,...] } }
|
|
13
|
+
* "Issuance"
|
|
14
|
+
*/
|
|
15
|
+
instruction: Inst;
|
|
16
|
+
/**
|
|
17
|
+
* Optional chained instruction if you want to send two instructions atomically.
|
|
18
|
+
*/
|
|
19
|
+
chainedInstruction?: Inst | null;
|
|
20
|
+
};
|
|
21
|
+
export declare function buildInstructionQuery(params: BuildInstructionQueryParameters): BuildInstructionQueryReturnType;
|
|
22
|
+
//# sourceMappingURL=build-instruction-query.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-instruction-query.d.ts","sourceRoot":"","sources":["../../../../../src/sdk/utils/kontor/build-instruction-query.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAExE,MAAM,MAAM,+BAA+B,GAAG,gBAAgB,CAAC;AAE/D,MAAM,MAAM,+BAA+B,GAAG;IAC5C,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,WAAW,CAAC;IACzB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB;;;;;;OAMG;IACH,WAAW,EAAE,IAAI,CAAC;IAClB;;OAEG;IACH,kBAAkB,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;CAClC,CAAC;AA2BF,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,+BAA+B,GACtC,+BAA+B,CAwBjC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type-utils.d.ts","sourceRoot":"","sources":["../../../src/wit/type-utils.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,CAChB,KAAK,SAAS,SAAS,OAAO,EAAE,EAChC,IAAI,EAEJ,GAAG,SAAS,SAAS,OAAO,EAAE,GAAG,EAAE,IACjC,KAAK,SAAS,SAAS;IACzB,MAAM,IAAI;IACV,GAAG,MAAM,IAAI,SAAS,SAAS,OAAO,EAAE;CACzC,GACG,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GACnB,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,GACvB,MAAM,CAAC,IAAI,EAAE,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CAAC,iCAAiC,kBAAkB,CAAC,MAAM,CAAC,4BAA4B,CAAC,GAC/F,mCAAmC,CACjC,SAAS,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC,EACrC,SAAS,EACT,aAAa,GAAG;aAAG,CAAC,IAAI,kBAAkB,CAAC,MAAM,CAAC,GAAG,IAAI;SAAE,CAC5D,CAAC;KACP,GACD,kBAAkB,CAAC,MAAM,CAAC,SAAS,GAAG,MAAM,IAAI,SAC5C,MAAM,SAAS,GAAG,MAAM,IAAI,MAAM,IAAI,GAAG,GAC3C;QACE,IAAI,EAAE,kBAAkB,CAAC,MAAM,CAAC,CAAC;QACjC,IAAI,EAAE,SAAS,IAAI,GAAG,CAAC;QACvB,UAAU,EAAE,IAAI,SAAS,MAAM,aAAa,GACxC,MAAM,CAAC,iCAAiC,kBAAkB,CAAC,MAAM,CAAC,4BAA4B,CAAC,GAC/F,mCAAmC,CACjC,SAAS,CAAC,IAAI,CAAC,EACf,SAAS,EACT,aAAa,GAAG;aAAG,CAAC,IAAI,IAAI,GAAG,IAAI;SAAE,CACtC,CAAC;KACP,GACD,kBAAkB,GACtB,KAAK;CACV,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/wit/wit-parser/core/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAY9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,IAAI,CAAC,EAAE,WAAW,GAAG,QAAQ,CAAC;CAC/B,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/wit/wit-parser/core/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAY9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,IAAI,CAAC,EAAE,WAAW,GAAG,QAAQ,CAAC;CAC/B,CAAC;AAEF,eAAO,MAAM,iBAAiB,QACkI,CAAC;AAEjK,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE/C;AAED,wBAAgB,WAAW,CAAC,CAAC,SAAS;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EACpE,IAAI,EAAE,MAAM,YAKb;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY;;;;;EA4HtE;AACD,eAAO,MAAM,eAAe,QAC8J,CAAC;AAE3L,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAElD;AAID,wBAAgB,eAAe,CAC7B,MAAM,EAAE,MAAM,EACd,MAAM,GAAE,MAAM,EAAO,GACpB,SAAS,MAAM,EAAE,CAuCnB;AAED,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,GAAE,YAAiB;;;;;;;;;;;;;;;;EAK3E;AAED,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE,YAAiB;;;;;;;;;;;;;;;;EA2C3B"}
|
|
@@ -4,21 +4,6 @@ import type { Error_ } from "../error.js";
|
|
|
4
4
|
import type { Signatures } from "./core/types/signatures.js";
|
|
5
5
|
import type { ParseRecords } from "./core/types/records.js";
|
|
6
6
|
import type { ParseSignature } from "./core/types/utils.js";
|
|
7
|
-
/**
|
|
8
|
-
* Parses human-readable ABI into JSON {@link Abi}
|
|
9
|
-
*
|
|
10
|
-
* @param signatures - Human-readable ABI
|
|
11
|
-
* @returns Parsed {@link Abi}
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* type Result = ParseAbi<
|
|
15
|
-
* // ^? type Result = readonly [{ name: "balanceOf"; type: "function"; stateMutability:...
|
|
16
|
-
* [
|
|
17
|
-
* 'function balanceOf(address owner) view returns (uint256)',
|
|
18
|
-
* 'event Transfer(address indexed from, address indexed to, uint256 amount)',
|
|
19
|
-
* ]
|
|
20
|
-
* >
|
|
21
|
-
*/
|
|
22
7
|
export type ParseWit<signatures extends readonly string[]> = string[] extends signatures ? Wit : signatures extends readonly string[] ? signatures extends Signatures<signatures> ? ParseRecords<signatures> extends infer structs ? {
|
|
23
8
|
[key in keyof signatures]: signatures[key] extends string ? ParseSignature<signatures[key], structs> : never;
|
|
24
9
|
} extends infer mapped extends readonly unknown[] ? Filter<mapped, never> extends infer result ? result extends readonly [] ? never : result : never : never : never : never : never;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-wit.d.ts","sourceRoot":"","sources":["../../../../src/wit/wit-parser/parse-wit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAErC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAK1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D
|
|
1
|
+
{"version":3,"file":"parse-wit.d.ts","sourceRoot":"","sources":["../../../../src/wit/wit-parser/parse-wit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAErC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAK1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,MAAM,QAAQ,CAAC,UAAU,SAAS,SAAS,MAAM,EAAE,IACvD,MAAM,EAAE,SAAS,UAAU,GACvB,GAAG,GACH,UAAU,SAAS,SAAS,MAAM,EAAE,GAClC,UAAU,SAAS,UAAU,CAAC,UAAU,CAAC,GACvC,YAAY,CAAC,UAAU,CAAC,SAAS,MAAM,OAAO,GAC5C;KACG,GAAG,IAAI,MAAM,UAAU,GAAG,UAAU,CAAC,GAAG,CAAC,SAAS,MAAM,GACrD,cAAc,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,GACxC,KAAK;CACV,SAAS,MAAM,MAAM,SAAS,SAAS,OAAO,EAAE,GAC/C,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,SAAS,MAAM,MAAM,GACxC,MAAM,SAAS,SAAS,EAAE,GACxB,KAAK,GACL,MAAM,GACR,KAAK,GACP,KAAK,GACP,KAAK,GACP,KAAK,GACP,KAAK,CAAC;AAEd,wBAAgB,QAAQ,CAAC,KAAK,CAAC,UAAU,SAAS,SAAS,MAAM,EAAE,EACjE,UAAU,EAAE,UAAU,CAAC,QAAQ,CAAC,SAAS,CAAC,GACtC,MAAM,CAAC,iCAAiC,CAAC,GACzC,UAAU,CAAC,UAAU,CAAC,SAAS,UAAU,GACvC,UAAU,GACV,UAAU,CAAC,UAAU,CAAC,GAC3B,QAAQ,CAAC,UAAU,CAAC,CAUtB"}
|
package/package.json
CHANGED
|
@@ -7,42 +7,42 @@ import { buildInstructionQuery } from "./build-instruction-query.js";
|
|
|
7
7
|
import { getKontorAction } from "../../../utils/get-action.js";
|
|
8
8
|
import type { ComposeQuery } from "@kontor/kontor-ts";
|
|
9
9
|
import type { Inst } from "../../../../sdk/types/kontor.js";
|
|
10
|
+
import type { GetAccountParameter } from "../../../../sdk/types/account.js";
|
|
10
11
|
|
|
12
|
+
import type { Account } from "../../../accounts/types.js";
|
|
13
|
+
import { parseAccount } from "../../../accounts/utils/parse-account.js";
|
|
11
14
|
export type BuildComposeQueryParameters<
|
|
12
|
-
|
|
15
|
+
account extends Account | undefined = Account | undefined,
|
|
16
|
+
accountOverride extends Account | [Address, XOnlyPubKey] | undefined =
|
|
17
|
+
| Account
|
|
18
|
+
| [Address, XOnlyPubKey]
|
|
19
|
+
| undefined,
|
|
13
20
|
> = {
|
|
14
21
|
instruction: Inst;
|
|
15
22
|
address?: Address;
|
|
16
23
|
xOnlyPubKey?: XOnlyPubKey; // TODO: maybe this should be wrapped in a single object
|
|
17
24
|
utxos: UtxoId[];
|
|
18
25
|
satsPerVByte: number;
|
|
19
|
-
}
|
|
20
|
-
|
|
26
|
+
} & GetAccountParameter<account, accountOverride, true, true>;
|
|
21
27
|
export type BuildComposeQueryReturnType = ComposeQuery;
|
|
22
28
|
|
|
23
|
-
export
|
|
24
|
-
chain extends Chain | undefined
|
|
29
|
+
export function buildComposeQuery<
|
|
30
|
+
chain extends Chain | undefined,
|
|
31
|
+
account extends Account | undefined,
|
|
25
32
|
>(
|
|
26
33
|
client: KontorPublicClient<HttpTransport, chain>,
|
|
27
|
-
params: BuildComposeQueryParameters<
|
|
28
|
-
):
|
|
29
|
-
const account = client.account;
|
|
30
|
-
|
|
34
|
+
params: BuildComposeQueryParameters<account>,
|
|
35
|
+
): BuildComposeQueryReturnType {
|
|
31
36
|
const {
|
|
32
37
|
instruction: inst,
|
|
33
38
|
utxos,
|
|
34
|
-
|
|
35
|
-
|
|
39
|
+
satsPerVByte,
|
|
40
|
+
account: account_ = client.account,
|
|
36
41
|
} = params;
|
|
37
42
|
|
|
38
|
-
if (!
|
|
39
|
-
// TODO: add custom error
|
|
40
|
-
throw new Error("x_only_public_key is required");
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
if (!address) {
|
|
43
|
+
if (!account_) {
|
|
44
44
|
// TODO: add custom error
|
|
45
|
-
throw new Error("
|
|
45
|
+
throw new Error("Account is required");
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
if (utxos.length === 0) {
|
|
@@ -50,20 +50,21 @@ export async function buildComposeQuery<
|
|
|
50
50
|
throw new Error("at least one funding UTXO is required");
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
const
|
|
53
|
+
const account = parseAccount(account_);
|
|
54
|
+
|
|
55
|
+
const instruction = getKontorAction(
|
|
54
56
|
client,
|
|
55
57
|
buildInstructionQuery,
|
|
56
58
|
"buildInstructionQuery",
|
|
57
59
|
)({
|
|
58
60
|
instruction: inst,
|
|
59
61
|
utxos,
|
|
60
|
-
|
|
61
|
-
address,
|
|
62
|
+
account,
|
|
62
63
|
});
|
|
63
64
|
|
|
64
65
|
return {
|
|
65
66
|
instructions: [instruction],
|
|
66
|
-
sat_per_vbyte:
|
|
67
|
+
sat_per_vbyte: satsPerVByte,
|
|
67
68
|
envelope: null,
|
|
68
69
|
};
|
|
69
70
|
}
|
|
@@ -2,17 +2,24 @@ import type { Inst, InstructionQuery } from "../../../types/kontor.js";
|
|
|
2
2
|
import type { KontorPublicClient } from "../../../clients/kontor/create-public-client.js";
|
|
3
3
|
import type { HttpTransport } from "../../../clients/transports/create-http-transport.js";
|
|
4
4
|
import type { Chain } from "../../../types/chain.js";
|
|
5
|
-
import type { Address,
|
|
5
|
+
import type { Address, XOnlyPubKey, UtxoId } from "../../../types/misc.js";
|
|
6
|
+
import type { Account } from "../../../../sdk/accounts/types.js";
|
|
7
|
+
import { buildInstructionQuery as buildInstructionQuery_ } from "../../../utils/kontor/build-instruction-query.js";
|
|
8
|
+
|
|
9
|
+
import { parseAccount } from "../../../../sdk/accounts/utils/parse-account.js";
|
|
10
|
+
import type { GetAccountParameter } from "../../../../sdk/types/account.js";
|
|
6
11
|
|
|
7
12
|
// If InstructionQuery already uses this Inst shape internally, you don't need to touch it.
|
|
8
13
|
// Otherwise you can make InstructionQuery generic over Inst and plug this in.
|
|
9
14
|
export type BuildInstructionQueryReturnType = InstructionQuery;
|
|
10
15
|
|
|
11
16
|
export type BuildInstructionQueryParameters<
|
|
12
|
-
|
|
17
|
+
account extends Account | undefined = Account | undefined,
|
|
18
|
+
accountOverride extends Account | [Address, XOnlyPubKey] | undefined =
|
|
19
|
+
| Account
|
|
20
|
+
| [Address, XOnlyPubKey]
|
|
21
|
+
| undefined,
|
|
13
22
|
> = {
|
|
14
|
-
address?: Address;
|
|
15
|
-
xOnlyPubKey?: XOnlyPubKey; // TODO: maybe this should be wrapped in a single object
|
|
16
23
|
utxos: UtxoId[];
|
|
17
24
|
/**
|
|
18
25
|
* The concrete instruction to send (Publish | Call | Issuance).
|
|
@@ -26,57 +33,25 @@ export type BuildInstructionQueryParameters<
|
|
|
26
33
|
* Optional chained instruction if you want to send two instructions atomically.
|
|
27
34
|
*/
|
|
28
35
|
chainedInstruction?: Inst | null;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// ------------------ helpers ------------------
|
|
32
|
-
|
|
33
|
-
function normalizeXOnly(pub: string): string {
|
|
34
|
-
if (!/^[0-9a-fA-F]{64}$/.test(pub)) {
|
|
35
|
-
throw new Error(
|
|
36
|
-
"x_only_public_key must be 32-byte (64 hex chars) x-only pubkey",
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
return pub.toLowerCase();
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function normalizeUtxoId(u: UtxoId): string {
|
|
43
|
-
if (typeof u === "string") return u;
|
|
44
|
-
if (!u?.txid || typeof u.vout !== "number") {
|
|
45
|
-
throw new Error("funding UTXO must be 'txid:vout' or { txid, vout }");
|
|
46
|
-
}
|
|
47
|
-
return `${u.txid}:${u.vout}`;
|
|
48
|
-
}
|
|
36
|
+
} & GetAccountParameter<account, accountOverride, true, true>;
|
|
49
37
|
|
|
50
|
-
function
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
// ------------------ main builder ------------------
|
|
55
|
-
|
|
56
|
-
export async function buildInstructionQuery<
|
|
57
|
-
chain extends Chain | undefined = Chain | undefined,
|
|
38
|
+
export function buildInstructionQuery<
|
|
39
|
+
chain extends Chain | undefined,
|
|
40
|
+
account extends Account | undefined,
|
|
58
41
|
>(
|
|
59
42
|
client: KontorPublicClient<HttpTransport, chain>,
|
|
60
|
-
params: BuildInstructionQueryParameters<
|
|
61
|
-
):
|
|
62
|
-
const account = client.account;
|
|
63
|
-
|
|
43
|
+
params: BuildInstructionQueryParameters<account>,
|
|
44
|
+
): BuildInstructionQueryReturnType {
|
|
64
45
|
const {
|
|
65
46
|
utxos,
|
|
66
47
|
instruction,
|
|
67
48
|
chainedInstruction = null,
|
|
68
|
-
|
|
69
|
-
xOnlyPubKey = account?.xOnlyPubKey,
|
|
49
|
+
account: account_ = client.account,
|
|
70
50
|
} = params;
|
|
71
51
|
|
|
72
|
-
if (!
|
|
52
|
+
if (!account_) {
|
|
73
53
|
// TODO: add custom error
|
|
74
|
-
throw new Error("
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
if (!address) {
|
|
78
|
-
// TODO: add custom error
|
|
79
|
-
throw new Error("address is required");
|
|
54
|
+
throw new Error("Account is required");
|
|
80
55
|
}
|
|
81
56
|
|
|
82
57
|
if (utxos.length === 0) {
|
|
@@ -84,14 +59,13 @@ export async function buildInstructionQuery<
|
|
|
84
59
|
throw new Error("at least one funding UTXO is required");
|
|
85
60
|
}
|
|
86
61
|
|
|
87
|
-
const
|
|
88
|
-
const fundingIds = normalizeUtxoIds(utxos);
|
|
62
|
+
const account = parseAccount(account_);
|
|
89
63
|
|
|
90
|
-
return {
|
|
91
|
-
|
|
92
|
-
x_only_public_key: xOnly,
|
|
93
|
-
funding_utxo_ids: fundingIds.join(","),
|
|
64
|
+
return buildInstructionQuery_({
|
|
65
|
+
utxos,
|
|
94
66
|
instruction,
|
|
95
|
-
|
|
96
|
-
|
|
67
|
+
chainedInstruction,
|
|
68
|
+
address: account.address,
|
|
69
|
+
xOnlyPubKey: account.xOnlyPubKey,
|
|
70
|
+
});
|
|
97
71
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { KontorPublicClient } from "../../../clients/kontor/create-public-client.js";
|
|
2
2
|
import type { HttpTransport } from "../../../clients/transports/create-http-transport.js";
|
|
3
|
-
import type { Chain } from "../../../types/chain.js";
|
|
3
|
+
import type { Chain, GetChainParameter } from "../../../types/chain.js";
|
|
4
4
|
import type {
|
|
5
5
|
Address,
|
|
6
6
|
TapLeafScript,
|
|
@@ -15,17 +15,28 @@ import {
|
|
|
15
15
|
type Inst,
|
|
16
16
|
type ResultResponse,
|
|
17
17
|
} from "../../../types/kontor.js";
|
|
18
|
+
import type { Account } from "../../../../sdk/accounts/types.js";
|
|
19
|
+
import type { GetAccountParameter } from "../../../../sdk/types/account.js";
|
|
20
|
+
import { parseAccount } from "../../../../sdk/accounts/utils/parse-account.js";
|
|
18
21
|
|
|
19
|
-
export type
|
|
20
|
-
_chain extends Chain | undefined = Chain | undefined,
|
|
21
|
-
> = {
|
|
22
|
-
address?: Address;
|
|
23
|
-
xOnlyPubKey?: XOnlyPubKey; // TODO: maybe this should be wrapped in a single object
|
|
22
|
+
export type CallComposeRequest = {
|
|
24
23
|
utxos: UtxoId[];
|
|
25
24
|
satsPerVByte: number;
|
|
26
25
|
instruction: Inst;
|
|
27
26
|
};
|
|
28
27
|
|
|
28
|
+
export type CallComposeParameters<
|
|
29
|
+
chain extends Chain | undefined = Chain,
|
|
30
|
+
account extends Account | undefined = Account | undefined,
|
|
31
|
+
chainOverride extends Chain | undefined = Chain | undefined,
|
|
32
|
+
accountOverride extends Account | [Address, XOnlyPubKey] | undefined =
|
|
33
|
+
| Account
|
|
34
|
+
| [Address, XOnlyPubKey]
|
|
35
|
+
| undefined,
|
|
36
|
+
> = CallComposeRequest &
|
|
37
|
+
GetAccountParameter<account, accountOverride, true, true> &
|
|
38
|
+
GetChainParameter<chain, chainOverride>;
|
|
39
|
+
|
|
29
40
|
// TODO: organize these types or just refernece direc
|
|
30
41
|
export interface TapLeafScript {
|
|
31
42
|
leafVersion: number;
|
|
@@ -36,29 +47,28 @@ export interface TapLeafScript {
|
|
|
36
47
|
export type CallComposeReturnType = ResultResponse<ComposeOutputs>;
|
|
37
48
|
|
|
38
49
|
export async function callCompose<
|
|
39
|
-
chain extends Chain | undefined
|
|
50
|
+
chain extends Chain | undefined,
|
|
51
|
+
account extends Account | undefined,
|
|
52
|
+
chainOverride extends Chain | undefined = undefined,
|
|
40
53
|
>(
|
|
41
|
-
client: KontorPublicClient<HttpTransport, chain>,
|
|
42
|
-
params: CallComposeParameters<chain>,
|
|
54
|
+
client: KontorPublicClient<HttpTransport, chain, account>,
|
|
55
|
+
params: CallComposeParameters<chain, account, chainOverride>,
|
|
43
56
|
): Promise<CallComposeReturnType> {
|
|
44
|
-
const account = client.account;
|
|
45
|
-
|
|
46
57
|
const {
|
|
58
|
+
account: account_ = client.account,
|
|
59
|
+
chain = client.chain,
|
|
47
60
|
utxos,
|
|
48
|
-
address = account?.address,
|
|
49
|
-
xOnlyPubKey = account?.xOnlyPubKey,
|
|
50
61
|
satsPerVByte,
|
|
51
62
|
instruction,
|
|
52
63
|
} = params;
|
|
53
64
|
|
|
54
|
-
if (!
|
|
65
|
+
if (!account_) {
|
|
55
66
|
// TODO: add custom error
|
|
56
|
-
throw new Error("
|
|
67
|
+
throw new Error("Account is required");
|
|
57
68
|
}
|
|
58
69
|
|
|
59
|
-
if (!
|
|
60
|
-
|
|
61
|
-
throw new Error("address is required");
|
|
70
|
+
if (!chain) {
|
|
71
|
+
throw new Error("Chain is required");
|
|
62
72
|
}
|
|
63
73
|
|
|
64
74
|
if (utxos.length === 0) {
|
|
@@ -66,16 +76,17 @@ export async function callCompose<
|
|
|
66
76
|
throw new Error("at least one funding UTXO is required");
|
|
67
77
|
}
|
|
68
78
|
// TODO: wrap in try-catch
|
|
79
|
+
//
|
|
80
|
+
const account = parseAccount(account_);
|
|
69
81
|
|
|
70
|
-
const composeCall =
|
|
82
|
+
const composeCall = getKontorAction(
|
|
71
83
|
client,
|
|
72
84
|
buildComposeQuery,
|
|
73
85
|
"buildComposeQuery",
|
|
74
86
|
)({
|
|
75
87
|
instruction,
|
|
76
88
|
utxos,
|
|
77
|
-
|
|
78
|
-
address,
|
|
89
|
+
account,
|
|
79
90
|
satsPerVByte,
|
|
80
91
|
});
|
|
81
92
|
|
|
@@ -5,15 +5,15 @@ import type {
|
|
|
5
5
|
import type { ResolvedRegister } from "../../../../wit/register.js";
|
|
6
6
|
import type { KontorPublicClient } from "../../../clients/kontor/create-public-client.js";
|
|
7
7
|
import type { HttpTransport } from "../../../clients/transports/create-http-transport.js";
|
|
8
|
-
import type { Chain } from "../../../types/chain.js";
|
|
8
|
+
import type { Chain, GetChainParameter } from "../../../types/chain.js";
|
|
9
9
|
|
|
10
10
|
export type CallViewParameters<
|
|
11
|
-
|
|
11
|
+
chain extends Chain | undefined = Chain,
|
|
12
|
+
chainOverride extends Chain | undefined = Chain | undefined,
|
|
12
13
|
> = {
|
|
13
14
|
contractAddress: ResolvedRegister["contractAddress"];
|
|
14
15
|
wave: string;
|
|
15
|
-
}
|
|
16
|
-
|
|
16
|
+
} & GetChainParameter<chain, chainOverride>;
|
|
17
17
|
// TODO: refine this type
|
|
18
18
|
export type CallViewReturnType = ResultResponse<ViewResult>;
|
|
19
19
|
|
|
@@ -24,6 +24,7 @@ export async function callView<
|
|
|
24
24
|
params: CallViewParameters<chain>,
|
|
25
25
|
): Promise<CallViewReturnType> {
|
|
26
26
|
const { contractAddress, wave } = params;
|
|
27
|
+
// TODO: assert chain
|
|
27
28
|
|
|
28
29
|
try {
|
|
29
30
|
const response = await client.request({
|
|
@@ -5,19 +5,34 @@ import type {
|
|
|
5
5
|
} from "../../../types/kontor.js";
|
|
6
6
|
import type { KontorPublicClient } from "../../../clients/kontor/create-public-client.js";
|
|
7
7
|
import type { HttpTransport } from "../../../clients/transports/create-http-transport.js";
|
|
8
|
-
import type { Chain } from "../../../types/chain.js";
|
|
9
|
-
|
|
10
|
-
export type InspectParameters = TransactionHex;
|
|
8
|
+
import type { Chain, GetChainParameter } from "../../../types/chain.js";
|
|
9
|
+
// import { assertCurrentChain } from "../../../utils/chain/assert-current-chain.js";
|
|
11
10
|
|
|
11
|
+
export type InspectParameters<
|
|
12
|
+
chain extends Chain | undefined = Chain | undefined,
|
|
13
|
+
chainOverride extends Chain | undefined = Chain | undefined,
|
|
14
|
+
> = TransactionHex & GetChainParameter<chain, chainOverride>;
|
|
12
15
|
export type InspectReturnType = ResultResponse<OpWithResult[]>;
|
|
13
16
|
|
|
14
17
|
export async function inspect<
|
|
15
18
|
chain extends Chain | undefined = Chain | undefined,
|
|
19
|
+
chainOverride extends Chain | undefined = Chain | undefined,
|
|
16
20
|
>(
|
|
17
21
|
client: KontorPublicClient<HttpTransport, chain>,
|
|
18
|
-
params: InspectParameters,
|
|
22
|
+
params: InspectParameters<chain, chainOverride>,
|
|
19
23
|
): Promise<InspectReturnType> {
|
|
20
|
-
const {
|
|
24
|
+
const {
|
|
25
|
+
hex,
|
|
26
|
+
// chain: chain_ = client.chain
|
|
27
|
+
} = params;
|
|
28
|
+
|
|
29
|
+
// TODO: chain assertions everywhere ( need to get current chain )
|
|
30
|
+
|
|
31
|
+
// assertCurrentChain({
|
|
32
|
+
// currentChain: client.chain,
|
|
33
|
+
// chain: chain_
|
|
34
|
+
// });
|
|
35
|
+
//
|
|
21
36
|
|
|
22
37
|
try {
|
|
23
38
|
const response = await client.request({
|
|
@@ -27,10 +42,6 @@ export async function inspect<
|
|
|
27
42
|
body: { hex: hex },
|
|
28
43
|
});
|
|
29
44
|
|
|
30
|
-
console.log("callView response:", response);
|
|
31
|
-
|
|
32
|
-
// TODO: fix CallViwewReturnType
|
|
33
|
-
// @ts-ignore
|
|
34
45
|
return response;
|
|
35
46
|
} catch (e) {
|
|
36
47
|
// TODO: augment error handling
|
|
@@ -3,6 +3,7 @@ import { test } from "vitest";
|
|
|
3
3
|
import { parseWit } from "../../../../wit/wit-parser/parse-wit.js";
|
|
4
4
|
import { createPublicClient } from "../../../clients/kontor/create-public-client.js";
|
|
5
5
|
import { http } from "../../../clients/transports/http.js";
|
|
6
|
+
import { signet } from "../../../../exports/index.js";
|
|
6
7
|
|
|
7
8
|
// define the wit
|
|
8
9
|
const input = [
|
|
@@ -30,6 +31,7 @@ test.skip("e2e", async () => {
|
|
|
30
31
|
"tb1pj2wrjsg0ksmmflec0myf3j7qnqm9myvk2pesqn7y8cqn6sgdg9ls9u6tar",
|
|
31
32
|
"2c7b730daa0036e8276cdd8fabe844b2dd324a6d227dd209663805189d03e51f",
|
|
32
33
|
],
|
|
34
|
+
chain: signet,
|
|
33
35
|
});
|
|
34
36
|
|
|
35
37
|
// proc contract action defined on client
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import type { GetAccountParameter } from "../../../../sdk/types/account.js";
|
|
2
|
+
import type { Account } from "../../../../sdk/accounts/types.js";
|
|
1
3
|
import { Instruction } from "../../../../sdk/types/kontor.js";
|
|
2
4
|
import type { Wit } from "../../../../wit/wit.js";
|
|
3
5
|
import type { KontorPublicClient } from "../../../clients/kontor/create-public-client.js";
|
|
4
6
|
import type { HttpTransport } from "../../../clients/transports/create-http-transport.js";
|
|
5
|
-
import type { Chain } from "../../../types/chain.js";
|
|
7
|
+
import type { Chain, GetChainParameter } from "../../../types/chain.js";
|
|
6
8
|
import type {
|
|
7
9
|
ContractFunctionArgs,
|
|
8
10
|
ContractFunctionName,
|
|
@@ -27,13 +29,19 @@ export type ProcContractParameters<
|
|
|
27
29
|
"proc",
|
|
28
30
|
functionName
|
|
29
31
|
> = ContractFunctionArgs<wit, "proc", functionName>,
|
|
32
|
+
chain extends Chain | undefined = Chain | undefined,
|
|
33
|
+
account extends Account | undefined = Account | undefined,
|
|
34
|
+
chainOverride extends Chain | undefined = Chain | undefined,
|
|
35
|
+
accountOverride extends Account | [Address, XOnlyPubKey] | undefined =
|
|
36
|
+
| Account
|
|
37
|
+
| [Address, XOnlyPubKey]
|
|
38
|
+
| undefined,
|
|
30
39
|
> = ContractFunctionParameters<wit, "proc", functionName, args> & {
|
|
31
|
-
address?: Address;
|
|
32
|
-
xOnlyPubKey?: XOnlyPubKey;
|
|
33
40
|
utxos: UtxoId[];
|
|
34
41
|
gas: bigint;
|
|
35
42
|
satsPerVByte: number;
|
|
36
|
-
}
|
|
43
|
+
} & GetChainParameter<chain, chainOverride> &
|
|
44
|
+
GetAccountParameter<account, accountOverride, true, true>;
|
|
37
45
|
|
|
38
46
|
export type ProcContractReturnType = CallComposeReturnType;
|
|
39
47
|
|
|
@@ -43,9 +51,18 @@ export async function procContract<
|
|
|
43
51
|
const wit extends Wit | readonly unknown[],
|
|
44
52
|
functionName extends ContractFunctionName<wit, "proc">,
|
|
45
53
|
const args extends ContractFunctionArgs<wit, "proc", functionName>,
|
|
54
|
+
account extends Account | undefined,
|
|
55
|
+
chainOverride extends Chain | undefined = undefined,
|
|
46
56
|
>(
|
|
47
57
|
client: KontorPublicClient<HttpTransport, chain>,
|
|
48
|
-
parameters: ProcContractParameters<
|
|
58
|
+
parameters: ProcContractParameters<
|
|
59
|
+
wit,
|
|
60
|
+
functionName,
|
|
61
|
+
args,
|
|
62
|
+
chain,
|
|
63
|
+
account,
|
|
64
|
+
chainOverride
|
|
65
|
+
>,
|
|
49
66
|
): Promise<ProcContractReturnType> {
|
|
50
67
|
const {
|
|
51
68
|
wit: wit,
|
|
@@ -55,27 +72,15 @@ export async function procContract<
|
|
|
55
72
|
utxos,
|
|
56
73
|
gas,
|
|
57
74
|
satsPerVByte,
|
|
58
|
-
|
|
59
|
-
|
|
75
|
+
chain: chain_ = client.chain,
|
|
76
|
+
account: account_ = client.account,
|
|
60
77
|
// @ts-ignore
|
|
61
78
|
...rest
|
|
62
79
|
} = parameters as ProcContractParameters;
|
|
63
80
|
|
|
64
|
-
|
|
65
|
-
const wave = encodeFunctionData({
|
|
66
|
-
wit: wit,
|
|
67
|
-
args,
|
|
68
|
-
functionName,
|
|
69
|
-
} as EncodeFunctionDataParameters);
|
|
70
|
-
|
|
71
|
-
if (!xOnlyPubKey) {
|
|
81
|
+
if (!account_) {
|
|
72
82
|
// TODO: add custom error
|
|
73
|
-
throw new Error("
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
if (!address) {
|
|
77
|
-
// TODO: add custom error
|
|
78
|
-
throw new Error("address is required");
|
|
83
|
+
throw new Error("account is required");
|
|
79
84
|
}
|
|
80
85
|
|
|
81
86
|
if (utxos.length === 0) {
|
|
@@ -83,6 +88,12 @@ export async function procContract<
|
|
|
83
88
|
throw new Error("at least one funding UTXO is required");
|
|
84
89
|
}
|
|
85
90
|
|
|
91
|
+
const wave = encodeFunctionData({
|
|
92
|
+
wit: wit,
|
|
93
|
+
args,
|
|
94
|
+
functionName,
|
|
95
|
+
} as EncodeFunctionDataParameters);
|
|
96
|
+
|
|
86
97
|
try {
|
|
87
98
|
const response = await getKontorAction(
|
|
88
99
|
client,
|
|
@@ -91,8 +102,8 @@ export async function procContract<
|
|
|
91
102
|
)({
|
|
92
103
|
utxos,
|
|
93
104
|
satsPerVByte,
|
|
94
|
-
|
|
95
|
-
|
|
105
|
+
account: account_,
|
|
106
|
+
chain: chain_,
|
|
96
107
|
instruction: Instruction.call({
|
|
97
108
|
contract: contractAddress,
|
|
98
109
|
gasLimit: gas,
|