@ckb-ccc/core 0.0.2-alpha.2 → 0.0.2

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 (185) hide show
  1. package/.prettierignore +12 -0
  2. package/dist/address/address.advanced.d.ts +29 -3
  3. package/dist/address/address.advanced.d.ts.map +1 -1
  4. package/dist/address/address.advanced.js +70 -28
  5. package/dist/address/advanced.d.ts +1 -28
  6. package/dist/address/advanced.d.ts.map +1 -1
  7. package/dist/address/advanced.js +1 -75
  8. package/dist/address/index.d.ts +10 -13
  9. package/dist/address/index.d.ts.map +1 -1
  10. package/dist/address/index.js +21 -25
  11. package/dist/advanced.js +2 -31
  12. package/dist/advancedBarrel.d.ts +1 -0
  13. package/dist/advancedBarrel.d.ts.map +1 -1
  14. package/dist/advancedBarrel.js +4 -19
  15. package/dist/barrel.d.ts +4 -2
  16. package/dist/barrel.d.ts.map +1 -1
  17. package/dist/barrel.js +10 -24
  18. package/dist/bytes/index.d.ts +7 -0
  19. package/dist/bytes/index.d.ts.map +1 -0
  20. package/dist/bytes/index.js +34 -0
  21. package/dist/ckb/advanced.d.ts +3 -2
  22. package/dist/ckb/advanced.d.ts.map +1 -1
  23. package/dist/ckb/advanced.js +3 -18
  24. package/dist/ckb/index.d.ts +2 -3
  25. package/dist/ckb/index.d.ts.map +1 -1
  26. package/dist/ckb/index.js +2 -19
  27. package/dist/ckb/molecule.advanced/generated.d.ts.map +1 -0
  28. package/dist/ckb/{types/molecule.advanced → molecule.advanced}/generated.js +444 -231
  29. package/dist/ckb/molecule.advanced/index.d.ts +6 -0
  30. package/dist/ckb/molecule.advanced/index.d.ts.map +1 -0
  31. package/dist/ckb/molecule.advanced/index.js +7 -0
  32. package/dist/ckb/{types/script.advanced.d.ts → script.advanced.d.ts} +1 -0
  33. package/dist/ckb/script.advanced.d.ts.map +1 -0
  34. package/dist/ckb/script.advanced.js +13 -0
  35. package/dist/ckb/script.d.ts +29 -0
  36. package/dist/ckb/script.d.ts.map +1 -0
  37. package/dist/ckb/script.js +61 -0
  38. package/dist/ckb/{types/transaction.advanced.d.ts → transaction.advanced.d.ts} +1 -0
  39. package/dist/ckb/transaction.advanced.d.ts.map +1 -0
  40. package/dist/ckb/transaction.advanced.js +9 -0
  41. package/dist/ckb/transaction.d.ts +142 -0
  42. package/dist/ckb/transaction.d.ts.map +1 -0
  43. package/dist/ckb/transaction.js +227 -0
  44. package/dist/client/advanced.js +2 -18
  45. package/dist/client/client.d.ts +5 -4
  46. package/dist/client/client.d.ts.map +1 -1
  47. package/dist/client/client.js +2 -5
  48. package/dist/client/clientPublicMainnet.advanced.d.ts +2 -2
  49. package/dist/client/clientPublicMainnet.advanced.d.ts.map +1 -1
  50. package/dist/client/clientPublicMainnet.advanced.js +7 -10
  51. package/dist/client/clientPublicMainnet.d.ts +2 -2
  52. package/dist/client/clientPublicMainnet.d.ts.map +1 -1
  53. package/dist/client/clientPublicMainnet.js +4 -8
  54. package/dist/client/clientPublicTestnet.advanced.d.ts +2 -2
  55. package/dist/client/clientPublicTestnet.advanced.d.ts.map +1 -1
  56. package/dist/client/clientPublicTestnet.advanced.js +7 -10
  57. package/dist/client/clientPublicTestnet.d.ts +2 -2
  58. package/dist/client/clientPublicTestnet.d.ts.map +1 -1
  59. package/dist/client/clientPublicTestnet.js +4 -8
  60. package/dist/client/clientTypes.js +1 -2
  61. package/dist/client/index.js +4 -20
  62. package/dist/client/jsonRpc/advanced.d.ts +36 -36
  63. package/dist/client/jsonRpc/advanced.d.ts.map +1 -1
  64. package/dist/client/jsonRpc/advanced.js +13 -17
  65. package/dist/client/jsonRpc/index.d.ts.map +1 -1
  66. package/dist/client/jsonRpc/index.js +5 -13
  67. package/dist/fixedPoint/index.d.ts +7 -0
  68. package/dist/fixedPoint/index.d.ts.map +1 -0
  69. package/dist/fixedPoint/index.js +22 -0
  70. package/dist/{ckb/hasher.advanced.d.ts → hasher/advanced.d.ts} +1 -1
  71. package/dist/hasher/advanced.d.ts.map +1 -0
  72. package/dist/{ckb/hasher.d.ts → hasher/index.d.ts} +3 -2
  73. package/dist/hasher/index.d.ts.map +1 -0
  74. package/dist/hasher/index.js +18 -0
  75. package/dist/hex/index.d.ts +5 -0
  76. package/dist/hex/index.d.ts.map +1 -0
  77. package/dist/hex/index.js +5 -0
  78. package/dist/index.js +2 -31
  79. package/dist/num/index.d.ts +13 -0
  80. package/dist/num/index.d.ts.map +1 -0
  81. package/dist/num/index.js +36 -0
  82. package/dist/signer/helpers.d.ts +3 -3
  83. package/dist/signer/helpers.d.ts.map +1 -1
  84. package/dist/signer/helpers.js +9 -10
  85. package/dist/signer/index.d.ts +2 -0
  86. package/dist/signer/index.d.ts.map +1 -1
  87. package/dist/signer/index.js +4 -18
  88. package/dist/signer/signer.d.ts +12 -3
  89. package/dist/signer/signer.d.ts.map +1 -1
  90. package/dist/signer/signer.js +13 -6
  91. package/dist/signer/signerReadonly.d.ts +8 -0
  92. package/dist/signer/signerReadonly.d.ts.map +1 -0
  93. package/dist/signer/signerReadonly.js +9 -0
  94. package/dist/{ckb/viewerCkbScript.d.ts → signer/signerReadonlyCkbScript.d.ts} +6 -5
  95. package/dist/signer/signerReadonlyCkbScript.d.ts.map +1 -0
  96. package/dist/signer/signerReadonlyCkbScript.js +17 -0
  97. package/dist/utils/index.d.ts +7 -0
  98. package/dist/utils/index.d.ts.map +1 -0
  99. package/dist/utils/index.js +6 -0
  100. package/package.json +5 -3
  101. package/src/address/address.advanced.ts +76 -19
  102. package/src/address/advanced.ts +1 -59
  103. package/src/address/index.ts +46 -28
  104. package/src/advancedBarrel.ts +1 -0
  105. package/src/barrel.ts +4 -2
  106. package/src/bytes/index.ts +46 -0
  107. package/src/ckb/advanced.ts +3 -2
  108. package/src/ckb/index.ts +2 -3
  109. package/src/ckb/{types/molecule.advanced → molecule.advanced}/generated.d.ts +18 -7
  110. package/src/ckb/{types/molecule.advanced → molecule.advanced}/generated.js +551 -123
  111. package/src/ckb/molecule.advanced/index.ts +11 -0
  112. package/src/ckb/{types/script.advanced.ts → script.advanced.ts} +1 -0
  113. package/src/ckb/script.ts +94 -0
  114. package/src/ckb/{types/transaction.advanced.ts → transaction.advanced.ts} +1 -0
  115. package/src/ckb/transaction.ts +357 -0
  116. package/src/client/client.ts +6 -4
  117. package/src/client/clientPublicMainnet.advanced.ts +2 -2
  118. package/src/client/clientPublicMainnet.ts +2 -2
  119. package/src/client/clientPublicTestnet.advanced.ts +2 -2
  120. package/src/client/clientPublicTestnet.ts +2 -2
  121. package/src/client/clientTypes.ts +1 -1
  122. package/src/client/jsonRpc/advanced.ts +25 -25
  123. package/src/client/jsonRpc/index.ts +1 -3
  124. package/src/fixedPoint/index.ts +30 -0
  125. package/src/hasher/advanced.ts +1 -0
  126. package/src/{ckb/hasher.ts → hasher/index.ts} +5 -5
  127. package/src/hex/index.ts +9 -0
  128. package/src/index.ts +1 -1
  129. package/src/num/index.ts +53 -0
  130. package/src/signer/helpers.ts +9 -6
  131. package/src/signer/index.ts +3 -1
  132. package/src/signer/signer.ts +23 -3
  133. package/src/signer/signerReadonly.ts +13 -0
  134. package/src/{ckb/viewerCkbScript.ts → signer/signerReadonlyCkbScript.ts} +8 -4
  135. package/src/utils/index.ts +28 -0
  136. package/dist/bytes.d.ts +0 -15
  137. package/dist/bytes.d.ts.map +0 -1
  138. package/dist/bytes.js +0 -114
  139. package/dist/ckb/hasher.advanced.d.ts.map +0 -1
  140. package/dist/ckb/hasher.advanced.js +0 -4
  141. package/dist/ckb/hasher.d.ts.map +0 -1
  142. package/dist/ckb/hasher.js +0 -26
  143. package/dist/ckb/types/advanced.d.ts +0 -4
  144. package/dist/ckb/types/advanced.d.ts.map +0 -1
  145. package/dist/ckb/types/advanced.js +0 -32
  146. package/dist/ckb/types/index.d.ts +0 -3
  147. package/dist/ckb/types/index.d.ts.map +0 -1
  148. package/dist/ckb/types/index.js +0 -18
  149. package/dist/ckb/types/molecule.advanced/generated.d.ts.map +0 -1
  150. package/dist/ckb/types/molecule.advanced/index.d.ts +0 -2
  151. package/dist/ckb/types/molecule.advanced/index.d.ts.map +0 -1
  152. package/dist/ckb/types/molecule.advanced/index.js +0 -17
  153. package/dist/ckb/types/script.advanced.d.ts.map +0 -1
  154. package/dist/ckb/types/script.advanced.js +0 -15
  155. package/dist/ckb/types/script.d.ts +0 -26
  156. package/dist/ckb/types/script.d.ts.map +0 -1
  157. package/dist/ckb/types/script.js +0 -75
  158. package/dist/ckb/types/transaction.advanced.d.ts.map +0 -1
  159. package/dist/ckb/types/transaction.advanced.js +0 -11
  160. package/dist/ckb/types/transaction.d.ts +0 -127
  161. package/dist/ckb/types/transaction.d.ts.map +0 -1
  162. package/dist/ckb/types/transaction.js +0 -266
  163. package/dist/ckb/viewerCkbScript.d.ts.map +0 -1
  164. package/dist/ckb/viewerCkbScript.js +0 -18
  165. package/dist/fixedPoint.d.ts +0 -9
  166. package/dist/fixedPoint.d.ts.map +0 -1
  167. package/dist/fixedPoint.js +0 -30
  168. package/dist/primitive.d.ts +0 -5
  169. package/dist/primitive.d.ts.map +0 -1
  170. package/dist/primitive.js +0 -2
  171. package/dist/viewer.d.ts +0 -12
  172. package/dist/viewer.d.ts.map +0 -1
  173. package/dist/viewer.js +0 -19
  174. package/src/bytes.ts +0 -127
  175. package/src/ckb/types/advanced.ts +0 -3
  176. package/src/ckb/types/index.ts +0 -2
  177. package/src/ckb/types/molecule.advanced/index.ts +0 -1
  178. package/src/ckb/types/script.ts +0 -70
  179. package/src/ckb/types/transaction.ts +0 -366
  180. package/src/fixedPoint.ts +0 -53
  181. package/src/primitive.ts +0 -8
  182. package/src/viewer.ts +0 -22
  183. /package/dist/ckb/{types/molecule.advanced → molecule.advanced}/generated.d.ts +0 -0
  184. /package/{src/ckb/hasher.advanced.ts → dist/hasher/advanced.js} +0 -0
  185. /package/src/ckb/{types/molecule.advanced → molecule.advanced}/blockchain.mol +0 -0
