@kontor/kontor-sdk 1.0.0-alpha.19 → 1.0.0-alpha.21

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.
Files changed (74) hide show
  1. package/dist/cjs/sdk/actions/kontor/public/call-view.js +1 -1
  2. package/dist/cjs/sdk/actions/kontor/public/call-view.js.map +1 -1
  3. package/dist/cjs/sdk/actions/kontor/public/view-contract.js +5 -3
  4. package/dist/cjs/sdk/actions/kontor/public/view-contract.js.map +1 -1
  5. package/dist/cjs/sdk/actions/kontor/wallet/sign-reveal.js +2 -6
  6. package/dist/cjs/sdk/actions/kontor/wallet/sign-reveal.js.map +1 -1
  7. package/dist/cjs/sdk/contracts/wits.js +0 -1
  8. package/dist/cjs/sdk/contracts/wits.js.map +1 -1
  9. package/dist/cjs/sdk/utils/wit/codecs/u64.js +56 -0
  10. package/dist/cjs/sdk/utils/wit/codecs/u64.js.map +1 -0
  11. package/dist/cjs/sdk/utils/wit/decode-wit-parameter.js +3 -0
  12. package/dist/cjs/sdk/utils/wit/decode-wit-parameter.js.map +1 -1
  13. package/dist/cjs/sdk/utils/wit/encode-wit-parameters.js +10 -0
  14. package/dist/cjs/sdk/utils/wit/encode-wit-parameters.js.map +1 -1
  15. package/dist/cjs/tsconfig.build.tsbuildinfo +1 -1
  16. package/dist/cjs/wit/wit-parser/core/utils.js +1 -0
  17. package/dist/cjs/wit/wit-parser/core/utils.js.map +1 -1
  18. package/dist/esm/sdk/actions/kontor/public/call-view.js +1 -1
  19. package/dist/esm/sdk/actions/kontor/public/call-view.js.map +1 -1
  20. package/dist/esm/sdk/actions/kontor/public/view-contract.js +7 -3
  21. package/dist/esm/sdk/actions/kontor/public/view-contract.js.map +1 -1
  22. package/dist/esm/sdk/actions/kontor/wallet/sign-reveal.js +2 -31
  23. package/dist/esm/sdk/actions/kontor/wallet/sign-reveal.js.map +1 -1
  24. package/dist/esm/sdk/contracts/wits.js +1 -1
  25. package/dist/esm/sdk/contracts/wits.js.map +1 -1
  26. package/dist/esm/sdk/utils/wit/codecs/u64.js +63 -0
  27. package/dist/esm/sdk/utils/wit/codecs/u64.js.map +1 -0
  28. package/dist/esm/sdk/utils/wit/decode-wit-parameter.js +3 -0
  29. package/dist/esm/sdk/utils/wit/decode-wit-parameter.js.map +1 -1
  30. package/dist/esm/sdk/utils/wit/encode-wit-parameters.js +11 -0
  31. package/dist/esm/sdk/utils/wit/encode-wit-parameters.js.map +1 -1
  32. package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
  33. package/dist/esm/wit/wit-parser/core/utils.js +1 -0
  34. package/dist/esm/wit/wit-parser/core/utils.js.map +1 -1
  35. package/dist/types/sdk/actions/kontor/public/call-view.d.ts +2 -11
  36. package/dist/types/sdk/actions/kontor/public/call-view.d.ts.map +1 -1
  37. package/dist/types/sdk/actions/kontor/public/view-contract.d.ts.map +1 -1
  38. package/dist/types/sdk/actions/kontor/wallet/sign-reveal.d.ts.map +1 -1
  39. package/dist/types/sdk/contracts/wits.d.ts +1 -1
  40. package/dist/types/sdk/contracts/wits.d.ts.map +1 -1
  41. package/dist/types/sdk/utils/wit/codecs/u64.d.ts +23 -0
  42. package/dist/types/sdk/utils/wit/codecs/u64.d.ts.map +1 -0
  43. package/dist/types/sdk/utils/wit/decode-wit-parameter.d.ts +1 -1
  44. package/dist/types/sdk/utils/wit/decode-wit-parameter.d.ts.map +1 -1
  45. package/dist/types/sdk/utils/wit/encode-wit-parameters.d.ts.map +1 -1
  46. package/dist/types/wit/wit-parser/core/types/utils.d.ts +4 -0
  47. package/dist/types/wit/wit-parser/core/types/utils.d.ts.map +1 -1
  48. package/dist/types/wit/wit-parser/core/utils.d.ts.map +1 -1
  49. package/package.json +1 -1
  50. package/src/exports/index.test.ts +18 -1
  51. package/src/sdk/actions/kontor/public/call-view.ts +6 -14
  52. package/src/sdk/actions/kontor/public/proc-contract.test.ts +1 -1
  53. package/src/sdk/actions/kontor/public/view-contract.test-d.ts +2 -17
  54. package/src/sdk/actions/kontor/public/view-contract.ts +8 -3
  55. package/src/sdk/actions/kontor/wallet/sign-reveal.ts +3 -35
  56. package/src/sdk/clients/base/create-rpc-client.test.ts +10 -4
  57. package/src/sdk/clients/create-public-client.test.ts +11 -3
  58. package/src/sdk/clients/kontor/create-public-client.test.ts +4 -3
  59. package/src/sdk/contracts/wits.ts +1 -1
  60. package/src/sdk/types/contract.test-d.ts +29 -24
  61. package/src/sdk/utils/wit/codecs/u64.ts +73 -0
  62. package/src/sdk/utils/wit/decode-wit-parameter.ts +5 -0
  63. package/src/sdk/utils/wit/encode-function-data.test-d.ts +15 -11
  64. package/src/sdk/utils/wit/encode-function-data.test.ts +1 -1
  65. package/src/sdk/utils/wit/encode-wit-parameters.ts +16 -1
  66. package/src/sdk/utils/wit/get-wit-item.test.ts +58 -9
  67. package/src/wit/wit-parser/core/records.test.ts +24 -14
  68. package/src/wit/wit-parser/core/types/records.test-d.ts +141 -28
  69. package/src/wit/wit-parser/core/types/utils.test-d.ts +23 -2
  70. package/src/wit/wit-parser/core/types/utils.ts +8 -41
  71. package/src/wit/wit-parser/core/utils.test.ts +14 -0
  72. package/src/wit/wit-parser/core/utils.ts +1 -0
  73. package/src/wit/wit-parser/parse-wit-parameter.test.ts +30 -3
  74. package/src/wit/wit-parser/parse-wit.test.ts +99 -102
