@kontor/kontor-sdk 1.0.0-alpha.15 → 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/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/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/package.json +2 -6
- package/src/exports/index.ts +44 -0
- package/dist/src/exports/index.js +0 -11
- package/dist/src/exports/index.js.map +0 -1
- package/dist/src/exports/index.test.js +0 -10
- package/dist/src/exports/index.test.js.map +0 -1
- package/dist/src/sdk/accounts/hd-key-to-account.js +0 -20
- package/dist/src/sdk/accounts/hd-key-to-account.js.map +0 -1
- package/dist/src/sdk/accounts/mnemonic-to-account.js +0 -16
- package/dist/src/sdk/accounts/mnemonic-to-account.js.map +0 -1
- package/dist/src/sdk/accounts/mnemonic-to-account.test.js +0 -96
- package/dist/src/sdk/accounts/mnemonic-to-account.test.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/accounts/to-local-account.js +0 -28
- package/dist/src/sdk/accounts/to-local-account.js.map +0 -1
- package/dist/src/sdk/accounts/types.js +0 -2
- package/dist/src/sdk/accounts/types.js.map +0 -1
- package/dist/src/sdk/accounts/utils/parse-account.js +0 -10
- package/dist/src/sdk/accounts/utils/parse-account.js.map +0 -1
- package/dist/src/sdk/accounts/utils/public-key-to-p2tr-payment.js +0 -14
- package/dist/src/sdk/accounts/utils/public-key-to-p2tr-payment.js.map +0 -1
- package/dist/src/sdk/accounts/utils/sign-psbt.js +0 -17
- package/dist/src/sdk/accounts/utils/sign-psbt.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-query.js +0 -30
- package/dist/src/sdk/actions/kontor/public/build-compose-query.js.map +0 -1
- package/dist/src/sdk/actions/kontor/public/build-instruction-query.js +0 -45
- package/dist/src/sdk/actions/kontor/public/build-instruction-query.js.map +0 -1
- package/dist/src/sdk/actions/kontor/public/call-compose.js +0 -38
- package/dist/src/sdk/actions/kontor/public/call-compose.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-commit.js +0 -34
- package/dist/src/sdk/actions/kontor/wallet/sign-commit.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/public/send-raw-transaction.js +0 -7
- package/dist/src/sdk/actions/public/send-raw-transaction.js.map +0 -1
- package/dist/src/sdk/actions/public/test-mempool-accept.js +0 -20
- package/dist/src/sdk/actions/public/test-mempool-accept.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/chains/definitions/index.js +0 -2
- package/dist/src/sdk/chains/definitions/index.js.map +0 -1
- package/dist/src/sdk/chains/definitions/signet.js +0 -36
- package/dist/src/sdk/chains/definitions/signet.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/base/create-rpc-client.test.js +0 -145
- package/dist/src/sdk/clients/base/create-rpc-client.test.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-public-client.test.js +0 -113
- package/dist/src/sdk/clients/create-public-client.test.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/decorators/kontor/wallet.js +0 -13
- package/dist/src/sdk/clients/decorators/kontor/wallet.js.map +0 -1
- package/dist/src/sdk/clients/decorators/public.js +0 -9
- package/dist/src/sdk/clients/decorators/public.js.map +0 -1
- package/dist/src/sdk/clients/decorators/wallet.js +0 -9
- package/dist/src/sdk/clients/decorators/wallet.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/kontor/create-public-client.test.js +0 -44
- package/dist/src/sdk/clients/kontor/create-public-client.test.js.map +0 -1
- package/dist/src/sdk/clients/kontor/create-wallet-client.js +0 -14
- package/dist/src/sdk/clients/kontor/create-wallet-client.js.map +0 -1
- package/dist/src/sdk/clients/transports/create-http-transport.js +0 -25
- package/dist/src/sdk/clients/transports/create-http-transport.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/clients/transports/create-rpc-transport.test.js +0 -58
- package/dist/src/sdk/clients/transports/create-rpc-transport.test.js.map +0 -1
- package/dist/src/sdk/clients/transports/custom.js +0 -14
- package/dist/src/sdk/clients/transports/custom.js.map +0 -1
- package/dist/src/sdk/clients/transports/http-rpc.js +0 -84
- package/dist/src/sdk/clients/transports/http-rpc.js.map +0 -1
- package/dist/src/sdk/clients/transports/http-rpc.test.js +0 -147
- package/dist/src/sdk/clients/transports/http-rpc.test.js.map +0 -1
- package/dist/src/sdk/clients/transports/http.js +0 -45
- package/dist/src/sdk/clients/transports/http.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/errors/address.js +0 -13
- package/dist/src/sdk/errors/address.js.map +0 -1
- package/dist/src/sdk/errors/base.js +0 -92
- package/dist/src/sdk/errors/base.js.map +0 -1
- package/dist/src/sdk/errors/request.js +0 -100
- package/dist/src/sdk/errors/request.js.map +0 -1
- package/dist/src/sdk/errors/rpc.js +0 -30
- package/dist/src/sdk/errors/rpc.js.map +0 -1
- package/dist/src/sdk/errors/transport.js +0 -10
- package/dist/src/sdk/errors/transport.js.map +0 -1
- package/dist/src/sdk/errors/utils.js +0 -2
- package/dist/src/sdk/errors/utils.js.map +0 -1
- package/dist/src/sdk/errors/version.js +0 -2
- package/dist/src/sdk/errors/version.js.map +0 -1
- package/dist/src/sdk/errors/wit.js +0 -19
- package/dist/src/sdk/errors/wit.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/account.js +0 -2
- package/dist/src/sdk/types/account.js.map +0 -1
- package/dist/src/sdk/types/btc-rpc.js +0 -2
- package/dist/src/sdk/types/btc-rpc.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/contract.test-d.js +0 -35
- package/dist/src/sdk/types/contract.test-d.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/http-schema.test-d.js +0 -133
- package/dist/src/sdk/types/http-schema.test-d.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/misc.js +0 -2
- package/dist/src/sdk/types/misc.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/types/rpc.js +0 -19
- package/dist/src/sdk/types/rpc.js.map +0 -1
- package/dist/src/sdk/types/utils.js +0 -2
- package/dist/src/sdk/types/utils.js.map +0 -1
- package/dist/src/sdk/types/wbip001.js +0 -3
- package/dist/src/sdk/types/wbip001.js.map +0 -1
- package/dist/src/sdk/utils/build-http-request.js +0 -55
- package/dist/src/sdk/utils/build-http-request.js.map +0 -1
- package/dist/src/sdk/utils/build-request.js +0 -35
- package/dist/src/sdk/utils/build-request.js.map +0 -1
- package/dist/src/sdk/utils/build-rpc-request.js +0 -84
- package/dist/src/sdk/utils/build-rpc-request.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/src/sdk/utils/encoding/to-hex.js +0 -23
- package/dist/src/sdk/utils/encoding/to-hex.js.map +0 -1
- package/dist/src/sdk/utils/get-action.js +0 -27
- package/dist/src/sdk/utils/get-action.js.map +0 -1
- package/dist/src/sdk/utils/http.js +0 -137
- package/dist/src/sdk/utils/http.js.map +0 -1
- package/dist/src/sdk/utils/lru.js +0 -35
- package/dist/src/sdk/utils/lru.js.map +0 -1
- package/dist/src/sdk/utils/promise/create-batch-scheduler.js +0 -49
- package/dist/src/sdk/utils/promise/create-batch-scheduler.js.map +0 -1
- package/dist/src/sdk/utils/promise/with-dedupe.js +0 -14
- package/dist/src/sdk/utils/promise/with-dedupe.js.map +0 -1
- package/dist/src/sdk/utils/promise/with-resolvers.js +0 -10
- package/dist/src/sdk/utils/promise/with-resolvers.js.map +0 -1
- package/dist/src/sdk/utils/promise/with-retry.js +0 -25
- package/dist/src/sdk/utils/promise/with-retry.js.map +0 -1
- package/dist/src/sdk/utils/promise/with-timeout.js +0 -30
- package/dist/src/sdk/utils/promise/with-timeout.js.map +0 -1
- package/dist/src/sdk/utils/rpc/http.js +0 -86
- package/dist/src/sdk/utils/rpc/http.js.map +0 -1
- package/dist/src/sdk/utils/rpc/id.js +0 -13
- package/dist/src/sdk/utils/rpc/id.js.map +0 -1
- package/dist/src/sdk/utils/stringify.js +0 -5
- package/dist/src/sdk/utils/stringify.js.map +0 -1
- package/dist/src/sdk/utils/uid.js +0 -14
- package/dist/src/sdk/utils/uid.js.map +0 -1
- package/dist/src/sdk/utils/wait.js +0 -4
- package/dist/src/sdk/utils/wait.js.map +0 -1
- package/dist/src/sdk/utils/wit/codecs/decimal.js +0 -165
- package/dist/src/sdk/utils/wit/codecs/decimal.js.map +0 -1
- package/dist/src/sdk/utils/wit/codecs/enum.js +0 -104
- package/dist/src/sdk/utils/wit/codecs/enum.js.map +0 -1
- package/dist/src/sdk/utils/wit/codecs/integer.js +0 -167
- package/dist/src/sdk/utils/wit/codecs/integer.js.map +0 -1
- package/dist/src/sdk/utils/wit/codecs/list.js +0 -117
- package/dist/src/sdk/utils/wit/codecs/list.js.map +0 -1
- package/dist/src/sdk/utils/wit/codecs/option.js +0 -91
- package/dist/src/sdk/utils/wit/codecs/option.js.map +0 -1
- package/dist/src/sdk/utils/wit/codecs/string.js +0 -27
- package/dist/src/sdk/utils/wit/codecs/string.js.map +0 -1
- package/dist/src/sdk/utils/wit/codecs/types.js +0 -45
- package/dist/src/sdk/utils/wit/codecs/types.js.map +0 -1
- package/dist/src/sdk/utils/wit/codecs/unit.js +0 -22
- package/dist/src/sdk/utils/wit/codecs/unit.js.map +0 -1
- package/dist/src/sdk/utils/wit/decode-function-result.js +0 -36
- package/dist/src/sdk/utils/wit/decode-function-result.js.map +0 -1
- package/dist/src/sdk/utils/wit/decode-wit-parameter.js +0 -286
- package/dist/src/sdk/utils/wit/decode-wit-parameter.js.map +0 -1
- package/dist/src/sdk/utils/wit/decode-wit-parameter.test.js +0 -75
- package/dist/src/sdk/utils/wit/decode-wit-parameter.test.js.map +0 -1
- package/dist/src/sdk/utils/wit/encode-function-data.js +0 -17
- package/dist/src/sdk/utils/wit/encode-function-data.js.map +0 -1
- package/dist/src/sdk/utils/wit/encode-function-data.test-d.js +0 -21
- package/dist/src/sdk/utils/wit/encode-function-data.test-d.js.map +0 -1
- package/dist/src/sdk/utils/wit/encode-function-data.test.js +0 -91
- package/dist/src/sdk/utils/wit/encode-function-data.test.js.map +0 -1
- package/dist/src/sdk/utils/wit/encode-wit-parameters.js +0 -250
- package/dist/src/sdk/utils/wit/encode-wit-parameters.js.map +0 -1
- package/dist/src/sdk/utils/wit/encode-wit-parameters.test.js +0 -62
- package/dist/src/sdk/utils/wit/encode-wit-parameters.test.js.map +0 -1
- package/dist/src/sdk/utils/wit/get-wit-item.js +0 -15
- package/dist/src/sdk/utils/wit/get-wit-item.js.map +0 -1
- package/dist/src/sdk/utils/wit/get-wit-item.test.js +0 -118
- package/dist/src/sdk/utils/wit/get-wit-item.test.js.map +0 -1
- package/dist/src/sdk/utils/wit/prepare-encode-function-data.js +0 -24
- package/dist/src/sdk/utils/wit/prepare-encode-function-data.js.map +0 -1
- package/dist/src/wit/error.js +0 -59
- package/dist/src/wit/error.js.map +0 -1
- package/dist/src/wit/narrow.js +0 -14
- package/dist/src/wit/narrow.js.map +0 -1
- package/dist/src/wit/regex.js +0 -6
- package/dist/src/wit/regex.js.map +0 -1
- package/dist/src/wit/register.js +0 -2
- package/dist/src/wit/register.js.map +0 -1
- package/dist/src/wit/type-utils.js +0 -2
- package/dist/src/wit/type-utils.js.map +0 -1
- package/dist/src/wit/utils.js +0 -2
- package/dist/src/wit/utils.js.map +0 -1
- package/dist/src/wit/utils.test-d.js +0 -16
- package/dist/src/wit/utils.test-d.js.map +0 -1
- package/dist/src/wit/version.js +0 -2
- package/dist/src/wit/version.js.map +0 -1
- package/dist/src/wit/wit-parser/core/errors/signature.js +0 -42
- package/dist/src/wit/wit-parser/core/errors/signature.js.map +0 -1
- package/dist/src/wit/wit-parser/core/errors/splitParameters.js +0 -18
- package/dist/src/wit/wit-parser/core/errors/splitParameters.js.map +0 -1
- package/dist/src/wit/wit-parser/core/errors/wit-parameter.js +0 -29
- package/dist/src/wit/wit-parser/core/errors/wit-parameter.js.map +0 -1
- package/dist/src/wit/wit-parser/core/records.js +0 -73
- package/dist/src/wit/wit-parser/core/records.js.map +0 -1
- package/dist/src/wit/wit-parser/core/records.test.js +0 -53
- package/dist/src/wit/wit-parser/core/records.test.js.map +0 -1
- package/dist/src/wit/wit-parser/core/signatures.js +0 -32
- package/dist/src/wit/wit-parser/core/signatures.js.map +0 -1
- package/dist/src/wit/wit-parser/core/signatures.test.js +0 -54
- package/dist/src/wit/wit-parser/core/signatures.test.js.map +0 -1
- package/dist/src/wit/wit-parser/core/types/records.js +0 -2
- package/dist/src/wit/wit-parser/core/types/records.js.map +0 -1
- package/dist/src/wit/wit-parser/core/types/records.test-d.js +0 -19
- package/dist/src/wit/wit-parser/core/types/records.test-d.js.map +0 -1
- package/dist/src/wit/wit-parser/core/types/signatures.js +0 -3
- package/dist/src/wit/wit-parser/core/types/signatures.js.map +0 -1
- package/dist/src/wit/wit-parser/core/types/signatures.test-d.js +0 -18
- package/dist/src/wit/wit-parser/core/types/signatures.test-d.js.map +0 -1
- package/dist/src/wit/wit-parser/core/types/utils.js +0 -2
- package/dist/src/wit/wit-parser/core/types/utils.js.map +0 -1
- package/dist/src/wit/wit-parser/core/types/utils.test-d.js +0 -138
- package/dist/src/wit/wit-parser/core/types/utils.test-d.js.map +0 -1
- package/dist/src/wit/wit-parser/core/utils.js +0 -212
- package/dist/src/wit/wit-parser/core/utils.js.map +0 -1
- package/dist/src/wit/wit-parser/core/utils.test.js +0 -302
- package/dist/src/wit/wit-parser/core/utils.test.js.map +0 -1
- package/dist/src/wit/wit-parser/parse-wit-parameter.js +0 -26
- package/dist/src/wit/wit-parser/parse-wit-parameter.js.map +0 -1
- package/dist/src/wit/wit-parser/parse-wit-parameter.test.js +0 -77
- package/dist/src/wit/wit-parser/parse-wit-parameter.test.js.map +0 -1
- package/dist/src/wit/wit-parser/parse-wit.js +0 -16
- package/dist/src/wit/wit-parser/parse-wit.js.map +0 -1
- package/dist/src/wit/wit-parser/parse-wit.test.js +0 -78
- package/dist/src/wit/wit-parser/parse-wit.test.js.map +0 -1
- package/dist/src/wit/wit.js +0 -2
- package/dist/src/wit/wit.js.map +0 -1
- package/dist/src/wit/wit.test.js +0 -6
- package/dist/src/wit/wit.test.js.map +0 -1
- package/dist/test/globalSetup.js +0 -14
- package/dist/test/globalSetup.js.map +0 -1
- package/dist/test/src/wits.js +0 -21
- package/dist/test/src/wits.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
|
@@ -1,302 +0,0 @@
|
|
|
1
|
-
import { expect, test, describe } from "vitest";
|
|
2
|
-
import { parseWitParameter, splitParameters, parseFunctionSignature, } from "./utils.js";
|
|
3
|
-
const parseOptions = {
|
|
4
|
-
records: {
|
|
5
|
-
"contract-address": [
|
|
6
|
-
{ name: "name", type: "string" },
|
|
7
|
-
{ name: "height", type: "s64" },
|
|
8
|
-
{ name: "tx-index", type: "s64" },
|
|
9
|
-
],
|
|
10
|
-
},
|
|
11
|
-
};
|
|
12
|
-
describe("parseFunctionSignature", () => {
|
|
13
|
-
test.each([
|
|
14
|
-
{
|
|
15
|
-
input: "export fib: func(ctx: borrow<proc-context>, arith-address: contract-address, n: u64) -> u64;",
|
|
16
|
-
expected: {
|
|
17
|
-
context: "proc",
|
|
18
|
-
inputs: [
|
|
19
|
-
{
|
|
20
|
-
name: "arith-address",
|
|
21
|
-
type: "contract-address",
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
name: "n",
|
|
25
|
-
type: "u64",
|
|
26
|
-
},
|
|
27
|
-
],
|
|
28
|
-
name: "fib",
|
|
29
|
-
outputs: [
|
|
30
|
-
{
|
|
31
|
-
type: "u64",
|
|
32
|
-
},
|
|
33
|
-
],
|
|
34
|
-
type: "function",
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
input: "export cached-values: func(ctx: borrow<view-context>) -> list<u64>;",
|
|
39
|
-
expected: {
|
|
40
|
-
context: "view",
|
|
41
|
-
inputs: [],
|
|
42
|
-
name: "cached-values",
|
|
43
|
-
outputs: [
|
|
44
|
-
{
|
|
45
|
-
type: "list<u64>",
|
|
46
|
-
},
|
|
47
|
-
],
|
|
48
|
-
type: "function",
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
])("parseFunctionSignature($input)", ({ input, expected }) => {
|
|
52
|
-
expect(parseFunctionSignature(input)).toEqual(expected);
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
describe("parseWitParameter", () => {
|
|
56
|
-
test.each([
|
|
57
|
-
{
|
|
58
|
-
parameter: "ctx: borrow<proc-context>",
|
|
59
|
-
expected: {
|
|
60
|
-
name: "ctx",
|
|
61
|
-
type: "borrow<proc-context>",
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
parameter: "arith-address: contract-address",
|
|
66
|
-
expected: {
|
|
67
|
-
name: "arith-address",
|
|
68
|
-
type: "tuple",
|
|
69
|
-
components: [
|
|
70
|
-
{ name: "name", type: "string" },
|
|
71
|
-
{ name: "height", type: "s64" },
|
|
72
|
-
{ name: "tx-index", type: "s64" },
|
|
73
|
-
],
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
parameter: "n: u64",
|
|
78
|
-
expected: {
|
|
79
|
-
name: "n",
|
|
80
|
-
type: "u64",
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
parameter: "y: string",
|
|
85
|
-
expected: {
|
|
86
|
-
name: "y",
|
|
87
|
-
type: "string",
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
parameter: "list-of-strings: list<string>",
|
|
92
|
-
expected: {
|
|
93
|
-
name: "list-of-strings",
|
|
94
|
-
type: "list<string>",
|
|
95
|
-
},
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
parameter: "arith-addresses: list<contract-address>",
|
|
99
|
-
expected: {
|
|
100
|
-
name: "arith-addresses",
|
|
101
|
-
type: "list<tuple>",
|
|
102
|
-
components: [
|
|
103
|
-
{ name: "name", type: "string" },
|
|
104
|
-
{ name: "height", type: "s64" },
|
|
105
|
-
{ name: "tx-index", type: "s64" },
|
|
106
|
-
],
|
|
107
|
-
},
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
parameter: "list<contract-address>",
|
|
111
|
-
expected: {
|
|
112
|
-
type: "list<tuple>",
|
|
113
|
-
components: [
|
|
114
|
-
{ name: "name", type: "string" },
|
|
115
|
-
{ name: "height", type: "s64" },
|
|
116
|
-
{ name: "tx-index", type: "s64" },
|
|
117
|
-
],
|
|
118
|
-
},
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
parameter: "option<contract-address>",
|
|
122
|
-
expected: {
|
|
123
|
-
type: "option<tuple>",
|
|
124
|
-
components: [
|
|
125
|
-
{ name: "name", type: "string" },
|
|
126
|
-
{ name: "height", type: "s64" },
|
|
127
|
-
{ name: "tx-index", type: "s64" },
|
|
128
|
-
],
|
|
129
|
-
},
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
parameter: "result<contract-address, error>",
|
|
133
|
-
expected: {
|
|
134
|
-
type: "result<tuple, error>",
|
|
135
|
-
components: [
|
|
136
|
-
{ name: "name", type: "string" },
|
|
137
|
-
{ name: "height", type: "s64" },
|
|
138
|
-
{ name: "tx-index", type: "s64" },
|
|
139
|
-
],
|
|
140
|
-
},
|
|
141
|
-
},
|
|
142
|
-
{
|
|
143
|
-
parameter: "result<list<contract-address>, error>",
|
|
144
|
-
expected: {
|
|
145
|
-
type: "result<list<tuple>, error>",
|
|
146
|
-
components: [
|
|
147
|
-
{ name: "name", type: "string" },
|
|
148
|
-
{ name: "height", type: "s64" },
|
|
149
|
-
{ name: "tx-index", type: "s64" },
|
|
150
|
-
],
|
|
151
|
-
},
|
|
152
|
-
},
|
|
153
|
-
// {
|
|
154
|
-
// parameter: "result<string, list<option<contract-address>>>",
|
|
155
|
-
// expected: {
|
|
156
|
-
// type: "result<string, list<option<tuple>>>",
|
|
157
|
-
// components: [
|
|
158
|
-
// { name: "left", type: "string" },
|
|
159
|
-
// {
|
|
160
|
-
// name: "right",
|
|
161
|
-
// type: "list<option<tuple>>",
|
|
162
|
-
// components: [
|
|
163
|
-
// { name: "name", type: "string" },
|
|
164
|
-
// { name: "height", type: "s64" },
|
|
165
|
-
// { name: "tx-index", type: "s64" },
|
|
166
|
-
// ],
|
|
167
|
-
// },
|
|
168
|
-
// ],
|
|
169
|
-
// },
|
|
170
|
-
// },
|
|
171
|
-
// {
|
|
172
|
-
// parameter: "result<string, list<result<string, contract-address>>>",
|
|
173
|
-
// expected: {
|
|
174
|
-
// type: "result<string, list<result<string, tuple>>>",
|
|
175
|
-
// components: [
|
|
176
|
-
// { name: "left", type: "string" },
|
|
177
|
-
// {
|
|
178
|
-
// name: "right",
|
|
179
|
-
// type: "list<result<string, tuple>>",
|
|
180
|
-
// components: [
|
|
181
|
-
// { name: "left", type: "string" },
|
|
182
|
-
// {
|
|
183
|
-
// name: "right",
|
|
184
|
-
// type: "tuple",
|
|
185
|
-
// components: [
|
|
186
|
-
// { name: "name", type: "string" },
|
|
187
|
-
// { name: "height", type: "s64" },
|
|
188
|
-
// { name: "tx-index", type: "s64" },
|
|
189
|
-
// ],
|
|
190
|
-
// },
|
|
191
|
-
// ],
|
|
192
|
-
// },
|
|
193
|
-
// ],
|
|
194
|
-
// },
|
|
195
|
-
// },
|
|
196
|
-
// {
|
|
197
|
-
// parameter:
|
|
198
|
-
// "result<string, list<result<string, option<contract-address>>>>",
|
|
199
|
-
// expected: {
|
|
200
|
-
// type: "result<string, list<result<string, option<tuple>>>>",
|
|
201
|
-
// components: [
|
|
202
|
-
// { name: "left", type: "string" },
|
|
203
|
-
// {
|
|
204
|
-
// name: "right",
|
|
205
|
-
// type: "list<result<string, option<tuple>>>",
|
|
206
|
-
// components: [
|
|
207
|
-
// { name: "left", type: "string" },
|
|
208
|
-
// {
|
|
209
|
-
// name: "right",
|
|
210
|
-
// type: "option<tuple>",
|
|
211
|
-
// components: [
|
|
212
|
-
// { name: "name", type: "string" },
|
|
213
|
-
// { name: "height", type: "s64" },
|
|
214
|
-
// { name: "tx-index", type: "s64" },
|
|
215
|
-
// ],
|
|
216
|
-
// },
|
|
217
|
-
// ],
|
|
218
|
-
// },
|
|
219
|
-
// ],
|
|
220
|
-
// },
|
|
221
|
-
// },
|
|
222
|
-
// {
|
|
223
|
-
// parameter: "option<list<result<string, contract-address>>>",
|
|
224
|
-
// expected: {
|
|
225
|
-
// type: "option<list<result<string, tuple>>>",
|
|
226
|
-
// components: [
|
|
227
|
-
// { type: "string", name: "left" },
|
|
228
|
-
// {
|
|
229
|
-
// name: "right",
|
|
230
|
-
// type: "tuple",
|
|
231
|
-
// components: [
|
|
232
|
-
// { type: "string", name: "name" },
|
|
233
|
-
// { name: "height", type: "s64" },
|
|
234
|
-
// { name: "tx-index", type: "s64" },
|
|
235
|
-
// ],
|
|
236
|
-
// },
|
|
237
|
-
// ],
|
|
238
|
-
// },
|
|
239
|
-
// },
|
|
240
|
-
])("parseWitParameter($parameter)", ({ parameter, expected }) => {
|
|
241
|
-
expect(parseWitParameter(parameter, parseOptions)).toEqual(expected);
|
|
242
|
-
});
|
|
243
|
-
});
|
|
244
|
-
// import { InvalidGenericSyntaxError } from "./errors";
|
|
245
|
-
describe("splitParameters (WIT generics, only < > nesting)", () => {
|
|
246
|
-
test("empty / whitespace", () => {
|
|
247
|
-
expect(splitParameters("")).toEqual([]);
|
|
248
|
-
expect(splitParameters(" ")).toEqual([]);
|
|
249
|
-
});
|
|
250
|
-
test("simple top-level commas", () => {
|
|
251
|
-
expect(splitParameters("a, b, c")).toEqual(["a", "b", "c"]);
|
|
252
|
-
expect(splitParameters(" a , b ,c ")).toEqual(["a", "b", "c"]);
|
|
253
|
-
});
|
|
254
|
-
test("does not split inside < >", () => {
|
|
255
|
-
expect(splitParameters("tuple<u64, list<string>>")).toEqual([
|
|
256
|
-
"tuple<u64, list<string>>",
|
|
257
|
-
]);
|
|
258
|
-
expect(splitParameters("result<integer, error>")).toEqual([
|
|
259
|
-
"result<integer, error>",
|
|
260
|
-
]);
|
|
261
|
-
expect(splitParameters("map<string, list<result<u64, error>>>")).toEqual([
|
|
262
|
-
"map<string, list<result<u64, error>>>",
|
|
263
|
-
]);
|
|
264
|
-
});
|
|
265
|
-
test("mixed: top-level params that contain nested generics", () => {
|
|
266
|
-
const input = "ctx: borrow<proc-context>, pair: list<result<token-pair, error>>, n: u64";
|
|
267
|
-
expect(splitParameters(input)).toEqual([
|
|
268
|
-
"ctx: borrow<proc-context>",
|
|
269
|
-
"pair: list<result<token-pair, error>>",
|
|
270
|
-
"n: u64",
|
|
271
|
-
]);
|
|
272
|
-
});
|
|
273
|
-
test("deep nesting", () => {
|
|
274
|
-
const input = "outer<mid<inner<u8, list<u16>>>>";
|
|
275
|
-
expect(splitParameters(input)).toEqual([
|
|
276
|
-
"outer<mid<inner<u8, list<u16>>>>",
|
|
277
|
-
]);
|
|
278
|
-
});
|
|
279
|
-
test("handles trailing comma by ignoring empty token", () => {
|
|
280
|
-
expect(splitParameters("a, b<z, y>,")) // trailing comma
|
|
281
|
-
.toEqual(["a", "b<z, y>"]);
|
|
282
|
-
});
|
|
283
|
-
test("ignores empty segments from duplicate commas", () => {
|
|
284
|
-
expect(splitParameters("a,,b")).toEqual(["a", "b"]);
|
|
285
|
-
expect(splitParameters(",a,b,")).toEqual(["a", "b"]);
|
|
286
|
-
});
|
|
287
|
-
test("throws on unbalanced opener", () => {
|
|
288
|
-
expect(() => splitParameters("a<b,c")).toThrow(); // e.g., InvalidGenericSyntaxError
|
|
289
|
-
});
|
|
290
|
-
test("throws on stray closer", () => {
|
|
291
|
-
expect(() => splitParameters("a,b>")).toThrow();
|
|
292
|
-
});
|
|
293
|
-
test("complex function-style params", () => {
|
|
294
|
-
const input = "ctx: borrow<proc-context>, result: result<tuple<u64, list<string>>, error>, flag: bool";
|
|
295
|
-
expect(splitParameters(input)).toEqual([
|
|
296
|
-
"ctx: borrow<proc-context>",
|
|
297
|
-
"result: result<tuple<u64, list<string>>, error>",
|
|
298
|
-
"flag: bool",
|
|
299
|
-
]);
|
|
300
|
-
});
|
|
301
|
-
});
|
|
302
|
-
//# sourceMappingURL=utils.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.test.js","sourceRoot":"","sources":["../../../../../src/wit/wit-parser/core/utils.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAEhD,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,sBAAsB,GACvB,MAAM,YAAY,CAAC;AAGpB,MAAM,YAAY,GAAiB;IACjC,OAAO,EAAE;QACP,kBAAkB,EAAE;YAClB,EAAE,IAAI,EAAE,MAAM,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AC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,gDAAgD,EAAE,GAAG,EAAE;QAC1D,MAAM,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC,CAAC,iBAAiB;aACrD,OAAO,CAAC,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC,CAAC;IAC/B,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,8CAA8C,EAAE,GAAG,EAAE;QACxD,MAAM,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;QACpD,MAAM,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;IACvD,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,6BAA6B,EAAE,GAAG,EAAE;QACvC,MAAM,CAAC,GAAG,EAAE,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,kCAAkC;IACtF,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,wBAAwB,EAAE,GAAG,EAAE;QAClC,MAAM,CAAC,GAAG,EAAE,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;IAClD,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,+BAA+B,EAAE,GAAG,EAAE;QACzC,MAAM,KAAK,GACT,wFAAwF,CAAC;QAC3F,MAAM,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC;YACrC,2BAA2B;YAC3B,iDAAiD;YACjD,YAAY;SACb,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { InvalidWitParameterError } from "./core/errors/wit-parameter.js";
|
|
2
|
-
import { parseRecords } from "./core/records.js";
|
|
3
|
-
import { isRecordSignature } from "./core/signatures.js";
|
|
4
|
-
import { parseWitParameter as parseWitParameter_ } from "./core/utils.js";
|
|
5
|
-
export function parseWitParameter(param) {
|
|
6
|
-
let witParameter;
|
|
7
|
-
if (typeof param === "string")
|
|
8
|
-
witParameter = parseWitParameter_(param, {});
|
|
9
|
-
else {
|
|
10
|
-
const records = parseRecords(param);
|
|
11
|
-
const length = param.length;
|
|
12
|
-
for (let i = 0; i < length; i++) {
|
|
13
|
-
const signature = param[i];
|
|
14
|
-
if (isRecordSignature(signature))
|
|
15
|
-
continue;
|
|
16
|
-
witParameter = parseWitParameter_(signature, {
|
|
17
|
-
records: records,
|
|
18
|
-
});
|
|
19
|
-
break;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
if (!witParameter)
|
|
23
|
-
throw new InvalidWitParameterError({ param });
|
|
24
|
-
return witParameter;
|
|
25
|
-
}
|
|
26
|
-
//# sourceMappingURL=parse-wit-parameter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parse-wit-parameter.js","sourceRoot":"","sources":["../../../../src/wit/wit-parser/parse-wit-parameter.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAIzD,OAAO,EAAE,iBAAiB,IAAI,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAiC1E,MAAM,UAAU,iBAAiB,CAG/B,KAcG;IAEH,IAAI,YAAsC,CAAC;IAC3C,IAAI,OAAO,KAAK,KAAK,QAAQ;QAC3B,YAAY,GAAG,kBAAkB,CAAC,KAAK,EAAE,EAAE,CAA6B,CAAC;SACtE,CAAC;QACJ,MAAM,OAAO,GAAG,YAAY,CAAC,KAA0B,CAAC,CAAC;QACzD,MAAM,MAAM,GAAG,KAAK,CAAC,MAAgB,CAAC;QACtC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAChC,MAAM,SAAS,GAAI,KAA2B,CAAC,CAAC,CAAE,CAAC;YACnD,IAAI,iBAAiB,CAAC,SAAS,CAAC;gBAAE,SAAS;YAC3C,YAAY,GAAG,kBAAkB,CAAC,SAAS,EAAE;gBAC3C,OAAO,EAAE,OAAO;aACjB,CAAC,CAAC;YACH,MAAM;QACR,CAAC;IACH,CAAC;IAED,IAAI,CAAC,YAAY;QAAE,MAAM,IAAI,wBAAwB,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;IAEjE,OAAO,YAAwC,CAAC;AAClD,CAAC"}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { expectTypeOf, expect, test } from "vitest";
|
|
2
|
-
import { parseWitParameter } from "./parse-wit-parameter.js";
|
|
3
|
-
test("ParseWitParameter", () => {
|
|
4
|
-
expectTypeOf()
|
|
5
|
-
.toEqualTypeOf;
|
|
6
|
-
expectTypeOf().toEqualTypeOf();
|
|
7
|
-
expectTypeOf().toEqualTypeOf();
|
|
8
|
-
});
|
|
9
|
-
test("parseWitParameter", () => {
|
|
10
|
-
expect(() => parseWitParameter(" ")).toThrowErrorMatchingInlineSnapshot(`
|
|
11
|
-
[InvalidWitParameterError: Failed to parse Wit parameter.
|
|
12
|
-
|
|
13
|
-
Details: parseWitParameter(" ")
|
|
14
|
-
Version: kontor-2dk@1.0.0]
|
|
15
|
-
`);
|
|
16
|
-
});
|
|
17
|
-
test.each([
|
|
18
|
-
{
|
|
19
|
-
signature: "ctx: borrow<proc-context>",
|
|
20
|
-
expected: { name: "ctx", type: "borrow<proc-context>" },
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
signature: "arith-address: contract-address",
|
|
24
|
-
expected: { name: "arith-address", type: "contract-address" },
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
signature: [
|
|
28
|
-
"record contract-address { name: string, height: s64, tx-index: s64 }",
|
|
29
|
-
"arith-address: contract-address",
|
|
30
|
-
],
|
|
31
|
-
expected: {
|
|
32
|
-
name: "arith-address",
|
|
33
|
-
type: "tuple",
|
|
34
|
-
components: [
|
|
35
|
-
{
|
|
36
|
-
name: "name",
|
|
37
|
-
type: "string",
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
name: "height",
|
|
41
|
-
type: "s64",
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
name: "tx-index",
|
|
45
|
-
type: "s64",
|
|
46
|
-
},
|
|
47
|
-
],
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
signature: [
|
|
52
|
-
"record contract-address { name: string, height: s64, tx-index: s64 }",
|
|
53
|
-
"arith-address: result<contract-address, error>",
|
|
54
|
-
],
|
|
55
|
-
expected: {
|
|
56
|
-
name: "arith-address",
|
|
57
|
-
type: "result<tuple, error>",
|
|
58
|
-
components: [
|
|
59
|
-
{
|
|
60
|
-
name: "name",
|
|
61
|
-
type: "string",
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
name: "height",
|
|
65
|
-
type: "s64",
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
name: "tx-index",
|
|
69
|
-
type: "s64",
|
|
70
|
-
},
|
|
71
|
-
],
|
|
72
|
-
},
|
|
73
|
-
},
|
|
74
|
-
])("parseAbiParameter($signature)", ({ signature, expected }) => {
|
|
75
|
-
expect(parseWitParameter(signature)).toEqual(expected);
|
|
76
|
-
});
|
|
77
|
-
//# sourceMappingURL=parse-wit-parameter.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parse-wit-parameter.test.js","sourceRoot":"","sources":["../../../../src/wit/wit-parser/parse-wit-parameter.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAEpD,OAAO,EAAE,iBAAiB,EAAE,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IAAI,EAAE,KAAK;iBACZ;gBACD;oBACE,IAAI,EAAE,UAAU;oBAChB,IAAI,EAAE,KAAK;iBACZ;aACF;SACF;KACF;CACF,CAAC,CAAC,+BAA+B,EAAE,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,EAAE;IAC9D,MAAM,CAAC,iBAAiB,CAAoB,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC5E,CAAC,CAAC,CAAC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { isRecordSignature } from "./core/signatures.js";
|
|
2
|
-
import { parseRecords } from "./core/records.js";
|
|
3
|
-
import { parseSignature } from "./core/utils.js";
|
|
4
|
-
export function parseWit(signatures) {
|
|
5
|
-
const structs = parseRecords(signatures);
|
|
6
|
-
const wit = [];
|
|
7
|
-
const length = signatures.length;
|
|
8
|
-
for (let i = 0; i < length; i++) {
|
|
9
|
-
const signature = signatures[i];
|
|
10
|
-
if (isRecordSignature(signature))
|
|
11
|
-
continue;
|
|
12
|
-
wit.push(parseSignature(signature, structs));
|
|
13
|
-
}
|
|
14
|
-
return wit;
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=parse-wit.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parse-wit.js","sourceRoot":"","sources":["../../../../src/wit/wit-parser/parse-wit.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAyCjD,MAAM,UAAU,QAAQ,CACtB,UAI4B;IAE5B,MAAM,OAAO,GAAG,YAAY,CAAC,UAA+B,CAAC,CAAC;IAC9D,MAAM,GAAG,GAAG,EAAE,CAAC;IACf,MAAM,MAAM,GAAG,UAAU,CAAC,MAAgB,CAAC;IAC3C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAChC,MAAM,SAAS,GAAI,UAAgC,CAAC,CAAC,CAAE,CAAC;QACxD,IAAI,iBAAiB,CAAC,SAAS,CAAC;YAAE,SAAS;QAC3C,GAAG,CAAC,IAAI,CAAC,cAAc,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;IAC/C,CAAC;IACD,OAAO,GAAsC,CAAC;AAChD,CAAC"}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { expectTypeOf, describe, expect, test } from "vitest";
|
|
2
|
-
import { parseWit } from "./parse-wit.js";
|
|
3
|
-
test("ParseWit (types)", () => {
|
|
4
|
-
// type-level assertions
|
|
5
|
-
expectTypeOf().toEqualTypeOf();
|
|
6
|
-
expectTypeOf().toEqualTypeOf();
|
|
7
|
-
});
|
|
8
|
-
describe("parseWit (runtime)", () => {
|
|
9
|
-
test("parses proc + view functions and strips ctx from inputs", () => {
|
|
10
|
-
const input = [
|
|
11
|
-
// TODO: build in record defs should be defined under the hood
|
|
12
|
-
"record contract-address { name: string, height: s64, tx-index: s64 }",
|
|
13
|
-
"export fib: func(ctx: borrow<proc-context>, arith-address: contract-address, n: u64) -> u64;",
|
|
14
|
-
"export fib-of-sub: func(ctx: borrow<proc-context>, arith-address: contract-address, x: string, y: string) -> result<u64, error>;",
|
|
15
|
-
"export cached-values: func(ctx: borrow<view-context>) -> list<u64>;",
|
|
16
|
-
"export return-option: func(ctx: borrow<view-context>) -> option<u64>;",
|
|
17
|
-
];
|
|
18
|
-
const out = parseWit(input);
|
|
19
|
-
expect(out).toEqual([
|
|
20
|
-
{
|
|
21
|
-
name: "fib",
|
|
22
|
-
type: "function",
|
|
23
|
-
context: "proc",
|
|
24
|
-
inputs: [
|
|
25
|
-
{
|
|
26
|
-
name: "arith-address",
|
|
27
|
-
type: "tuple",
|
|
28
|
-
components: [
|
|
29
|
-
{ name: "name", type: "string" },
|
|
30
|
-
{ name: "height", type: "s64" },
|
|
31
|
-
{ name: "tx-index", type: "s64" },
|
|
32
|
-
],
|
|
33
|
-
},
|
|
34
|
-
{ name: "n", type: "u64" },
|
|
35
|
-
],
|
|
36
|
-
outputs: [{ type: "u64" }],
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
name: "fib-of-sub",
|
|
40
|
-
type: "function",
|
|
41
|
-
context: "proc",
|
|
42
|
-
inputs: [
|
|
43
|
-
{
|
|
44
|
-
name: "arith-address",
|
|
45
|
-
type: "tuple",
|
|
46
|
-
components: [
|
|
47
|
-
{ name: "name", type: "string" },
|
|
48
|
-
{ name: "height", type: "s64" },
|
|
49
|
-
{ name: "tx-index", type: "s64" },
|
|
50
|
-
],
|
|
51
|
-
},
|
|
52
|
-
{ name: "x", type: "string" },
|
|
53
|
-
{ name: "y", type: "string" },
|
|
54
|
-
],
|
|
55
|
-
outputs: [
|
|
56
|
-
{
|
|
57
|
-
type: "result<u64, error>",
|
|
58
|
-
},
|
|
59
|
-
],
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
name: "cached-values",
|
|
63
|
-
type: "function",
|
|
64
|
-
context: "view",
|
|
65
|
-
inputs: [],
|
|
66
|
-
outputs: [{ type: "list<u64>" }],
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
name: "return-option",
|
|
70
|
-
type: "function",
|
|
71
|
-
context: "view",
|
|
72
|
-
inputs: [],
|
|
73
|
-
outputs: [{ type: "option<u64>" }],
|
|
74
|
-
},
|
|
75
|
-
]);
|
|
76
|
-
});
|
|
77
|
-
});
|
|
78
|
-
//# sourceMappingURL=parse-wit.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parse-wit.test.js","sourceRoot":"","sources":["../../../../src/wit/wit-parser/parse-wit.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;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E,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE;4BAChC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE;4BAC/B,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,EAAE;yBAClC;qBACF;oBACD,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE;oBAC7B,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE;iBAC9B;gBACD,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,oBAAoB;qBAC3B;iBACF;aACF;YACD;gBACE,IAAI,EAAE,eAAe;gBACrB,IAAI,EAAE,UAAU;gBAChB,OAAO,EAAE,MAAM;gBACf,MAAM,EAAE,EAAE;gBACV,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;aACjC;YACD;gBACE,IAAI,EAAE,eAAe;gBACrB,IAAI,EAAE,UAAU;gBAChB,OAAO,EAAE,MAAM;gBACf,MAAM,EAAE,EAAE;gBACV,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;aACnC;SACF,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/dist/src/wit/wit.js
DELETED
package/dist/src/wit/wit.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"wit.js","sourceRoot":"","sources":["../../../src/wit/wit.ts"],"names":[],"mappings":""}
|
package/dist/src/wit/wit.test.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"wit.test.js","sourceRoot":"","sources":["../../../src/wit/wit.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAI1C,qBAAqB;AACrB,IAAI,CAAC,WAAW,EAAE,GAAG,EAAE;IACrB,UAAU,CAAW,OAAO,CAAC,CAAC;AAChC,CAAC,CAAC,CAAC"}
|
package/dist/test/globalSetup.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { dirname, resolve } from "node:path";
|
|
2
|
-
import { fileURLToPath } from "node:url";
|
|
3
|
-
import { setup } from "@arktype/attest";
|
|
4
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
5
|
-
const __dirname = dirname(__filename);
|
|
6
|
-
export default function () {
|
|
7
|
-
return setup({
|
|
8
|
-
benchErrorOnThresholdExceeded: true,
|
|
9
|
-
tsconfig: resolve(__dirname, "../tsconfig.json"),
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
// biome-ignore lint/performance/noBarrelFile: <explanation>
|
|
13
|
-
export { teardown } from "@arktype/attest";
|
|
14
|
-
//# sourceMappingURL=globalSetup.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"globalSetup.js","sourceRoot":"","sources":["../../test/globalSetup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAExC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAEtC,MAAM,CAAC,OAAO;IACb,OAAO,KAAK,CAAC;QACZ,6BAA6B,EAAE,IAAI;QACnC,QAAQ,EAAE,OAAO,CAAC,SAAS,EAAE,kBAAkB,CAAC;KAChD,CAAC,CAAC;AACJ,CAAC;AAED,4DAA4D;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC"}
|
package/dist/test/src/wits.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { parseWit } from "../../src/wit/wit-parser/parse-wit.js";
|
|
2
|
-
export const nativeTokenRaw = [
|
|
3
|
-
"record balance { acc: string, amt: decimal }",
|
|
4
|
-
"record transfer { src: string, dst: string, amt: decimal }",
|
|
5
|
-
"record burn { src: string, amt: decimal }",
|
|
6
|
-
"record mint { dst: string, amt: decimal }",
|
|
7
|
-
"export issuance: func(ctx: borrow<core-context>, amt: decimal) -> result<mint, error>;",
|
|
8
|
-
"export hold: func(ctx: borrow<core-context>, amt: decimal) -> result<transfer, error>;",
|
|
9
|
-
"export release: func(ctx: borrow<core-context>, burn-amt: decimal) -> result<burn, error>;",
|
|
10
|
-
"export init: func(ctx: borrow<proc-context>);",
|
|
11
|
-
"export mint: func(ctx: borrow<proc-context>, amt: decimal) -> result<mint, error>;",
|
|
12
|
-
"export burn: func(ctx: borrow<proc-context>, amt: decimal) -> result<burn, error>;",
|
|
13
|
-
"export transfer: func(ctx: borrow<proc-context>, dst: string, amt: decimal) -> result<transfer, error>;",
|
|
14
|
-
"export balance: func(ctx: borrow<view-context>, acc: string) -> option<decimal>;",
|
|
15
|
-
"export balances: func(ctx: borrow<view-context>) -> list<balance>;",
|
|
16
|
-
"export total-supply: func(ctx: borrow<view-context>) -> decimal;",
|
|
17
|
-
"export attach: func(ctx: borrow<proc-context>, vout: u64, amt: decimal) -> result<transfer, error>;",
|
|
18
|
-
"export detach: func(ctx: borrow<proc-context>) -> result<transfer, error>;",
|
|
19
|
-
];
|
|
20
|
-
export const nativeToken = parseWit(nativeTokenRaw);
|
|
21
|
-
//# sourceMappingURL=wits.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"wits.js","sourceRoot":"","sources":["../../../test/src/wits.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uCAAuC,CAAC;AAEjE,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,8CAA8C;IAC9C,4DAA4D;IAC5D,2CAA2C;IAC3C,2CAA2C;IAE3C,wFAAwF;IACxF,wFAAwF;IACxF,4FAA4F;IAC5F,+CAA+C;IAC/C,oFAAoF;IACpF,oFAAoF;IACpF,yGAAyG;IACzG,kFAAkF;IAClF,oEAAoE;IACpE,kEAAkE;IAClE,qGAAqG;IACrG,4EAA4E;CACpE,CAAC;AAEX,MAAM,CAAC,MAAM,WAAW,GAAG,QAAQ,CAAC,cAAc,CAAC,CAAC"}
|