@@ -0,0 +1,6 @@
1
+ export * from "./generated";
2
+ export declare function molOptional<T>(mol: {
3
+ hasValue: () => boolean;
4
+ value: () => T;
5
+ }): T | undefined;
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ckb/molecule.advanced/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAE5B,wBAAgB,WAAW,CAAC,CAAC,EAAE,GAAG,EAAE;IAClC,QAAQ,EAAE,MAAM,OAAO,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC,CAAC;CAChB,GAAG,CAAC,GAAG,SAAS,CAKhB"}
@@ -0,0 +1,7 @@
1
+ export * from "./generated";
2
+ export function molOptional(mol) {
3
+ if (mol.hasValue()) {
4
+ return mol.value();
5
+ }
6
+ return;
7
+ }
@@ -1,4 +1,5 @@
1
1
  import { type HashType } from "./script";
2
2
  export declare const HASH_TYPE_TO_NUM: Record<HashType, number>;
3
3
  export declare const NUM_TO_HASH_TYPE: Record<number, HashType>;
4
+ export declare const HASH_TYPES: string[];
4
5
  //# sourceMappingURL=script.advanced.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"script.advanced.d.ts","sourceRoot":"","sources":["../../src/ckb/script.advanced.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEzC,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CAKrD,CAAC;AACF,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAKrD,CAAC;AACF,eAAO,MAAM,UAAU,EAAE,MAAM,EAAkC,CAAC"}