@@ -0,0 +1,73 @@
1
+ // u64.ts
2
+ import * as z from "zod";
3
+ import type { WaveExpr, CodecInstance, CodecConstructor } from "./types.js";
4
+
5
+ // You already have this in integer.ts; you can import it from there instead
6
+ const U64_MAX = (1n << 64n) - 1n;
7
+ export const U64 = z
8
+ .bigint()
9
+ .min(0n, { message: "must be ≥ 0" })
10
+ .max(U64_MAX, { message: "must be ≤ 2^64-1" });
11
+
12
+ /**
13
+ * Parse a Wave expression for a u64.
14
+ *
15
+ * - Accepts optional underscores for readability: 1_000_000
16
+ * - Must be a non-negative integer
17
+ * - Enforces the u64 range via zod
18
+ */
19
+ export function parseU64WaveExpr(expr: string): bigint {
20
+ const trimmed = expr.trim();
21
+ if (!trimmed) throw new Error("empty u64 expression");
22
+
23
+ // Allow underscores like "1_000_000"
24
+ const normalized = trimmed.replace(/_/g, "");
25
+
26
+ if (!/^[0-9]+$/.test(normalized)) {
27
+ throw new Error(`invalid u64 literal: "${expr}"`);
28
+ }
29
+
30
+ const value = BigInt(normalized);
31
+ return U64.parse(value); // range-check via zod
32
+ }
33
+
34
+ // --- U64Codec ---------------------------------------------------
35
+
36
+ class _U64Codec implements CodecInstance<bigint> {
37
+ public readonly value: bigint;
38
+
39
+ constructor(value: bigint) {
40
+ this.value = U64.parse(value);
41
+ }
42
+
43
+ static fromJs(value: bigint | number | string): _U64Codec {
44
+ let v: bigint;
45
+ if (typeof value === "bigint") v = value;
46
+ else if (typeof value === "number") v = BigInt(value);
47
+ else v = BigInt(value); // e.g. JSON string "12345"
48
+
49
+ return new _U64Codec(v);
50
+ }
51
+
52
+ static fromKontor(data: string | bigint | number): _U64Codec {
53
+ return _U64Codec.fromJs(data);
54
+ }
55
+
56
+ static parseWave(expr: string): bigint {
57
+ return parseU64WaveExpr(expr);
58
+ }
59
+
60
+ toWave(): WaveExpr {
61
+ return `${this.value}` as WaveExpr;
62
+ }
63
+
64
+ toJs(): bigint {
65
+ return this.value;
66
+ }
67
+ }
68
+
69
+ export const U64Codec = _U64Codec as unknown as CodecConstructor<
70
+ bigint,
71
+ _U64Codec,
72
+ bigint
73
+ >;
@@ -1,6 +1,7 @@
1
1
  import type { WitParameter, WitType } from "../../../wit/wit.js";
2
2
  import { InvalidWitEncodingTypeError } from "../../errors/wit.js";
3
3
  import { DecimalCodec } from "./codecs/decimal.js";
4
+ import { U64Codec } from "./codecs/u64.js";
4
5
  import { StringCodec } from "./codecs/string.js";
5
6
  import { OptionCodecFactory } from "./codecs/option.js";
6
7
  import { ListCodecFactory } from "./codecs/list.js";
@@ -11,11 +12,14 @@ import {
11
12
  type WaveExpr,
12
13
  } from "./codecs/types.js";
13
14
 
15
+ const u64Decoder = makeDecoder(U64Codec);
16
+
14
17
  const stringDecoder = makeDecoder(StringCodec);
15
18
  const decimalDecoder = makeDecoder(DecimalCodec);
16
19
  const optionOfDecimalDecoder = makeDecoder(
17
20
  OptionCodecFactory.create(DecimalCodec),
18
21
  );
22
+
19
23
  const optionOfTupleDecoder = (param: WitParameter) =>
20
24
  makeDecoder(OptionCodecFactory.create(makeTupleCodecConstructor(param)));
21
25
 
@@ -95,6 +99,7 @@ function decoderForParam(p: WitParameter) {
95
99
  case "u16":
96
100
  case "u32":
97
101
  case "u64":
102
+ return u64Decoder;
98
103
  case "integer":
99
104
  case "option<string>":
100
105
  case "option<bool>":
@@ -4,8 +4,9 @@ import {
4
4
  encodeFunctionData,
5
5
  } from "./encode-function-data.js";
6
6
 
7
- import { nativeToken } from "~test/src/wits.js";
8
- import { parseWit } from "src/wit/wit-parser/parse-wit.js";
7
+ import { nativeToken } from "../../contracts/wits.js";
8
+
9
+ import { parseWit } from "../../../wit/wit-parser/parse-wit.js";
9
10
 
10
11
  test("single, function name not required", () => {
11
12
  const singleRaw = [
@@ -25,23 +26,26 @@ test("single, function name not required", () => {
25
26
  });
26
27
 
27
28
  test("native token", () => {
28
- // @ts-expect-error functionName required
29
- encodeFunctionData({ wit: nativeToken });
29
+ try {
30
+ // @ts-expect-error functionName required
31
+ encodeFunctionData({ wit: nativeToken });
32
+ } catch (e) {}
33
+
34
+ type P = EncodeFunctionDataParameters<typeof nativeToken.wit>;
30
35
 
31
- type P = EncodeFunctionDataParameters<typeof nativeToken>;
32
36
  expectTypeOf<P["functionName"]>().not.toEqualTypeOf<undefined>();
37
+
33
38
  expectTypeOf<P["functionName"]>().toEqualTypeOf<
39
+ | "mint"
34
40
  | "issuance"
41
+ | "balance"
42
+ | "transfer"
43
+ | "burn"
35
44
  | "hold"
36
45
  | "release"
37
- // | "init" // init is not valid
38
- | "mint"
39
- | "burn"
40
- | "transfer"
41
- | "balance"
42
46
  | "balances"
43
47
  | "total-supply"
44
- | "attach"
45
48
  | "detach"
49
+ // | "attach" // TODO: need to handle attach parsing
46
50
  >();
47
51
  });
@@ -119,5 +119,5 @@ test("attach", () => {
119
119
  functionName: "attach",
120
120
  args: [7n, [7n, 18]],
121
121
  }),
122
- ).toEqual(`attach()`);
122
+ ).toEqual("attach(7, {r0: 7, r1: 0, r2: 0, r3: 0, sign: plus})");
123
123
  });