@@ -0,0 +1,13 @@
1
+ export const HASH_TYPE_TO_NUM = {
2
+ type: 0x01,
3
+ data: 0x00,
4
+ data1: 0x02,
5
+ data2: 0x04,
6
+ };
7
+ export const NUM_TO_HASH_TYPE = {
8
+ 0x01: "type",
9
+ 0x00: "data",
10
+ 0x02: "data1",
11
+ 0x04: "data2",
12
+ };
13
+ export const HASH_TYPES = Object.keys(HASH_TYPE_TO_NUM);
@@ -0,0 +1,29 @@
1
+ import { Bytes, BytesLike } from "../bytes";
2
+ import { Hex } from "../hex";
3
+ import * as mol from "./molecule.advanced";
4
+ export type HashTypeLike = string | number | bigint;
5
+ export type HashType = "type" | "data" | "data1" | "data2";
6
+ export declare function hashTypeFrom(val: HashTypeLike): HashType;
7
+ export declare function hashTypeToBytes(hashType: HashType): Bytes;
8
+ export declare function hashTypeFromBytes(bytes: BytesLike): HashType;
9
+ export type ScriptLike = {
10
+ codeHash: BytesLike;
11
+ hashType: HashTypeLike;
12
+ args: BytesLike;
13
+ };
14
+ export declare class Script {
15
+ codeHash: Hex;
16
+ hashType: HashType;
17
+ args: Hex;
18
+ constructor(codeHash: Hex, hashType: HashType, args: Hex);
19
+ static from(script: ScriptLike): Script;
20
+ _toMolData(): {
21
+ codeHash: Uint8Array;
22
+ hashType: Uint8Array;
23
+ args: Uint8Array;
24
+ };
25
+ toBytes(): Bytes;
26
+ static fromBytes(bytes: BytesLike | mol.Script): Script;
27
+ eq(val: ScriptLike): boolean;
28
+ }
29
+ //# sourceMappingURL=script.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"script.d.ts","sourceRoot":"","sources":["../../src/ckb/script.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAa,MAAM,UAAU,CAAC;AACvD,OAAO,EAAE,GAAG,EAAW,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAO3C,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AACpD,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;AAC3D,wBAAgB,YAAY,CAAC,GAAG,EAAE,YAAY,GAAG,QAAQ,CAmBxD;AACD,wBAAgB,eAAe,CAAC,QAAQ,EAAE,QAAQ,GAAG,KAAK,CAEzD;AACD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,SAAS,GAAG,QAAQ,CAE5D;AAED,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,EAAE,SAAS,CAAC;IACpB,QAAQ,EAAE,YAAY,CAAC;IACvB,IAAI,EAAE,SAAS,CAAC;CACjB,CAAC;AACF,qBAAa,MAAM;IAER,QAAQ,EAAE,GAAG;IACb,QAAQ,EAAE,QAAQ;IAClB,IAAI,EAAE,GAAG;gBAFT,QAAQ,EAAE,GAAG,EACb,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,GAAG;IAGlB,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM;IAYvC,UAAU;;;;;IAQV,OAAO,IAAI,KAAK;IAIhB,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,SAAS,GAAG,GAAG,CAAC,MAAM,GAAG,MAAM;IAWvD,EAAE,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO;CAQ7B"}
@@ -0,0 +1,61 @@
1
+ import { bytesFrom } from "../bytes";
2
+ import { hexFrom } from "../hex";
3
+ import * as mol from "./molecule.advanced";
4
+ import { HASH_TYPES, HASH_TYPE_TO_NUM, NUM_TO_HASH_TYPE, } from "./script.advanced";
5
+ export function hashTypeFrom(val) {
6
+ const hashType = (() => {
7
+ if (typeof val === "number") {
8
+ return NUM_TO_HASH_TYPE[val];
9
+ }
10
+ if (typeof val === "bigint") {
11
+ return NUM_TO_HASH_TYPE[Number(val)];
12
+ }
13
+ if (!HASH_TYPES.includes(val)) {
14
+ return;
15
+ }
16
+ return val;
17
+ })();
18
+ if (hashType === undefined) {
19
+ throw new Error(`Invalid hash type ${val}`);
20
+ }
21
+ return hashType;
22
+ }
23
+ export function hashTypeToBytes(hashType) {
24
+ return bytesFrom([HASH_TYPE_TO_NUM[hashType]]);
25
+ }
26
+ export function hashTypeFromBytes(bytes) {
27
+ return NUM_TO_HASH_TYPE[bytesFrom(bytes)[0]];
28
+ }
29
+ export class Script {
30
+ constructor(codeHash, hashType, args) {
31
+ this.codeHash = codeHash;
32
+ this.hashType = hashType;
33
+ this.args = args;
34
+ }
35
+ static from(script) {
36
+ if (script instanceof Script) {
37
+ return script;
38
+ }
39
+ return new Script(hexFrom(script.codeHash), hashTypeFrom(script.hashType), hexFrom(script.args));
40
+ }
41
+ _toMolData() {
42
+ return {
43
+ codeHash: bytesFrom(this.codeHash),
44
+ hashType: hashTypeToBytes(this.hashType),
45
+ args: bytesFrom(this.args),
46
+ };
47
+ }
48
+ toBytes() {
49
+ return bytesFrom(mol.SerializeScript(this._toMolData()));
50
+ }
51
+ static fromBytes(bytes) {
52
+ const view = bytes instanceof mol.Script ? bytes : new mol.Script(bytesFrom(bytes));
53
+ return new Script(hexFrom(view.getCodeHash().raw()), hashTypeFromBytes([view.getHashType()]), hexFrom(view.getArgs().raw()));
54
+ }
55
+ eq(val) {
56
+ const script = Script.from(val);
57
+ return (this.codeHash === script.codeHash &&
58
+ this.args === script.args &&
59
+ this.hashType === script.hashType);
60
+ }
61
+ }
@@ -1,4 +1,5 @@
1
1
  import { type DepType } from "./transaction";
2
2
  export declare const DEP_TYPE_TO_NUM: Record<DepType, number>;
3
3
  export declare const NUM_TO_DEP_TYPE: Record<number, DepType>;
4
+ export declare const DEP_TYPES: string[];
4
5
  //# sourceMappingURL=transaction.advanced.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transaction.advanced.d.ts","sourceRoot":"","sources":["../../src/ckb/transaction.advanced.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,eAAe,CAAC;AAE7C,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,OAAO,EAAE,MAAM,CAGnD,CAAC;AACF,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAGnD,CAAC;AACF,eAAO,MAAM,SAAS,EAAE,MAAM,EAAiC,CAAC"}
@@ -0,0 +1,9 @@
1
+ export const DEP_TYPE_TO_NUM = {
2
+ code: 0x00,
3
+ depGroup: 0x01,
4
+ };
5
+ export const NUM_TO_DEP_TYPE = {
6
+ 0x00: "code",
7
+ 0x01: "depGroup",
8
+ };
9
+ export const DEP_TYPES = Object.keys(DEP_TYPE_TO_NUM);
@@ -0,0 +1,142 @@
1
+ import type { TransactionSkeletonType } from "@ckb-lumos/helpers";
2
+ import { Bytes, BytesLike } from "../bytes";
3
+ import { Hasher } from "../hasher";
4
+ import { Hex, HexLike } from "../hex";
5
+ import { Num, NumLike } from "../num";
6
+ import * as mol from "./molecule.advanced";
7
+ import { Script, ScriptLike } from "./script";
8
+ export type DepTypeLike = string | number | bigint;
9
+ export type DepType = "depGroup" | "code";
10
+ export declare function depTypeFrom(val: DepTypeLike): DepType;
11
+ export declare function depTypeToBytes(depType: DepType): Bytes;
12
+ export declare function depTypeFromBytes(bytes: BytesLike): DepType;
13
+ export type OutPointLike = {
14
+ txHash: HexLike;
15
+ index: NumLike;
16
+ };
17
+ export declare class OutPoint {
18
+ txHash: Hex;
19
+ index: Num;
20
+ constructor(txHash: Hex, index: Num);
21
+ static from(outPoint: OutPointLike): OutPoint;
22
+ _toMolData(): {
23
+ txHash: Uint8Array;
24
+ index: Uint8Array;
25
+ };
26
+ encode(): Bytes;
27
+ static fromBytes(bytes: BytesLike | mol.OutPoint): OutPoint;
28
+ }
29
+ export type CellOutputLike = {
30
+ capacity: NumLike;
31
+ lock: ScriptLike;
32
+ type?: ScriptLike;
33
+ };
34
+ export declare class CellOutput {
35
+ capacity: Num;
36
+ lock: Script;
37
+ type?: Script | undefined;
38
+ constructor(capacity: Num, lock: Script, type?: Script | undefined);
39
+ static from(cellOutput: CellOutputLike): CellOutput;
40
+ _toMolData(): {
41
+ capacity: Uint8Array;
42
+ lock: {
43
+ codeHash: Uint8Array;
44
+ hashType: Uint8Array;
45
+ args: Uint8Array;
46
+ };
47
+ type: {
48
+ codeHash: Uint8Array;
49
+ hashType: Uint8Array;
50
+ args: Uint8Array;
51
+ } | undefined;
52
+ };
53
+ toBytes(): Bytes;
54
+ static fromBytes(bytes: BytesLike | mol.CellOutput): CellOutput;
55
+ }
56
+ export type CellInputLike = {
57
+ previousOutput: OutPointLike;
58
+ since: NumLike;
59
+ cellOutput?: CellOutputLike;
60
+ outputData?: HexLike;
61
+ };
62
+ export declare class CellInput {
63
+ previousOutput: OutPoint;
64
+ since: Num;
65
+ cellOutput?: CellOutput | undefined;
66
+ outputData?: `0x${string}` | undefined;
67
+ constructor(previousOutput: OutPoint, since: Num, cellOutput?: CellOutput | undefined, outputData?: `0x${string}` | undefined);
68
+ static from(cellInput: CellInputLike): CellInput;
69
+ _toMolData(): {
70
+ previousOutput: {
71
+ txHash: Uint8Array;
72
+ index: Uint8Array;
73
+ };
74
+ since: Uint8Array;
75
+ };
76
+ toBytes(): Bytes;
77
+ static fromBytes(bytes: BytesLike | mol.CellInput): CellInput;
78
+ }
79
+ export type CellDepLike = {
80
+ outPoint: OutPointLike;
81
+ depType: DepTypeLike;
82
+ };
83
+ export declare class CellDep {
84
+ outPoint: OutPoint;
85
+ depType: DepType;
86
+ constructor(outPoint: OutPoint, depType: DepType);
87
+ static from(cellDep: CellDepLike): CellDep;
88
+ _toMolData(): {
89
+ outPoint: {
90
+ txHash: Uint8Array;
91
+ index: Uint8Array;
92
+ };
93
+ depType: Uint8Array;
94
+ };
95
+ toBytes(): Bytes;
96
+ fromBytes(bytes: BytesLike | mol.CellDep): CellDep;
97
+ }
98
+ export type WitnessArgsLike = {
99
+ lock?: HexLike;
100
+ inputType?: HexLike;
101
+ outputType?: HexLike;
102
+ };
103
+ export declare class WitnessArgs {
104
+ lock?: `0x${string}` | undefined;
105
+ inputType?: `0x${string}` | undefined;
106
+ outputType?: `0x${string}` | undefined;
107
+ constructor(lock?: `0x${string}` | undefined, inputType?: `0x${string}` | undefined, outputType?: `0x${string}` | undefined);
108
+ static from(witnessArgs: WitnessArgsLike): WitnessArgs;
109
+ _toMolData(): {
110
+ lock: Uint8Array | undefined;
111
+ inputType: Uint8Array | undefined;
112
+ outputType: Uint8Array | undefined;
113
+ };
114
+ toBytes(): Bytes;
115
+ static fromBytes(bytes: BytesLike | mol.WitnessArgs): WitnessArgs;
116
+ }
117
+ export type TransactionLike = {
118
+ version: NumLike;
119
+ cellDeps: CellDepLike[];
120
+ headerDeps: HexLike[];
121
+ inputs: CellInputLike[];
122
+ outputs: CellOutputLike[];
123
+ outputsData: HexLike[];
124
+ witnesses: HexLike[];
125
+ };
126
+ export declare class Transaction {
127
+ version: Num;
128
+ cellDeps: CellDep[];
129
+ headerDeps: Hex[];
130
+ inputs: CellInput[];
131
+ outputs: CellOutput[];
132
+ outputsData: Hex[];
133
+ witnesses: Hex[];
134
+ constructor(version: Num, cellDeps: CellDep[], headerDeps: Hex[], inputs: CellInput[], outputs: CellOutput[], outputsData: Hex[], witnesses: Hex[]);
135
+ static default(): Transaction;
136
+ static from(tx: TransactionLike): Transaction;
137
+ static fromLumosSkeleton(skeleton: TransactionSkeletonType): Transaction;
138
+ rawToBytes(): Bytes;
139
+ hash(): `0x${string}`;
140
+ static hashWitnessToHasher(witness: HexLike, hasher: Hasher): void;
141
+ }
142
+ //# sourceMappingURL=transaction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../src/ckb/transaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAa,MAAM,UAAU,CAAC;AACvD,OAAO,EAAE,MAAM,EAAW,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,GAAG,EAAE,OAAO,EAAW,MAAM,QAAQ,CAAC;AAC/C,OAAO,EAAE,GAAG,EAAE,OAAO,EAAqC,MAAM,QAAQ,CAAC;AAEzE,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,UAAU,EAA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E,OAAO,EAAE,MAAM,EAAE,MAAM;CAK5D"}
@@ -0,0 +1,227 @@
1
+ import { bytesFrom } from "../bytes";
2
+ import { ckbHash } from "../hasher";
3
+ import { hexFrom } from "../hex";
4
+ import { numFrom, numFromBytes, numToBytes } from "../num";
5
+ import { apply } from "../utils";
6
+ import * as mol from "./molecule.advanced";
7
+ import { Script } from "./script";
8
+ import { DEP_TYPE_TO_NUM, NUM_TO_DEP_TYPE } from "./transaction.advanced";
9
+ export function depTypeFrom(val) {
10
+ const depType = (() => {
11
+ if (typeof val === "number") {
12
+ return NUM_TO_DEP_TYPE[val];
13
+ }
14
+ if (typeof val === "bigint") {
15
+ return NUM_TO_DEP_TYPE[Number(val)];
16
+ }
17
+ return val;
18
+ })();
19
+ if (depType === undefined) {
20
+ throw new Error(`Invalid dep type ${val}`);
21
+ }
22
+ return depType;
23
+ }
24
+ export function depTypeToBytes(depType) {
25
+ return bytesFrom([DEP_TYPE_TO_NUM[depType]]);
26
+ }
27
+ export function depTypeFromBytes(bytes) {
28
+ return NUM_TO_DEP_TYPE[bytesFrom(bytes)[0]];
29
+ }
30
+ export class OutPoint {
31
+ constructor(txHash, index) {
32
+ this.txHash = txHash;
33
+ this.index = index;
34
+ }
35
+ static from(outPoint) {
36
+ if (outPoint instanceof OutPoint) {
37
+ return outPoint;
38
+ }
39
+ return new OutPoint(hexFrom(outPoint.txHash), numFrom(outPoint.index));
40
+ }
41
+ _toMolData() {
42
+ return {
43
+ txHash: bytesFrom(this.txHash),
44
+ index: numToBytes(this.index, 4),
45
+ };
46
+ }
47
+ encode() {
48
+ return bytesFrom(mol.SerializeOutPoint(this._toMolData()));
49
+ }
50
+ static fromBytes(bytes) {
51
+ const view = bytes instanceof mol.OutPoint
52
+ ? bytes
53
+ : new mol.OutPoint(bytesFrom(bytes));
54
+ return new OutPoint(hexFrom(view.getTxHash().raw()), numFromBytes(view.getIndex().raw()));
55
+ }
56
+ }
57
+ export class CellOutput {
58
+ constructor(capacity, lock, type) {
59
+ this.capacity = capacity;
60
+ this.lock = lock;
61
+ this.type = type;
62
+ }
63
+ static from(cellOutput) {
64
+ if (cellOutput instanceof CellOutput) {
65
+ return cellOutput;
66
+ }
67
+ return new CellOutput(numFrom(cellOutput.capacity), Script.from(cellOutput.lock), apply(Script.from, cellOutput.type));
68
+ }
69
+ _toMolData() {
70
+ return {
71
+ capacity: numToBytes(this.capacity, 8),
72
+ lock: this.lock._toMolData(),
73
+ type: this.type?._toMolData(),
74
+ };
75
+ }
76
+ toBytes() {
77
+ return bytesFrom(mol.SerializeCellOutput(this._toMolData()));
78
+ }
79
+ static fromBytes(bytes) {
80
+ const view = bytes instanceof mol.CellOutput
81
+ ? bytes
82
+ : new mol.CellOutput(bytesFrom(bytes));
83
+ return new CellOutput(numFromBytes(view.getCapacity().raw()), Script.fromBytes(view.getLock()), apply(Script.fromBytes, mol.molOptional(view.getType())));
84
+ }
85
+ }
86
+ export class CellInput {
87
+ constructor(previousOutput, since, cellOutput, outputData) {
88
+ this.previousOutput = previousOutput;
89
+ this.since = since;
90
+ this.cellOutput = cellOutput;
91
+ this.outputData = outputData;
92
+ }
93
+ static from(cellInput) {
94
+ if (cellInput instanceof CellInput) {
95
+ return cellInput;
96
+ }
97
+ return new CellInput(OutPoint.from(cellInput.previousOutput), numFrom(cellInput.since), apply(CellOutput.from, cellInput.cellOutput), apply(hexFrom, cellInput.outputData));
98
+ }
99
+ _toMolData() {
100
+ return {
101
+ previousOutput: this.previousOutput._toMolData(),
102
+ since: numToBytes(this.since, 8),
103
+ };
104
+ }
105
+ toBytes() {
106
+ return bytesFrom(mol.SerializeCellInput(this._toMolData()));
107
+ }
108
+ static fromBytes(bytes) {
109
+ const view = bytes instanceof mol.CellInput
110
+ ? bytes
111
+ : new mol.CellInput(bytesFrom(bytes));
112
+ return new CellInput(OutPoint.fromBytes(view.getPreviousOutput()), numFromBytes(view.getSince().raw()));
113
+ }
114
+ }
115
+ export class CellDep {
116
+ constructor(outPoint, depType) {
117
+ this.outPoint = outPoint;
118
+ this.depType = depType;
119
+ }
120
+ static from(cellDep) {
121
+ if (cellDep instanceof CellDep) {
122
+ return cellDep;
123
+ }
124
+ return new CellDep(OutPoint.from(cellDep.outPoint), depTypeFrom(cellDep.depType));
125
+ }
126
+ _toMolData() {
127
+ return {
128
+ outPoint: this.outPoint._toMolData(),
129
+ depType: depTypeToBytes(this.depType),
130
+ };
131
+ }
132
+ toBytes() {
133
+ return bytesFrom(mol.SerializeCellDep(this._toMolData()));
134
+ }
135
+ fromBytes(bytes) {
136
+ const view = bytes instanceof mol.CellDep ? bytes : new mol.CellDep(bytesFrom(bytes));
137
+ return new CellDep(OutPoint.fromBytes(view.getOutPoint()), depTypeFromBytes([view.getDepType()]));
138
+ }
139
+ }
140
+ export class WitnessArgs {
141
+ constructor(lock, inputType, outputType) {
142
+ this.lock = lock;
143
+ this.inputType = inputType;
144
+ this.outputType = outputType;
145
+ }
146
+ static from(witnessArgs) {
147
+ if (witnessArgs instanceof WitnessArgs) {
148
+ return witnessArgs;
149
+ }
150
+ return new WitnessArgs(apply(hexFrom, witnessArgs.lock), apply(hexFrom, witnessArgs.inputType), apply(hexFrom, witnessArgs.outputType));
151
+ }
152
+ _toMolData() {
153
+ return {
154
+ lock: apply(bytesFrom, this.lock),
155
+ inputType: apply(bytesFrom, this.inputType),
156
+ outputType: apply(bytesFrom, this.outputType),
157
+ };
158
+ }
159
+ toBytes() {
160
+ return bytesFrom(mol.SerializeWitnessArgs(this._toMolData()));
161
+ }
162
+ static fromBytes(bytes) {
163
+ const view = bytes instanceof mol.WitnessArgs
164
+ ? bytes
165
+ : new mol.WitnessArgs(bytesFrom(bytes));
166
+ return new WitnessArgs(apply(hexFrom, mol.molOptional(view.getLock())?.raw()), apply(hexFrom, mol.molOptional(view.getInputType())?.raw()), apply(hexFrom, mol.molOptional(view.getOutputType())?.raw()));
167
+ }
168
+ }
169
+ export class Transaction {
170
+ constructor(version, cellDeps, headerDeps, inputs, outputs, outputsData, witnesses) {
171
+ this.version = version;
172
+ this.cellDeps = cellDeps;
173
+ this.headerDeps = headerDeps;
174
+ this.inputs = inputs;
175
+ this.outputs = outputs;
176
+ this.outputsData = outputsData;
177
+ this.witnesses = witnesses;
178
+ }
179
+ static default() {
180
+ return new Transaction(0n, [], [], [], [], [], []);
181
+ }
182
+ static from(tx) {
183
+ if (tx instanceof Transaction) {
184
+ return tx;
185
+ }
186
+ return new Transaction(numFrom(tx.version), tx.cellDeps.map((cellDep) => CellDep.from(cellDep)), tx.headerDeps.map(hexFrom), tx.inputs.map((input) => CellInput.from(input)), tx.outputs.map((output) => CellOutput.from(output)), tx.outputsData.map(hexFrom), tx.witnesses.map(hexFrom));
187
+ }
188
+ static fromLumosSkeleton(skeleton) {
189
+ return Transaction.from({
190
+ version: 0n,
191
+ cellDeps: skeleton.cellDeps.toArray(),
192
+ headerDeps: skeleton.headerDeps.toArray(),
193
+ inputs: skeleton.inputs.toArray().map((input, i) => {
194
+ if (!input.outPoint) {
195
+ throw new Error("outPoint is required in input");
196
+ }
197
+ return CellInput.from({
198
+ previousOutput: input.outPoint,
199
+ since: skeleton.inputSinces.get(i, "0x0"),
200
+ cellOutput: input.cellOutput,
201
+ outputData: input.data,
202
+ });
203
+ }),
204
+ outputs: skeleton.outputs.toArray().map((output) => output.cellOutput),
205
+ outputsData: skeleton.outputs.toArray().map((output) => output.data),
206
+ witnesses: skeleton.witnesses.toArray(),
207
+ });
208
+ }
209
+ rawToBytes() {
210
+ return bytesFrom(mol.SerializeRawTransaction({
211
+ version: numToBytes(this.version, 4),
212
+ cellDeps: this.cellDeps.map((d) => d._toMolData()),
213
+ headerDeps: this.headerDeps.map(bytesFrom),
214
+ inputs: this.inputs.map((i) => i._toMolData()),
215
+ outputs: this.outputs.map((o) => o._toMolData()),
216
+ outputsData: this.outputsData.map(bytesFrom),
217
+ }));
218
+ }
219
+ hash() {
220
+ return ckbHash(this.rawToBytes());
221
+ }
222
+ static hashWitnessToHasher(witness, hasher) {
223
+ const raw = bytesFrom(hexFrom(witness));
224
+ hasher.update(numToBytes(raw.length, 8));
225
+ hasher.update(raw);
226
+ }
227
+ }
@@ -1,18 +1,2 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./clientPublicMainnet.advanced"), exports);
18
- __exportStar(require("./clientPublicTestnet.advanced"), exports);
1
+ export * from "./clientPublicMainnet.advanced";
2
+ export * from "./clientPublicTestnet.advanced";
@@ -1,5 +1,5 @@
1
- import { Hex } from "../primitive";
2
- import { Script, Transaction } from "../ckb";
1
+ import { ScriptLike, TransactionLike } from "../ckb";
2
+ import { Hex } from "../hex";
3
3
  import { OutputsValidator } from "./clientTypes";