@@ -8,6 +8,8 @@ import {
8
8
  InvalidWitEncodingTypeError,
9
9
  WitEncodingLengthMismatchError,
10
10
  } from "../../errors/wit.js";
11
+
12
+ import { U64Codec } from "./codecs/u64.js";
11
13
  import { DecimalCodec } from "./codecs/decimal.js";
12
14
  import { IntegerCodec } from "./codecs/integer.js";
13
15
  import { ListCodecFactory } from "./codecs/list.js";
@@ -35,7 +37,6 @@ export function encodeWitParameters<
35
37
  params: params as readonly WitParameter[],
36
38
  values: values as any,
37
39
  });
38
-
39
40
  const encoded = encodeParams(preparedParams);
40
41
 
41
42
  return encoded;
@@ -242,6 +243,14 @@ function prepareParam<const param extends WitParameter>({
242
243
  // if (param.type.startsWith("bytes")) {
243
244
  // return encodeBytes(value as unknown as Hex, { param });
244
245
  // }
246
+ //
247
+
248
+ console.log(param);
249
+
250
+ if (param.type === "u64") {
251
+ return encodeU64(value as unknown as bigint);
252
+ }
253
+
245
254
  if (param.type === "integer") {
246
255
  return encodeInteger(value as unknown as bigint);
247
256
  }
@@ -298,6 +307,12 @@ export function getResultComponentsStrict(
298
307
  return [okType, "error"];
299
308
  }
300
309
 
310
+ function encodeU64(value: bigint): PreparedParam {
311
+ return {
312
+ encoded: U64Codec.fromJs(value).toWave(),
313
+ };
314
+ }
315
+
301
316
  function encodeInteger(value: bigint): PreparedParam {
302
317
  return {
303
318
  encoded: IntegerCodec.fromJs(value).toWave(),
@@ -32,8 +32,19 @@ describe("getWitItem", () => {
32
32
  name: "mint",
33
33
  type: "function",
34
34
  context: "proc",
35
- inputs: [{ type: "decimal", name: "n" }],
36
- outputs: [{ type: "result<_, error>" }],
35
+ inputs: [
36
+ {
37
+ internalType: "decimal",
38
+ type: "decimal",
39
+ name: "n",
40
+ },
41
+ ],
42
+ outputs: [
43
+ {
44
+ internalType: "result<_, error>",
45
+ type: "result<_, error>",
46
+ },
47
+ ],
37
48
  });
38
49
  });
39
50
  test("selects burn function by name", () => {
@@ -46,8 +57,19 @@ describe("getWitItem", () => {
46
57
  name: "burn",
47
58
  type: "function",
48
59
  context: "proc",
49
- inputs: [{ type: "decimal", name: "n" }],
50
- outputs: [{ type: "result<_, error>" }],
60
+ inputs: [
61
+ {
62
+ internalType: "decimal",
63
+ type: "decimal",
64
+ name: "n",
65
+ },
66
+ ],
67
+ outputs: [
68
+ {
69
+ internalType: "result<_, error>",
70
+ type: "result<_, error>",
71
+ },
72
+ ],
51
73
  });
52
74
  });
53
75
  test("selects transfer function by name", () => {
@@ -61,10 +83,23 @@ describe("getWitItem", () => {
61
83
  type: "function",
62
84
  context: "proc",
63
85
  inputs: [
64
- { type: "string", name: "to" },
65
- { type: "decimal", name: "n" },
86
+ {
87
+ internalType: "string",
88
+ type: "string",
89
+ name: "to",
90
+ },
91
+ {
92
+ internalType: "decimal",
93
+ type: "decimal",
94
+ name: "n",
95
+ },
96
+ ],
97
+ outputs: [
98
+ {
99
+ internalType: "result<_, error>",
100
+ type: "result<_, error>",
101
+ },
66
102
  ],
67
- outputs: [{ type: "result<_, error>" }],
68
103
  });
69
104
  });
70
105
 
@@ -78,8 +113,19 @@ describe("getWitItem", () => {
78
113
  name: "balance",
79
114
  type: "function",
80
115
  context: "view",
81
- inputs: [{ type: "string", name: "acc" }],
82
- outputs: [{ type: "option<decimal>" }],
116
+ inputs: [
117
+ {
118
+ internalType: "string",
119
+ type: "string",
120
+ name: "acc",
121
+ },
122
+ ],
123
+ outputs: [
124
+ {
125
+ internalType: "option<decimal>",
126
+ type: "option<decimal>",
127
+ },
128
+ ],
83
129
  });
84
130
  });
85
131
 
@@ -97,12 +143,15 @@ describe("getWitItem", () => {
97
143
  outputs: [
98
144
  {
99
145
  type: "list<tuple>",
146
+ internalType: "list<balance>",
100
147
  components: [
101
148
  {
149
+ internalType: "string",
102
150
  name: "key",
103
151
  type: "string",
104
152
  },
105
153
  {
154
+ internalType: "decimal",
106
155
  name: "value",
107
156
  type: "decimal",
108
157
  },
@@ -9,27 +9,29 @@ test("parse records", () => {
9
9
  ]),
10
10
  ).toEqual({
11
11
  "contract-address": [
12
- { name: "name", type: "string" },
13
- { name: "height", type: "s64" },
14
- { name: "tx-index", type: "s64" },
12
+ { name: "name", type: "string", internalType: "string" },
13
+ { name: "height", type: "s64", internalType: "s64" },
14
+ { name: "tx-index", type: "s64", internalType: "s64" },
15
15
  ],
16
16
  "token-pair": [
17
17
  {
18
18
  type: "tuple",
19
19
  name: "a",
20
+ internalType: "contract-address",
20
21
  components: [
21
- { name: "name", type: "string" },
22
- { name: "height", type: "s64" },
23
- { name: "tx-index", type: "s64" },
22
+ { name: "name", type: "string", internalType: "string" },
23
+ { name: "height", type: "s64", internalType: "s64" },
24
+ { name: "tx-index", type: "s64", internalType: "s64" },
24
25
  ],
25
26
  },
26
27
  {
27
28
  type: "tuple",
28
29
  name: "b",
30
+ internalType: "contract-address",
29
31
  components: [
30
- { name: "name", type: "string" },
31
- { name: "height", type: "s64" },
32
- { name: "tx-index", type: "s64" },
32
+ { name: "name", type: "string", internalType: "string" },
33
+ { name: "height", type: "s64", internalType: "s64" },
34
+ { name: "tx-index", type: "s64", internalType: "s64" },
33
35
  ],
34
36
  },
35
37
  ],
@@ -38,7 +40,9 @@ test("parse records", () => {
38
40
 
39
41
  test("generic", () => {
40
42
  expect(parseRecords(["record generic { values: list<string> }"])).toEqual({
41
- generic: [{ name: "values", type: "list<string>" }],
43
+ generic: [
44
+ { name: "values", type: "list<string>", internalType: "list<string>" },
45
+ ],
42
46
  });
43
47
  });
44
48
 
@@ -50,10 +54,16 @@ test("generic", () => {
50
54
  ]),
51
55
  ).toEqual({
52
56
  "contract-address": [
53
- { type: "string", name: "name" },
54
- { type: "s64", name: "height" },
55
- { type: "s64", name: "tx-index" },
57
+ { name: "name", type: "string", internalType: "string" },
58
+ { name: "height", type: "s64", internalType: "s64" },
59
+ { name: "tx-index", type: "s64", internalType: "s64" },
60
+ ],
61
+ generic: [
62
+ {
63
+ name: "values",
64
+ type: "list<contract-address>",
65
+ internalType: "list<contract-address>",
66
+ },
56
67
  ],
57
- generic: [{ name: "values", type: "list<contract-address>" }],
58
68
  });
59
69
  });
@@ -1,5 +1,6 @@
1
1
  import { expectTypeOf, test } from "vitest";
2
2
 
3
+ // TODO: audit discrepancies in this whole file
3
4
  import type {
4
5
  ParseRecords,
5
6
  ParseRecord,
@@ -25,28 +26,65 @@ test("ParseRecords", () => {
25
26
  >
26
27
  >().toEqualTypeOf<{
27
28
  "contract-address": readonly [
28
- { readonly name: "name"; readonly type: "string" },
29
- { readonly name: "height"; readonly type: "s64" },
30
- { readonly name: "tx-index"; readonly type: "s64" },
29
+ {
30
+ readonly name: "name";
31
+ readonly type: "string";
32
+ readonly internalType: "string";
33
+ },
34
+ {
35
+ readonly name: "height";
36
+ readonly type: "s64";
37
+ readonly internalType: "s64";
38
+ },
39
+ {
40
+ readonly name: "tx-index";
41
+ readonly type: "s64";
42
+ readonly internalType: "s64";
43
+ },
31
44
  ];
32
45
 
33
46
  "token-pair": readonly [
34
47
  {
35
48
  readonly type: "tuple";
36
49
  readonly name: "a";
50
+ // TODO: should include internalType
37
51
  readonly components: readonly [
38
- { readonly name: "name"; readonly type: "string" },
39
- { readonly name: "height"; readonly type: "s64" },
40
- { readonly name: "tx-index"; readonly type: "s64" },
52
+ {
53
+ readonly name: "name";
54
+ readonly type: "string";
55
+ readonly internalType: "string";
56
+ },
57
+ {
58
+ readonly name: "height";
59
+ readonly type: "s64";
60
+ readonly internalType: "s64";
61
+ },
62
+ {
63
+ readonly name: "tx-index";
64
+ readonly type: "s64";
65
+ readonly internalType: "s64";
66
+ },
41
67
  ];
42
68
  },
43
69
  {
44
70
  readonly type: "tuple";
45
71
  readonly name: "b";
46
72
  readonly components: readonly [
47
- { readonly name: "name"; readonly type: "string" },
48
- { readonly name: "height"; readonly type: "s64" },
49
- { readonly name: "tx-index"; readonly type: "s64" },
73
+ {
74
+ readonly name: "name";
75
+ readonly type: "string";
76
+ readonly internalType: "string";
77
+ },
78
+ {
79
+ readonly name: "height";
80
+ readonly type: "s64";
81
+ readonly internalType: "s64";
82
+ },
83
+ {
84
+ readonly name: "tx-index";
85
+ readonly type: "s64";
86
+ readonly internalType: "s64";
87
+ },
50
88
  ];
51
89
  },
52
90
  ];
@@ -60,9 +98,21 @@ test("ParseRecords", () => {
60
98
  >
61
99
  >().toEqualTypeOf<{
62
100
  "contract-address": readonly [
63
- { readonly name: "name"; readonly type: "string" },
64
- { readonly name: "height"; readonly type: "s64" },
65
- { readonly name: "tx-index"; readonly type: "s64" },
101
+ {
102
+ readonly name: "name";
103
+ readonly type: "string";
104
+ readonly internalType: "string";
105
+ },
106
+ {
107
+ readonly name: "height";
108
+ readonly type: "s64";
109
+ readonly internalType: "s64";
110
+ },
111
+ {
112
+ readonly name: "tx-index";
113
+ readonly type: "s64";
114
+ readonly internalType: "s64";
115
+ },
66
116
  ];
67
117
 
68
118
  "token-pair": readonly [
@@ -95,9 +145,21 @@ test("ParseRecord", () => {
95
145
  >().toEqualTypeOf<{
96
146
  readonly name: "contract-address";
97
147
  readonly components: [
98
- { readonly name: "name"; readonly type: "string" },
99
- { readonly name: "height"; readonly type: "s64" },
100
- { readonly name: "tx-index"; readonly type: "s64" },
148
+ {
149
+ readonly name: "name";
150
+ readonly type: "string";
151
+ readonly internalType: "string";
152
+ },
153
+ {
154
+ readonly name: "height";
155
+ readonly type: "s64";
156
+ readonly internalType: "s64";
157
+ },
158
+ {
159
+ readonly name: "tx-index";
160
+ readonly type: "s64";
161
+ readonly internalType: "s64";
162
+ },
101
163
  ];
102
164
  }>();
103
165
 
@@ -106,8 +168,16 @@ test("ParseRecord", () => {
106
168
  >().toEqualTypeOf<{
107
169
  readonly name: "token-pair";
108
170
  readonly components: [
109
- { readonly name: "a"; readonly type: "contract-address" },
110
- { readonly name: "b"; readonly type: "contract-address" },
171
+ {
172
+ readonly name: "a";
173
+ readonly type: "contract-address";
174
+ readonly internalType: "contract-address";
175
+ },
176
+ {
177
+ readonly name: "b";
178
+ readonly type: "contract-address";
179
+ readonly internalType: "contract-address";
180
+ },
111
181
  ];
112
182
  }>();
113
183
 
@@ -122,19 +192,40 @@ test("ParseRecord", () => {
122
192
  {
123
193
  readonly type: "tuple";
124
194
  readonly name: "a";
195
+ readonly internalType: "contract-address";
125
196
  readonly components: readonly [
126
- { readonly name: "name"; readonly type: "string" },
127
- { readonly name: "height"; readonly type: "s64" },
128
- { readonly name: "tx-index"; readonly type: "s64" },
197
+ {
198
+ // TODO: why aren't we getting internalType here
199
+ readonly name: "name";
200
+ readonly type: "string";
201
+ },
202
+ {
203
+ readonly name: "height";
204
+ readonly type: "s64";
205
+ },
206
+ {
207
+ readonly name: "tx-index";
208
+ readonly type: "s64";
209
+ },
129
210
  ];
130
211
  },
131
212
  {
132
213
  readonly type: "tuple";
133
214
  readonly name: "b";
215
+ readonly internalType: "contract-address";
134
216
  readonly components: readonly [
135
- { readonly name: "name"; readonly type: "string" },
136
- { readonly name: "height"; readonly type: "s64" },
137
- { readonly name: "tx-index"; readonly type: "s64" },
217
+ {
218
+ readonly name: "name";
219
+ readonly type: "string";
220
+ },
221
+ {
222
+ readonly name: "height";
223
+ readonly type: "s64";
224
+ },
225
+ {
226
+ readonly name: "tx-index";
227
+ readonly type: "s64";
228
+ },
138
229
  ];
139
230
  },
140
231
  ];
@@ -146,9 +237,21 @@ test("ParseRecordProperties", () => {
146
237
  ParseRecordProperties<"name: string, height: s64, tx-index: s64">
147
238
  >().toEqualTypeOf<
148
239
  [
149
- { readonly name: "name"; readonly type: "string" },
150
- { readonly name: "height"; readonly type: "s64" },
151
- { readonly name: "tx-index"; readonly type: "s64" },
240
+ {
241
+ readonly name: "name";
242
+ readonly type: "string";
243
+ readonly internalType: "string";
244
+ },
245
+ {
246
+ readonly name: "height";
247
+ readonly type: "s64";
248
+ readonly internalType: "s64";
249
+ },
250
+ {
251
+ readonly name: "tx-index";
252
+ readonly type: "s64";
253
+ readonly internalType: "s64";
254
+ },
152
255
  ]
153
256
  >();
154
257
 
@@ -156,8 +259,16 @@ test("ParseRecordProperties", () => {
156
259
  ParseRecordProperties<"a: contract-address, b: contract-address">
157
260
  >().toEqualTypeOf<
158
261
  [
159
- { readonly name: "a"; readonly type: "contract-address" },
160
- { readonly name: "b"; readonly type: "contract-address" },
262
+ {
263
+ readonly name: "a";
264
+ readonly type: "contract-address";
265
+ readonly internalType: "contract-address";
266
+ },
267
+ {
268
+ readonly name: "b";
269
+ readonly type: "contract-address";
270
+ readonly internalType: "contract-address";
271
+ },
161
272
  ]
162
273
  >();
163
274
 
@@ -168,6 +279,7 @@ test("ParseRecordProperties", () => {
168
279
  {
169
280
  readonly type: "tuple";
170
281
  readonly name: "a";
282
+ readonly internalType: "contract-address";
171
283
  readonly components: readonly [
172
284
  { readonly name: "name"; readonly type: "string" },
173
285
  { readonly name: "height"; readonly type: "s64" },
@@ -177,6 +289,7 @@ test("ParseRecordProperties", () => {
177
289
  {
178
290
  readonly type: "tuple";
179
291
  readonly name: "b";
292
+ readonly internalType: "contract-address";
180
293
  readonly components: readonly [
181
294
  { readonly name: "name"; readonly type: "string" },
182
295
  { readonly name: "height"; readonly type: "s64" },