4
4
  export declare enum KnownScript {
5
5
  Secp256k1Blake160 = 0,
@@ -9,8 +9,9 @@ export declare enum KnownScript {
9
9
  OmniLock = 4
10
10
  }
11
11
  export interface Client {
12
+ getUrl(): string;
12
13
  getAddressPrefix(): Promise<string>;
13
- getKnownScript(script: KnownScript): Promise<Omit<Script, "args">>;
14
- sendTransaction(transaction: Transaction, validator?: OutputsValidator): Promise<Hex>;
14
+ getKnownScript(script: KnownScript): Promise<Omit<ScriptLike, "args">>;
15
+ sendTransaction(transaction: TransactionLike, validator?: OutputsValidator): Promise<Hex>;
15
16
  }
16
17
  //# sourceMappingURL=client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD,oBAAY,WAAW;IACrB,iBAAiB,IAAA;IACjB,iBAAiB,IAAA;IACjB,YAAY,IAAA;IACZ,KAAK,IAAA;IACL,QAAQ,IAAA;CACT;AAED,MAAM,WAAW,MAAM;IACrB,gBAAgB,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IACpC,cAAc,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAEnE,eAAe,CACb,WAAW,EAAE,WAAW,EACxB,SAAS,CAAC,EAAE,gBAAgB,GAC3B,OAAO,CAAC,GAAG,CAAC,CAAC;CACjB"}
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AACrD,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD,oBAAY,WAAW;IACrB,iBAAiB,IAAA;IACjB,iBAAiB,IAAA;IACjB,YAAY,IAAA;IACZ,KAAK,IAAA;IACL,QAAQ,IAAA;CACT;AAED,MAAM,WAAW,MAAM;IACrB,MAAM,IAAI,MAAM,CAAC;IAEjB,gBAAgB,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IACpC,cAAc,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;IAEvE,eAAe,CACb,WAAW,EAAE,eAAe,EAC5B,SAAS,CAAC,EAAE,gBAAgB,GAC3B,OAAO,CAAC,GAAG,CAAC,CAAC;CACjB"}
@@ -1,11 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.KnownScript = void 0;
4
- var KnownScript;
1
+ export var KnownScript;
5
2
  (function (KnownScript) {
6
3
  KnownScript[KnownScript["Secp256k1Blake160"] = 0] = "Secp256k1Blake160";
7
4
  KnownScript[KnownScript["Secp256k1Multisig"] = 1] = "Secp256k1Multisig";
8
5
  KnownScript[KnownScript["AnyoneCanPay"] = 2] = "AnyoneCanPay";
9
6
  KnownScript[KnownScript["JoyId"] = 3] = "JoyId";
10
7
  KnownScript[KnownScript["OmniLock"] = 4] = "OmniLock";
11
- })(KnownScript || (exports.KnownScript = KnownScript = {}));
8
+ })(KnownScript || (KnownScript = {}));
@@ -1,4 +1,4 @@
1
- import { Script } from "../ckb";
1
+ import { ScriptLike } from "../ckb";
2
2
  import { KnownScript } from "./client";
3
- export declare const MAINNET_SCRIPTS: Record<KnownScript, Omit<Script, "args">>;
3
+ export declare const MAINNET_SCRIPTS: Record<KnownScript, Omit<ScriptLike, "args">>;
4
4
  //# sourceMappingURL=clientPublicMainnet.advanced.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"clientPublicMainnet.advanced.d.ts","sourceRoot":"","sources":["../../src/client/clientPublicMainnet.advanced.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,WAAW,EAAE,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CA0BrE,CAAC"}
1
+ {"version":3,"file":"clientPublicMainnet.advanced.d.ts","sourceRoot":"","sources":["../../src/client/clientPublicMainnet.advanced.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,WAAW,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CA0BzE,CAAC"}
@@ -1,25 +1,22 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MAINNET_SCRIPTS = void 0;
4
- const client_1 = require("./client");
5
- exports.MAINNET_SCRIPTS = {
6
- [client_1.KnownScript.Secp256k1Blake160]: {
1
+ import { KnownScript } from "./client";
2
+ export const MAINNET_SCRIPTS = {
3
+ [KnownScript.Secp256k1Blake160]: {
7
4
  codeHash: "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8",
8
5
  hashType: "type",
9
6
  },
10
- [client_1.KnownScript.Secp256k1Multisig]: {
7
+ [KnownScript.Secp256k1Multisig]: {
11
8
  codeHash: "0x5c5069eb0857efc65e1bca0c07df34c31663b3622fd3876c876320fc9634e2a8",
12
9
  hashType: "type",
13
10
  },
14
- [client_1.KnownScript.AnyoneCanPay]: {
11
+ [KnownScript.AnyoneCanPay]: {
15
12
  codeHash: "0xd369597ff47f29fbc0d47d2e3775370d1250b85140c670e4718af712983a2354",
16
13
  hashType: "type",
17
14
  },
18
- [client_1.KnownScript.JoyId]: {
15
+ [KnownScript.JoyId]: {
19
16
  codeHash: "0xd00c84f0ec8fd441c38bc3f87a371f547190f2fcff88e642bc5bf54b9e318323",
20
17
  hashType: "type",
21
18
  },
22
- [client_1.KnownScript.OmniLock]: {
19
+ [KnownScript.OmniLock]: {
23
20
  codeHash: "0x9b819793a64463aed77c615d6cb226eea5487ccfc0783043a587254cda2b6f26",
24
21
  hashType: "type",
25
22
  },
@@ -1,9 +1,9 @@
1
- import { Script } from "../ckb";
1
+ import { ScriptLike } from "../ckb";
2
2
  import { KnownScript } from "./client";
3
3
  import { ClientJsonRpc } from "./jsonRpc";
4
4
  export declare class ClientPublicMainnet extends ClientJsonRpc {
5
5
  constructor(timeout?: number);
6
6
  getAddressPrefix(): Promise<string>;
7
- getKnownScript(script: KnownScript): Promise<Omit<Script, "args">>;
7
+ getKnownScript(script: KnownScript): Promise<Omit<ScriptLike, "args">>;
8
8
  }
9
9
  //# sourceMappingURL=clientPublicMainnet.d.ts.map