@clarigen/core 4.0.0 → 4.0.2-alpha.0
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/deployment-B3q-81ej.d.cts +95 -0
- package/dist/deployment-BuEApfjy.mjs +1 -0
- package/dist/deployment-CJKAJJQx.cjs +1 -0
- package/dist/deployment-bCip1x1p.d.mts +95 -0
- package/dist/deployment.cjs +1 -0
- package/dist/deployment.d.cts +2 -0
- package/dist/deployment.d.mts +2 -0
- package/dist/deployment.mjs +1 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +557 -0
- package/dist/index.d.mts +311 -413
- package/dist/index.mjs +1 -1
- package/package.json +17 -6
- package/dist/index.d.ts +0 -659
- package/dist/index.js +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,41 +1,43 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { h as SimnetDeploymentPlan, o as DeploymentPlan } from "./deployment-bCip1x1p.mjs";
|
|
2
|
+
import { ClarityAbi as ClarityAbi$1, ClarityAbiTypeTuple as ClarityAbiTypeTuple$1, ClarityValue, ContractPrincipalCV, FungiblePostCondition, NonFungiblePostCondition, PrincipalCV, StacksTransactionWire } from "@stacks/transactions";
|
|
3
|
+
import { StacksNetwork, StacksNetworkName } from "@stacks/network";
|
|
3
4
|
|
|
5
|
+
//#region src/abi-types.d.ts
|
|
4
6
|
type ClarityAbiTypeBuffer = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
buffer: {
|
|
8
|
+
length: number;
|
|
9
|
+
};
|
|
8
10
|
};
|
|
9
11
|
type ClarityAbiTypeStringAscii = {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
'string-ascii': {
|
|
13
|
+
length: number;
|
|
14
|
+
};
|
|
13
15
|
};
|
|
14
16
|
type ClarityAbiTypeStringUtf8 = {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
'string-utf8': {
|
|
18
|
+
length: number;
|
|
19
|
+
};
|
|
18
20
|
};
|
|
19
21
|
type ClarityAbiTypeResponse = {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
response: {
|
|
23
|
+
ok: ClarityAbiType;
|
|
24
|
+
error: ClarityAbiType;
|
|
25
|
+
};
|
|
24
26
|
};
|
|
25
27
|
type ClarityAbiTypeOptional = {
|
|
26
|
-
|
|
28
|
+
optional: ClarityAbiType;
|
|
27
29
|
};
|
|
28
30
|
type ClarityAbiTypeTuple = {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
tuple: readonly {
|
|
32
|
+
name: string;
|
|
33
|
+
type: ClarityAbiType;
|
|
34
|
+
}[];
|
|
33
35
|
};
|
|
34
36
|
type ClarityAbiTypeList = {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
list: {
|
|
38
|
+
type: ClarityAbiType;
|
|
39
|
+
length: number;
|
|
40
|
+
};
|
|
39
41
|
};
|
|
40
42
|
type ClarityAbiTypeUInt128 = 'uint128';
|
|
41
43
|
type ClarityAbiTypeInt128 = 'int128';
|
|
@@ -46,88 +48,89 @@ type ClarityAbiTypeNone = 'none';
|
|
|
46
48
|
type ClarityAbiTypePrimitive = ClarityAbiTypeUInt128 | ClarityAbiTypeInt128 | ClarityAbiTypeBool | ClarityAbiTypePrincipal | ClarityAbiTypeTraitReference | ClarityAbiTypeNone;
|
|
47
49
|
type ClarityAbiType = ClarityAbiTypePrimitive | ClarityAbiTypeBuffer | ClarityAbiTypeResponse | ClarityAbiTypeOptional | ClarityAbiTypeTuple | ClarityAbiTypeList | ClarityAbiTypeStringAscii | ClarityAbiTypeStringUtf8 | ClarityAbiTypeTraitReference;
|
|
48
50
|
interface ClarityAbiArg {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
+
name: string;
|
|
52
|
+
type: ClarityAbiType;
|
|
51
53
|
}
|
|
52
54
|
interface ClarityAbiFunction {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
type TypedAbiArg<T, N extends string> = {
|
|
61
|
-
|
|
62
|
-
|
|
55
|
+
name: string;
|
|
56
|
+
access: 'private' | 'public' | 'read_only';
|
|
57
|
+
args: ClarityAbiArg[];
|
|
58
|
+
outputs: {
|
|
59
|
+
type: ClarityAbiType;
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
type TypedAbiArg<T, N$1 extends string> = {
|
|
63
|
+
_t?: T;
|
|
64
|
+
name: N$1;
|
|
63
65
|
};
|
|
64
|
-
type TypedAbiFunction<T extends TypedAbiArg<unknown, string>[], R> = ClarityAbiFunction & {
|
|
65
|
-
|
|
66
|
-
|
|
66
|
+
type TypedAbiFunction<T extends TypedAbiArg<unknown, string>[], R$1> = ClarityAbiFunction & {
|
|
67
|
+
_t?: T;
|
|
68
|
+
_r?: R$1;
|
|
67
69
|
};
|
|
68
70
|
interface ClarityAbiVariable {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
71
|
+
name: string;
|
|
72
|
+
access: 'variable' | 'constant';
|
|
73
|
+
type: ClarityAbiType;
|
|
72
74
|
}
|
|
73
75
|
type TypedAbiVariable<T> = ClarityAbiVariable & {};
|
|
74
76
|
interface ClarityAbiMap {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
77
|
+
name: string;
|
|
78
|
+
key: ClarityAbiType;
|
|
79
|
+
value: ClarityAbiType;
|
|
78
80
|
}
|
|
79
|
-
type TypedAbiMap<K, V> = ClarityAbiMap & {
|
|
80
|
-
|
|
81
|
-
|
|
81
|
+
type TypedAbiMap<K$1, V$1> = ClarityAbiMap & {
|
|
82
|
+
_k?: K$1;
|
|
83
|
+
_v?: V$1;
|
|
82
84
|
};
|
|
83
85
|
interface ClarityAbiTypeFungibleToken {
|
|
84
|
-
|
|
86
|
+
name: string;
|
|
85
87
|
}
|
|
86
88
|
interface ClarityAbiTypeNonFungibleToken<T = unknown> {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
89
|
+
name: string;
|
|
90
|
+
type: ClarityAbiType;
|
|
91
|
+
_t?: T;
|
|
90
92
|
}
|
|
91
93
|
type StacksEpochId = 'Epoch10' | 'Epoch20' | 'Epoch2_05' | 'Epoch21' | 'Epoch22' | 'Epoch23' | 'Epoch24' | 'Epoch25' | 'Epoch30' | 'Epoch31' | 'Epoch32' | 'Epoch33';
|
|
92
94
|
type ClarityVersion = 'Clarity1' | 'Clarity2' | 'Clarity3' | 'Clarity4';
|
|
93
95
|
type TypedAbi = Readonly<{
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
96
|
+
functions: {
|
|
97
|
+
[key: string]: TypedAbiFunction<TypedAbiArg<unknown, string>[], unknown>;
|
|
98
|
+
};
|
|
99
|
+
variables: {
|
|
100
|
+
[key: string]: TypedAbiVariable<unknown>;
|
|
101
|
+
};
|
|
102
|
+
maps: {
|
|
103
|
+
[key: string]: TypedAbiMap<unknown, unknown>;
|
|
104
|
+
};
|
|
105
|
+
constants: {
|
|
106
|
+
[key: string]: unknown;
|
|
107
|
+
};
|
|
108
|
+
fungible_tokens: Readonly<ClarityAbiTypeFungibleToken[]>;
|
|
109
|
+
non_fungible_tokens: Readonly<ClarityAbiTypeNonFungibleToken<unknown>[]>;
|
|
110
|
+
contractName: string;
|
|
111
|
+
contractFile?: string;
|
|
110
112
|
}>;
|
|
111
113
|
interface ResponseOk<T, E> {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
114
|
+
value: T;
|
|
115
|
+
isOk: true;
|
|
116
|
+
_e?: E;
|
|
115
117
|
}
|
|
116
118
|
interface ResponseErr<T, E> {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
119
|
+
value: E;
|
|
120
|
+
isOk: false;
|
|
121
|
+
_o?: T;
|
|
120
122
|
}
|
|
121
123
|
type Response<Ok, Err> = ResponseOk<Ok, Err> | ResponseErr<Ok, Err>;
|
|
122
|
-
type OkType<R> = R extends ResponseOk<infer V, unknown> ? V : never;
|
|
123
|
-
type ErrType<R> = R extends ResponseErr<unknown, infer V> ? V : never;
|
|
124
|
-
|
|
124
|
+
type OkType<R$1> = R$1 extends ResponseOk<infer V, unknown> ? V : never;
|
|
125
|
+
type ErrType<R$1> = R$1 extends ResponseErr<unknown, infer V> ? V : never;
|
|
126
|
+
//#endregion
|
|
127
|
+
//#region src/clarity-types.d.ts
|
|
125
128
|
declare function ok<T, Err = never>(value: T): ResponseOk<T, Err>;
|
|
126
129
|
declare function err<Ok = never, T = unknown>(value: T): ResponseErr<Ok, T>;
|
|
127
130
|
declare function isResponse<T>(value: Response<T, T> | T): value is Response<T, T>;
|
|
128
131
|
interface ClarityAbi extends ClarityAbi$1 {
|
|
129
|
-
|
|
130
|
-
|
|
132
|
+
epoch: StacksEpochId;
|
|
133
|
+
clarity_version: ClarityVersion;
|
|
131
134
|
}
|
|
132
135
|
declare function principalToString(principal: PrincipalCV): string;
|
|
133
136
|
/**
|
|
@@ -171,106 +174,88 @@ declare function expectOk<Ok>(response: Response<Ok, any>): Ok;
|
|
|
171
174
|
declare function expectErr<Err>(response: Response<any, Err>): Err;
|
|
172
175
|
type AbiPrimitiveTo<T extends ClarityAbiTypePrimitive> = T extends ClarityAbiTypeInt128 ? bigint : T extends ClarityAbiTypeUInt128 ? bigint : T extends ClarityAbiTypeBool ? boolean : T extends ClarityAbiTypePrincipal ? string : T extends ClarityAbiTypeTraitReference ? string : T extends ClarityAbiTypeNone ? never : T;
|
|
173
176
|
type ReadonlyTuple = {
|
|
174
|
-
|
|
175
|
-
};
|
|
176
|
-
type TupleTypeUnion<T> = T extends Readonly<ClarityAbiTypeTuple$1['tuple'][number]> ? {
|
|
177
|
-
-readonly [Z in T['name']]: AbiTypeTo<T['type']>;
|
|
178
|
-
} : never;
|
|
179
|
-
type UnionToIntersection$1<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
|
180
|
-
type Compact$1<T> = {
|
|
181
|
-
[K in keyof T]: T[K];
|
|
177
|
+
readonly tuple: Readonly<ClarityAbiTypeTuple$1['tuple']>;
|
|
182
178
|
};
|
|
179
|
+
type TupleTypeUnion<T> = T extends Readonly<ClarityAbiTypeTuple$1['tuple'][number]> ? { -readonly [Z in T['name']]: AbiTypeTo<T['type']> } : never;
|
|
180
|
+
type UnionToIntersection$1<U> = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;
|
|
181
|
+
type Compact$1<T> = { [K in keyof T]: T[K] };
|
|
183
182
|
type AbiTupleTo<T extends ReadonlyTuple> = Compact$1<UnionToIntersection$1<TupleTypeUnion<T['tuple'][number]>>>;
|
|
184
183
|
type AbiTypeTo<T extends ClarityAbiType | ReadonlyTuple> = T extends ClarityAbiTypePrimitive ? AbiPrimitiveTo<T> : T extends ClarityAbiTypeBuffer ? Uint8Array : T extends ClarityAbiTypeStringAscii ? string : T extends ClarityAbiTypeStringUtf8 ? string : T extends ClarityAbiTypeList ? AbiTypeTo<T['list']['type']>[] : T extends ClarityAbiTypeOptional ? AbiTypeTo<T['optional']> | null : T extends ClarityAbiTypeResponse ? Response<AbiTypeTo<T['response']['ok']>, AbiTypeTo<T['response']['error']>> : T extends ReadonlyTuple ? AbiTupleTo<T> : never;
|
|
185
184
|
type FunctionReturnType<T> = T extends TypedAbiFunction<TypedAbiArg<unknown, string>[], infer R> ? R : never;
|
|
186
|
-
type Jsonize<T> = T extends BigInt ? string : T extends Uint8Array ? string : T extends (infer V)[] ? Jsonize<V>[] : T extends Record<keyof T, unknown> ? {
|
|
187
|
-
[K in keyof T as K]: Jsonize<T[K]>;
|
|
188
|
-
} : T;
|
|
185
|
+
type Jsonize<T> = T extends BigInt ? string : T extends Uint8Array ? string : T extends (infer V)[] ? Jsonize<V>[] : T extends Record<keyof T, unknown> ? { [K in keyof T as K]: Jsonize<T[K]> } : T;
|
|
189
186
|
declare function getTypeString(val: ClarityAbiType): string;
|
|
190
|
-
|
|
187
|
+
//#endregion
|
|
188
|
+
//#region src/transaction.d.ts
|
|
191
189
|
interface ResultAssets {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
190
|
+
stx: Record<string, string>;
|
|
191
|
+
burns: Record<string, string>;
|
|
192
|
+
tokens: Record<string, Record<string, string>>;
|
|
193
|
+
assets: Record<string, Record<string, string>>;
|
|
196
194
|
}
|
|
197
|
-
|
|
195
|
+
//#endregion
|
|
196
|
+
//#region src/factory-types.d.ts
|
|
198
197
|
interface ContractCall<T> {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
198
|
+
function: ClarityAbiFunction;
|
|
199
|
+
nativeArgs: any[];
|
|
200
|
+
functionArgs: ClarityValue[];
|
|
201
|
+
contractAddress: string;
|
|
202
|
+
contractName: string;
|
|
203
|
+
functionName: string;
|
|
204
|
+
_r?: T;
|
|
206
205
|
}
|
|
207
|
-
interface ContractCallTyped<Args extends UnknownArgs, R> extends Omit<ContractCall<R>, 'nativeArgs'> {
|
|
208
|
-
|
|
206
|
+
interface ContractCallTyped<Args$1 extends UnknownArgs, R$1> extends Omit<ContractCall<R$1>, 'nativeArgs'> {
|
|
207
|
+
nativeArgs: ArgsType<Args$1>;
|
|
209
208
|
}
|
|
210
209
|
type ContractFunctions = {
|
|
211
|
-
|
|
210
|
+
[key: string]: TypedAbiFunction<UnknownArgs, unknown>;
|
|
212
211
|
};
|
|
213
212
|
type AllContracts = Record<string, TypedAbi>;
|
|
214
213
|
type UnknownArg = TypedAbiArg<unknown, string>;
|
|
215
214
|
type UnknownArgs = UnknownArg[];
|
|
216
|
-
type ArgsTuple<T extends UnknownArgs> = {
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
type
|
|
220
|
-
[K in T as N]: A;
|
|
221
|
-
} : never;
|
|
222
|
-
type InnerUnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
|
223
|
-
type Compact<T> = {
|
|
224
|
-
[K in keyof T]: T[K];
|
|
225
|
-
};
|
|
215
|
+
type ArgsTuple<T extends UnknownArgs> = { [K in keyof T]: T[K] extends TypedAbiArg<infer A, string> ? A : never };
|
|
216
|
+
type ArgsRecordUnion<T extends TypedAbiArg<unknown, string>> = T extends TypedAbiArg<infer A, infer N> ? { [K in T as N]: A } : never;
|
|
217
|
+
type InnerUnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;
|
|
218
|
+
type Compact<T> = { [K in keyof T]: T[K] };
|
|
226
219
|
type UnionToIntersection<T> = Compact<InnerUnionToIntersection<T>>;
|
|
227
220
|
type ArgsRecord<T extends UnknownArgs> = UnionToIntersection<ArgsRecordUnion<T[number]>>;
|
|
228
221
|
type ArgsType<T extends UnknownArgs> = [ArgsRecord<T>] | ArgsTuple<T>;
|
|
229
|
-
type ContractCallFunction<Args extends UnknownArgs, R> = {
|
|
230
|
-
|
|
231
|
-
|
|
222
|
+
type ContractCallFunction<Args$1 extends UnknownArgs, R$1> = {
|
|
223
|
+
(...args: ArgsType<Args$1>): ContractCallTyped<Args$1, R$1>;
|
|
224
|
+
abi: TypedAbiFunction<Args$1, R$1>;
|
|
232
225
|
};
|
|
233
226
|
type FnToContractCall<T> = T extends TypedAbiFunction<infer Arg, infer R> ? ContractCallFunction<Arg, R> : never;
|
|
234
|
-
type FunctionsToContractCalls<T> = T extends ContractFunctions ? {
|
|
235
|
-
|
|
236
|
-
} : never;
|
|
237
|
-
type ContractsToContractCalls<T> = T extends AllContracts ? {
|
|
238
|
-
[key in keyof T]: FunctionsToContractCalls<T[key]['functions']>;
|
|
239
|
-
} : never;
|
|
227
|
+
type FunctionsToContractCalls<T> = T extends ContractFunctions ? { [key in keyof T]: FnToContractCall<T[key]> } : never;
|
|
228
|
+
type ContractsToContractCalls<T> = T extends AllContracts ? { [key in keyof T]: FunctionsToContractCalls<T[key]['functions']> } : never;
|
|
240
229
|
type FullContract<T> = T extends TypedAbi ? FunctionsToContractCalls<T['functions']> & T & {
|
|
241
|
-
|
|
230
|
+
identifier: string;
|
|
242
231
|
} & {
|
|
243
|
-
|
|
232
|
+
contractFile: string;
|
|
244
233
|
} : never;
|
|
245
|
-
type ContractFactory<T extends AllContracts> = {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
type
|
|
250
|
-
type
|
|
251
|
-
|
|
252
|
-
} : T;
|
|
253
|
-
type ExtractArgs<F> = F extends TypedAbiFunction<infer Args, unknown> ? ArgsTuple<Args> : never;
|
|
254
|
-
type ExtractArgsRecord<F> = F extends TypedAbiFunction<infer Args, unknown> ? ArgsRecord<Args> : never;
|
|
234
|
+
type ContractFactory<T extends AllContracts> = { [key in keyof T]: FullContract<T[key]> };
|
|
235
|
+
//#endregion
|
|
236
|
+
//#region src/types.d.ts
|
|
237
|
+
type Kebab<T extends string, A$1 extends string = ''> = T extends `${infer F}${infer R}` ? Kebab<R, `${A$1}${F extends Lowercase<F> ? '' : '-'}${Lowercase<F>}`> : A$1;
|
|
238
|
+
type KebabObject<T> = T extends Uint8Array ? T : T extends Record<string, unknown> ? { [K in keyof T as K extends string ? Kebab<K> : K]: KebabObject<T[K]> } : T;
|
|
239
|
+
type ExtractArgs<F$1> = F$1 extends TypedAbiFunction<infer Args, unknown> ? ArgsTuple<Args> : never;
|
|
240
|
+
type ExtractArgsRecord<F$1> = F$1 extends TypedAbiFunction<infer Args, unknown> ? ArgsRecord<Args> : never;
|
|
255
241
|
type ContractBuilder<T> = (contractAddress: string, contractName: string) => T;
|
|
256
242
|
interface Contract<T> {
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
243
|
+
address: string;
|
|
244
|
+
contractFile: string;
|
|
245
|
+
contract: ContractBuilder<T>;
|
|
246
|
+
abi: ClarityAbi;
|
|
247
|
+
name: string;
|
|
262
248
|
}
|
|
263
249
|
interface Contracts<T> {
|
|
264
|
-
|
|
250
|
+
[key: string]: Contract<T>;
|
|
265
251
|
}
|
|
266
252
|
interface ContractInstance<T> {
|
|
267
|
-
|
|
268
|
-
|
|
253
|
+
identifier: string;
|
|
254
|
+
contract: T;
|
|
269
255
|
}
|
|
270
|
-
type ContractInstances<T extends Contracts<any>> = {
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
256
|
+
type ContractInstances<T extends Contracts<any>> = { [Name in keyof T]: ContractInstance<ReturnType<T[Name]['contract']>> };
|
|
257
|
+
//#endregion
|
|
258
|
+
//#region src/utils.d.ts
|
|
274
259
|
declare const TESTNET_BURN_ADDRESS = "ST000000000000000000002AMW42H";
|
|
275
260
|
declare const MAINNET_BURN_ADDRESS = "SP000000000000000000002Q6VF78";
|
|
276
261
|
declare const toCamelCase: (input: string | number | symbol, titleCase?: boolean) => string;
|
|
@@ -284,150 +269,147 @@ declare function bytesToHex(bytes: Uint8Array): string;
|
|
|
284
269
|
declare function hexToBytes(hexString: string): Uint8Array;
|
|
285
270
|
declare function bytesToAscii(bytes: Uint8Array): string;
|
|
286
271
|
declare const isNumber: (value: number | string) => value is number;
|
|
287
|
-
type ErrorKeyCheck<K> = K extends string ? Lowercase<K> extends `err${string}` ? K : never : never;
|
|
288
|
-
type ErrorCodes<C extends TypedAbi['constants']> = {
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
} ? V : C[K];
|
|
293
|
-
};
|
|
272
|
+
type ErrorKeyCheck<K$1> = K$1 extends string ? Lowercase<K$1> extends `err${string}` ? K$1 : never : never;
|
|
273
|
+
type ErrorCodes<C extends TypedAbi['constants']> = { [K in keyof C as ErrorKeyCheck<K>]: C[K] extends {
|
|
274
|
+
isOk: boolean;
|
|
275
|
+
value: infer V;
|
|
276
|
+
} ? V : C[K] };
|
|
294
277
|
type ProjectErrors<T extends {
|
|
295
|
-
|
|
296
|
-
}> = {
|
|
297
|
-
[K in keyof T['contracts']]: ErrorCodes<T['contracts'][K]['constants']>;
|
|
298
|
-
};
|
|
278
|
+
contracts: AllContracts;
|
|
279
|
+
}> = { [K in keyof T['contracts']]: ErrorCodes<T['contracts'][K]['constants']> };
|
|
299
280
|
declare function extractErrors<T extends TypedAbi>(contract: T): ErrorCodes<T['constants']>;
|
|
300
281
|
declare function projectErrors<T extends {
|
|
301
|
-
|
|
282
|
+
contracts: AllContracts;
|
|
302
283
|
}>(project: T): ProjectErrors<T>;
|
|
303
|
-
|
|
284
|
+
//#endregion
|
|
285
|
+
//#region src/events.d.ts
|
|
304
286
|
declare enum CoreNodeEventType {
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
287
|
+
ContractEvent = "contract_event",
|
|
288
|
+
StxTransferEvent = "stx_transfer_event",
|
|
289
|
+
StxMintEvent = "stx_mint_event",
|
|
290
|
+
StxBurnEvent = "stx_burn_event",
|
|
291
|
+
StxLockEvent = "stx_lock_event",
|
|
292
|
+
NftTransferEvent = "nft_transfer_event",
|
|
293
|
+
NftMintEvent = "nft_mint_event",
|
|
294
|
+
NftBurnEvent = "nft_burn_event",
|
|
295
|
+
FtTransferEvent = "ft_transfer_event",
|
|
296
|
+
FtMintEvent = "ft_mint_event",
|
|
297
|
+
FtBurnEvent = "ft_burn_event",
|
|
316
298
|
}
|
|
317
299
|
type NonStandardClarityValue = unknown;
|
|
318
300
|
interface CoreNodeEventBase {
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
301
|
+
/** 0x-prefix transaction hash. */
|
|
302
|
+
txid: string;
|
|
303
|
+
event_index: number;
|
|
304
|
+
committed: boolean;
|
|
323
305
|
}
|
|
324
306
|
interface SmartContractEvent extends CoreNodeEventBase {
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
307
|
+
type: CoreNodeEventType.ContractEvent;
|
|
308
|
+
contract_event: {
|
|
309
|
+
/** Fully qualified contract ID, e.g. "ST2ZRX0K27GW0SP3GJCEMHD95TQGJMKB7G9Y0X1MH.kv-store" */
|
|
310
|
+
contract_identifier: string;
|
|
311
|
+
topic: string;
|
|
312
|
+
value: NonStandardClarityValue;
|
|
313
|
+
/** Hex encoded Clarity value. */
|
|
314
|
+
raw_value: string;
|
|
315
|
+
};
|
|
334
316
|
}
|
|
335
317
|
interface StxTransferEvent extends CoreNodeEventBase {
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
318
|
+
type: CoreNodeEventType.StxTransferEvent;
|
|
319
|
+
stx_transfer_event: {
|
|
320
|
+
recipient: string;
|
|
321
|
+
sender: string;
|
|
322
|
+
amount: string;
|
|
323
|
+
};
|
|
342
324
|
}
|
|
343
325
|
interface StxMintEvent extends CoreNodeEventBase {
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
326
|
+
type: CoreNodeEventType.StxMintEvent;
|
|
327
|
+
stx_mint_event: {
|
|
328
|
+
recipient: string;
|
|
329
|
+
amount: string;
|
|
330
|
+
};
|
|
349
331
|
}
|
|
350
332
|
interface StxBurnEvent extends CoreNodeEventBase {
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
333
|
+
type: CoreNodeEventType.StxBurnEvent;
|
|
334
|
+
stx_burn_event: {
|
|
335
|
+
sender: string;
|
|
336
|
+
amount: string;
|
|
337
|
+
};
|
|
356
338
|
}
|
|
357
339
|
interface StxLockEvent extends CoreNodeEventBase {
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
340
|
+
type: CoreNodeEventType.StxLockEvent;
|
|
341
|
+
/** TODO: what dis? */
|
|
342
|
+
committed: boolean;
|
|
343
|
+
stx_lock_event: {
|
|
344
|
+
/** String quoted base10 integer. */
|
|
345
|
+
locked_amount: string;
|
|
346
|
+
/** String quoted base10 integer. */
|
|
347
|
+
unlock_height: string;
|
|
348
|
+
/** STX principal associated with the locked tokens. */
|
|
349
|
+
locked_address: string;
|
|
350
|
+
};
|
|
369
351
|
}
|
|
370
352
|
interface NftTransferEvent extends CoreNodeEventBase {
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
353
|
+
type: CoreNodeEventType.NftTransferEvent;
|
|
354
|
+
nft_transfer_event: {
|
|
355
|
+
/** Fully qualified asset ID, e.g. "ST2ZRX0K27GW0SP3GJCEMHD95TQGJMKB7G9Y0X1MH.contract-name.asset-name" */
|
|
356
|
+
asset_identifier: string;
|
|
357
|
+
recipient: string;
|
|
358
|
+
sender: string;
|
|
359
|
+
value: NonStandardClarityValue;
|
|
360
|
+
/** Hex encoded Clarity value. */
|
|
361
|
+
raw_value: string;
|
|
362
|
+
};
|
|
381
363
|
}
|
|
382
364
|
interface NftMintEvent extends CoreNodeEventBase {
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
365
|
+
type: CoreNodeEventType.NftMintEvent;
|
|
366
|
+
nft_mint_event: {
|
|
367
|
+
/** Fully qualified asset ID, e.g. "ST2ZRX0K27GW0SP3GJCEMHD95TQGJMKB7G9Y0X1MH.contract-name.asset-name" */
|
|
368
|
+
asset_identifier: string;
|
|
369
|
+
recipient: string;
|
|
370
|
+
value: NonStandardClarityValue;
|
|
371
|
+
/** Hex encoded Clarity value. */
|
|
372
|
+
raw_value: string;
|
|
373
|
+
};
|
|
392
374
|
}
|
|
393
375
|
interface NftBurnEvent extends CoreNodeEventBase {
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
376
|
+
type: CoreNodeEventType.NftBurnEvent;
|
|
377
|
+
nft_burn_event: {
|
|
378
|
+
/** Fully qualified asset ID, e.g. "ST2ZRX0K27GW0SP3GJCEMHD95TQGJMKB7G9Y0X1MH.contract-name.asset-name" */
|
|
379
|
+
asset_identifier: string;
|
|
380
|
+
sender: string;
|
|
381
|
+
value: NonStandardClarityValue;
|
|
382
|
+
/** Hex encoded Clarity value. */
|
|
383
|
+
raw_value: string;
|
|
384
|
+
};
|
|
403
385
|
}
|
|
404
386
|
interface FtTransferEvent extends CoreNodeEventBase {
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
387
|
+
type: CoreNodeEventType.FtTransferEvent;
|
|
388
|
+
ft_transfer_event: {
|
|
389
|
+
/** Fully qualified asset ID, e.g. "ST2ZRX0K27GW0SP3GJCEMHD95TQGJMKB7G9Y0X1MH.contract-name.asset-name" */
|
|
390
|
+
asset_identifier: string;
|
|
391
|
+
recipient: string;
|
|
392
|
+
sender: string;
|
|
393
|
+
amount: string;
|
|
394
|
+
};
|
|
413
395
|
}
|
|
414
396
|
interface FtMintEvent extends CoreNodeEventBase {
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
397
|
+
type: CoreNodeEventType.FtMintEvent;
|
|
398
|
+
ft_mint_event: {
|
|
399
|
+
/** Fully qualified asset ID, e.g. "ST2ZRX0K27GW0SP3GJCEMHD95TQGJMKB7G9Y0X1MH.contract-name.asset-name" */
|
|
400
|
+
asset_identifier: string;
|
|
401
|
+
recipient: string;
|
|
402
|
+
amount: string;
|
|
403
|
+
};
|
|
422
404
|
}
|
|
423
405
|
interface FtBurnEvent extends CoreNodeEventBase {
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
406
|
+
type: CoreNodeEventType.FtBurnEvent;
|
|
407
|
+
ft_burn_event: {
|
|
408
|
+
/** Fully qualified asset ID, e.g. "ST2ZRX0K27GW0SP3GJCEMHD95TQGJMKB7G9Y0X1MH.contract-name.asset-name" */
|
|
409
|
+
asset_identifier: string;
|
|
410
|
+
sender: string;
|
|
411
|
+
amount: string;
|
|
412
|
+
};
|
|
431
413
|
}
|
|
432
414
|
type CoreNodeEvent = SmartContractEvent | StxTransferEvent | StxMintEvent | StxBurnEvent | StxLockEvent | FtTransferEvent | FtMintEvent | FtBurnEvent | NftTransferEvent | NftMintEvent | NftBurnEvent;
|
|
433
415
|
declare function filterEvents(events: CoreNodeEvent[], type: CoreNodeEventType.ContractEvent): SmartContractEvent[];
|
|
@@ -441,188 +423,102 @@ declare function filterEvents(events: CoreNodeEvent[], type: CoreNodeEventType.N
|
|
|
441
423
|
declare function filterEvents(events: CoreNodeEvent[], type: CoreNodeEventType.FtTransferEvent): FtTransferEvent[];
|
|
442
424
|
declare function filterEvents(events: CoreNodeEvent[], type: CoreNodeEventType.FtMintEvent): FtMintEvent[];
|
|
443
425
|
declare function filterEvents(events: CoreNodeEvent[], type: CoreNodeEventType.FtBurnEvent): FtBurnEvent[];
|
|
444
|
-
|
|
426
|
+
//#endregion
|
|
427
|
+
//#region src/contracts.d.ts
|
|
445
428
|
interface MakeContractsOptions {
|
|
446
|
-
|
|
429
|
+
deployerAddress?: string;
|
|
447
430
|
}
|
|
448
431
|
declare function makeContracts<T extends Contracts<any>>(contracts: T, options?: MakeContractsOptions): ContractInstances<T>;
|
|
449
|
-
|
|
432
|
+
//#endregion
|
|
433
|
+
//#region src/pure/index.d.ts
|
|
450
434
|
interface PureContractInfo {
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
435
|
+
abi: ClarityAbi;
|
|
436
|
+
contractAddress: string;
|
|
437
|
+
contractName: string;
|
|
454
438
|
}
|
|
455
439
|
type ContractFn<T> = (args: any) => T;
|
|
456
440
|
type ContractReturn<C extends ContractFn<ContractCalls.ReadOnly<any>>> = C extends ContractFn<ContractCalls.ReadOnly<infer T>> ? T : unknown;
|
|
457
441
|
type ContractReturnOk<C extends ContractFn<ContractCalls.ReadOnly<any>>> = ContractReturn<C> extends Response<infer O, any> ? O : unknown;
|
|
458
442
|
type ContractReturnErr<C extends ContractFn<ContractCalls.ReadOnly<any>>> = ContractReturn<C> extends Response<any, infer E> ? E : unknown;
|
|
459
443
|
interface MapGet<Key, Val> {
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
444
|
+
map: ClarityAbiMap;
|
|
445
|
+
nativeKey: Key;
|
|
446
|
+
key: ClarityValue;
|
|
447
|
+
contractAddress: string;
|
|
448
|
+
contractName: string;
|
|
465
449
|
}
|
|
466
450
|
declare namespace ContractCalls {
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
451
|
+
type ReadOnly<T> = ContractCall<T>;
|
|
452
|
+
type Public<Ok, Err> = ContractCall<Response<Ok, Err>>;
|
|
453
|
+
type Private<T> = ContractCall<T>;
|
|
454
|
+
type Map<Key, Val> = MapGet<Key, Val>;
|
|
471
455
|
}
|
|
472
456
|
declare const pureProxy: <T extends object>(target: PureContractInfo) => T;
|
|
473
|
-
|
|
457
|
+
//#endregion
|
|
458
|
+
//#region src/api/index.d.ts
|
|
474
459
|
interface ApiOptionsUrl {
|
|
475
|
-
|
|
476
|
-
|
|
460
|
+
url: string;
|
|
461
|
+
network?: undefined;
|
|
477
462
|
}
|
|
478
463
|
type Network = StacksNetwork | StacksNetworkName;
|
|
479
464
|
interface ApiOptionsNetwork {
|
|
480
|
-
|
|
481
|
-
|
|
465
|
+
network: StacksNetworkName | StacksNetwork;
|
|
466
|
+
url?: undefined;
|
|
482
467
|
}
|
|
483
468
|
type ApiOptionsBase = {
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
469
|
+
network: StacksNetwork | StacksNetworkName;
|
|
470
|
+
tip?: string;
|
|
471
|
+
latest?: boolean;
|
|
472
|
+
apiKey?: string;
|
|
473
|
+
headers?: Record<string, string>;
|
|
488
474
|
};
|
|
489
475
|
type ApiOptionsJsonize = ApiOptionsBase & {
|
|
490
|
-
|
|
476
|
+
json: true;
|
|
491
477
|
};
|
|
492
478
|
type ApiOptionsNoJson = ApiOptionsBase & {
|
|
493
|
-
|
|
479
|
+
json?: false | undefined;
|
|
494
480
|
};
|
|
495
481
|
type ApiOptions = ApiOptionsBase & {
|
|
496
|
-
|
|
482
|
+
json?: boolean;
|
|
497
483
|
};
|
|
498
|
-
type JsonIfOption<O extends ApiOptions, R> = O extends ApiOptionsJsonize ? Jsonize<R> : R;
|
|
484
|
+
type JsonIfOption<O extends ApiOptions, R$1> = O extends ApiOptionsJsonize ? Jsonize<R$1> : R$1;
|
|
499
485
|
declare function ro<O extends ApiOptions, T>(tx: ContractCall<T>, options: O): Promise<JsonIfOption<O, T>>;
|
|
500
486
|
declare function roOk<O extends ApiOptions, Ok>(tx: ContractCall<Response<Ok, any>>, options: O): Promise<JsonIfOption<O, Ok>>;
|
|
501
487
|
declare function roErr<O extends ApiOptions, Err>(tx: ContractCall<Response<any, Err>>, options: O): Promise<JsonIfOption<O, Err>>;
|
|
502
488
|
declare function getApiUrl(opts: ApiOptions): string;
|
|
503
489
|
declare function fetchMapGet<Key, Val>(contractId: string, map: TypedAbiMap<Key, Val>, key: Key, options: ApiOptions): Promise<Val | null>;
|
|
504
490
|
declare function broadcast(transaction: StacksTransactionWire, options: ApiOptions): Promise<{
|
|
505
|
-
|
|
506
|
-
|
|
491
|
+
txId: string;
|
|
492
|
+
stacksTransaction: StacksTransactionWire;
|
|
507
493
|
}>;
|
|
508
494
|
type ClientOptions = Omit<ApiOptions, 'network'>;
|
|
509
495
|
type JsonIf<O extends ClientOptions, T> = JsonIfOption<O & ApiOptions, T>;
|
|
510
496
|
declare class ClarigenClient {
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
'contract-name': string;
|
|
523
|
-
'emulated-sender': string;
|
|
524
|
-
path: string;
|
|
525
|
-
};
|
|
526
|
-
}
|
|
527
|
-
interface RequirementPublishTransaction {
|
|
528
|
-
'requirement-publish': {
|
|
529
|
-
'contract-id': string;
|
|
530
|
-
'remap-sender': string;
|
|
531
|
-
'remap-principals': Record<string, string>;
|
|
532
|
-
path: string;
|
|
533
|
-
};
|
|
534
|
-
}
|
|
535
|
-
interface ContractPublishTransaction {
|
|
536
|
-
'contract-publish': {
|
|
537
|
-
'contract-name': string;
|
|
538
|
-
'expected-sender': string;
|
|
539
|
-
path: string;
|
|
540
|
-
};
|
|
541
|
-
}
|
|
542
|
-
interface ContractCallTransaction {
|
|
543
|
-
'contract-call': {
|
|
544
|
-
'contract-id': string;
|
|
545
|
-
'expected-sender': string;
|
|
546
|
-
parameters: Readonly<string[]>;
|
|
547
|
-
method: string;
|
|
548
|
-
};
|
|
549
|
-
}
|
|
550
|
-
interface EmulatedContractCallTransaction {
|
|
551
|
-
'emulated-contract-call': {
|
|
552
|
-
'contract-id': string;
|
|
553
|
-
'emulated-sender': string;
|
|
554
|
-
parameters: Readonly<string[]>;
|
|
555
|
-
method: string;
|
|
556
|
-
};
|
|
557
|
-
}
|
|
558
|
-
interface BtcTransferTransaction {
|
|
559
|
-
'btc-transfer': {
|
|
560
|
-
'expected-sender': string;
|
|
561
|
-
recipient: string;
|
|
562
|
-
'sats-per-byte': string;
|
|
563
|
-
'sats-amount': string;
|
|
564
|
-
};
|
|
565
|
-
}
|
|
566
|
-
type Transaction = EmulatedContractPublishTransaction | RequirementPublishTransaction | ContractPublishTransaction | EmulatedContractCallTransaction | BtcTransferTransaction | ContractCallTransaction;
|
|
567
|
-
interface Batch<T extends Transaction> {
|
|
568
|
-
id: number;
|
|
569
|
-
transactions: Readonly<T[]>;
|
|
570
|
-
}
|
|
571
|
-
interface SimnetAccount {
|
|
572
|
-
address: string;
|
|
573
|
-
name: string;
|
|
574
|
-
balance: string;
|
|
575
|
-
}
|
|
576
|
-
interface SimnetAccountDeployer extends SimnetAccount {
|
|
577
|
-
name: 'deployer';
|
|
578
|
-
}
|
|
579
|
-
interface SimnetDeploymentPlan {
|
|
580
|
-
network: 'simnet';
|
|
581
|
-
genesis: {
|
|
582
|
-
wallets: Readonly<[SimnetAccountDeployer, ...SimnetAccount[]]>;
|
|
583
|
-
contracts: Readonly<string[]>;
|
|
584
|
-
};
|
|
585
|
-
plan: {
|
|
586
|
-
batches: Readonly<Batch<EmulatedContractPublishTransaction | EmulatedContractCallTransaction>[]>;
|
|
587
|
-
};
|
|
588
|
-
}
|
|
589
|
-
interface DevnetDeploymentPlan {
|
|
590
|
-
network: 'devnet';
|
|
591
|
-
plan: {
|
|
592
|
-
batches: Readonly<Batch<RequirementPublishTransaction | ContractPublishTransaction | ContractCallTransaction | BtcTransferTransaction>[]>;
|
|
593
|
-
};
|
|
594
|
-
}
|
|
595
|
-
type TestnetDeploymentPlan = Omit<DevnetDeploymentPlan, 'network'> & {
|
|
596
|
-
network: 'testnet';
|
|
597
|
-
};
|
|
598
|
-
interface MainnetDeploymentPlan {
|
|
599
|
-
network: 'mainnet';
|
|
600
|
-
plan: {
|
|
601
|
-
batches: Readonly<Batch<ContractPublishTransaction | ContractCallTransaction | BtcTransferTransaction>[]>;
|
|
602
|
-
};
|
|
603
|
-
}
|
|
604
|
-
type DeploymentPlan = SimnetDeploymentPlan | DevnetDeploymentPlan | TestnetDeploymentPlan | MainnetDeploymentPlan;
|
|
605
|
-
|
|
497
|
+
apiKey?: string | undefined;
|
|
498
|
+
headers?: Record<string, string> | undefined;
|
|
499
|
+
network: StacksNetwork | StacksNetworkName;
|
|
500
|
+
constructor(networkOrUrl: StacksNetwork | StacksNetworkName, apiKey?: string | undefined, headers?: Record<string, string> | undefined);
|
|
501
|
+
private roOptions;
|
|
502
|
+
ro<T, O extends ClientOptions>(tx: ContractCall<T>, options?: O): Promise<JsonIf<O, T>>;
|
|
503
|
+
roOk<T, O extends ClientOptions>(tx: ContractCall<Response<T, any>>, options?: O): Promise<JsonIf<O, T>>;
|
|
504
|
+
roErr<T, O extends ClientOptions>(tx: ContractCall<Response<any, T>>, options?: O): Promise<JsonIf<O, T>>;
|
|
505
|
+
}
|
|
506
|
+
//#endregion
|
|
507
|
+
//#region src/factory.d.ts
|
|
606
508
|
declare const DEPLOYMENT_NETWORKS: readonly ["devnet", "simnet", "testnet", "mainnet"];
|
|
607
509
|
type DeploymentNetwork = (typeof DEPLOYMENT_NETWORKS)[number];
|
|
608
|
-
type DeploymentsForContracts<C extends AllContracts> = {
|
|
609
|
-
|
|
610
|
-
};
|
|
611
|
-
type ContractDeployments = {
|
|
612
|
-
[key in DeploymentNetwork]: string | null;
|
|
613
|
-
};
|
|
510
|
+
type DeploymentsForContracts<C extends AllContracts> = { [K in keyof C]: ContractDeployments };
|
|
511
|
+
type ContractDeployments = { [key in DeploymentNetwork]: string | null };
|
|
614
512
|
type Project<C extends AllContracts, D extends DeploymentsForContracts<C>> = {
|
|
615
|
-
|
|
616
|
-
|
|
513
|
+
contracts: C;
|
|
514
|
+
deployments: D;
|
|
617
515
|
};
|
|
618
516
|
type FullContractWithIdentifier<C extends TypedAbi, Id extends string> = FullContract<C> & {
|
|
619
|
-
|
|
517
|
+
identifier: Id;
|
|
620
518
|
};
|
|
621
519
|
type IsDeploymentNetwork<T> = T extends DeploymentNetwork ? DeploymentNetwork extends T ? true : false : never;
|
|
622
|
-
type ProjectFactory<P extends Project<any, any>, N extends DeploymentNetwork> = {
|
|
623
|
-
|
|
624
|
-
};
|
|
625
|
-
declare function projectFactory<P extends Project<C, D>, N extends DeploymentNetwork, C extends AllContracts, D extends DeploymentsForContracts<C>>(project: P, network: N): ProjectFactory<P, N>;
|
|
520
|
+
type ProjectFactory<P extends Project<any, any>, N$1 extends DeploymentNetwork> = { [ContractName in keyof P['contracts']]: FullContractWithIdentifier<P['contracts'][ContractName], IsDeploymentNetwork<N$1> extends true ? '' : NonNullable<P['deployments'][ContractName][N$1]>> };
|
|
521
|
+
declare function projectFactory<P extends Project<C, D>, N$1 extends DeploymentNetwork, C extends AllContracts, D extends DeploymentsForContracts<C>>(project: P, network: N$1): ProjectFactory<P, N$1>;
|
|
626
522
|
declare function contractsFactory<T extends AllContracts>(contracts: T, deployer: string): ContractFactory<T>;
|
|
627
523
|
declare function functionsFactory<T extends ContractFunctions>(functions: T, identifier: string): FunctionsToContractCalls<T>;
|
|
628
524
|
/**
|
|
@@ -635,25 +531,27 @@ declare function functionsFactory<T extends ContractFunctions>(functions: T, ide
|
|
|
635
531
|
*/
|
|
636
532
|
declare function contractFactory<T extends TypedAbi, Id extends string>(abi: T, identifier: Id): FullContractWithIdentifier<T, Id>;
|
|
637
533
|
declare function deploymentFactory<T extends AllContracts>(contracts: T, deployer: DeploymentPlan): ContractFactory<T>;
|
|
638
|
-
type MapFactory<M extends TypedAbiMap<K, V>, K, V> = {
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
534
|
+
type MapFactory<M extends TypedAbiMap<K$1, V$1>, K$1, V$1> = {
|
|
535
|
+
key: K$1;
|
|
536
|
+
_v?: V$1;
|
|
537
|
+
keyCV: ClarityValue;
|
|
538
|
+
map: M;
|
|
643
539
|
};
|
|
644
540
|
declare function mapFactory<Key, Val>(map: TypedAbiMap<Key, Val>, key: Key): MapFactory<TypedAbiMap<Key, Val>, Key, Val>;
|
|
645
|
-
|
|
541
|
+
//#endregion
|
|
542
|
+
//#region src/post-conditions.d.ts
|
|
646
543
|
type AbiWithAssets = Pick<FullContract<TypedAbi>, 'non_fungible_tokens' | 'fungible_tokens' | 'identifier'>;
|
|
647
544
|
type AssetNames<T extends AbiWithAssets> = T['non_fungible_tokens'][number]['name'] | T['fungible_tokens'][number]['name'];
|
|
648
545
|
declare function createAssetInfo<T extends AbiWithAssets>(contract: T, asset: AssetNames<T>): `${string}.${string}::${string}`;
|
|
649
546
|
type NftAssetType<T extends AbiWithAssets> = T['non_fungible_tokens'][0] extends {
|
|
650
|
-
|
|
547
|
+
type: infer Type;
|
|
651
548
|
} ? Type extends ClarityAbiType | ReadonlyTuple ? AbiTypeTo<Type> : never : never;
|
|
652
549
|
declare function makeNonFungiblePostCondition<T extends AbiWithAssets>(contract: T, sender: string, condition: 'sent' | 'not-sent', value: NftAssetType<T>): NonFungiblePostCondition;
|
|
653
550
|
declare function makeFungiblePostCondition<T extends AbiWithAssets>(contract: T, sender: string, condition: 'eq' | 'gt' | 'gte' | 'lt' | 'lte', amount: number | bigint | string): FungiblePostCondition;
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
type
|
|
551
|
+
//#endregion
|
|
552
|
+
//#region src/raw-clarity.d.ts
|
|
553
|
+
type RawClarityTypeTo<T extends ClarityAbiType, A$1 = any> = T extends ClarityAbiTypePrimitive ? AbiPrimitiveTo<T> : A$1;
|
|
554
|
+
type ResponseType<F$1 extends TypedAbiFunction<UnknownArgs, any>> = F$1 extends TypedAbiFunction<infer A, infer R> ? R : never;
|
|
657
555
|
declare function rawClarityToValue<T = any>(input: string, type: ClarityAbiType): T;
|
|
658
|
-
|
|
659
|
-
export {
|
|
556
|
+
//#endregion
|
|
557
|
+
export { AbiPrimitiveTo, AbiTupleTo, AbiTypeTo, AllContracts, ApiOptions, ApiOptionsBase, ApiOptionsJsonize, ApiOptionsNetwork, ApiOptionsNoJson, ApiOptionsUrl, ArgsRecord, ArgsTuple, ArgsType, AssetNames, CVInput, ClarigenClient, type ClarityAbi, ClarityAbiArg, ClarityAbiFunction, ClarityAbiMap, ClarityAbiType, ClarityAbiTypeBool, ClarityAbiTypeBuffer, ClarityAbiTypeFungibleToken, ClarityAbiTypeInt128, ClarityAbiTypeList, ClarityAbiTypeNonFungibleToken, ClarityAbiTypeNone, ClarityAbiTypeOptional, ClarityAbiTypePrimitive, ClarityAbiTypePrincipal, ClarityAbiTypeResponse, ClarityAbiTypeStringAscii, ClarityAbiTypeStringUtf8, ClarityAbiTypeTraitReference, ClarityAbiTypeTuple, ClarityAbiTypeUInt128, ClarityAbiVariable, ClarityVersion, Contract, ContractBuilder, ContractCall, ContractCallFunction, ContractCallTyped, type ContractCalls, ContractDeployments, ContractFactory, type ContractFn, ContractFunctions, ContractInstance, ContractInstances, type ContractReturn, type ContractReturnErr, type ContractReturnOk, Contracts, ContractsToContractCalls, CoreNodeEvent, CoreNodeEventBase, CoreNodeEventType, DEPLOYMENT_NETWORKS, DeploymentNetwork, type DeploymentPlan, DeploymentsForContracts, ErrType, ErrorCodes, ExtractArgs, ExtractArgsRecord, FnToContractCall, FtBurnEvent, FtMintEvent, FtTransferEvent, FullContract, FullContractWithIdentifier, FunctionReturnType, FunctionsToContractCalls, JsonIfOption, Jsonize, Kebab, KebabObject, MAINNET_BURN_ADDRESS, MapFactory, Network, NftAssetType, NftBurnEvent, NftMintEvent, NftTransferEvent, NonStandardClarityValue, OkType, Project, ProjectErrors, ProjectFactory, RawClarityTypeTo, ReadonlyTuple, Response, ResponseErr, ResponseOk, ResponseType, ResultAssets, type SimnetDeploymentPlan, SmartContractEvent, StacksEpochId, StxBurnEvent, StxLockEvent, StxMintEvent, StxTransferEvent, TESTNET_BURN_ADDRESS, TupleInput, TypedAbi, TypedAbiArg, TypedAbiFunction, TypedAbiMap, TypedAbiVariable, UnionToIntersection, UnknownArg, UnknownArgs, bootContractIdentifier, broadcast, bytesToAscii, bytesToHex, contractFactory, contractsFactory, createAssetInfo, cvToJSON, cvToString, cvToValue, deploymentFactory, err, expectErr, expectOk, extractErrors, fetchMapGet, filterEvents, findJsTupleKey, functionsFactory, getApiUrl, getContractIdentifier, getContractName, getContractNameFromPath, getContractPrincipalCV, getTypeString, hexToBytes, hexToCvValue, isClarityAbiBuffer, isClarityAbiList, isClarityAbiOptional, isClarityAbiPrimitive, isClarityAbiResponse, isClarityAbiStringAscii, isClarityAbiStringUtf8, isClarityAbiTraitReference, isClarityAbiTuple, isNumber, isResponse, makeContracts, makeFungiblePostCondition, makeNonFungiblePostCondition, mapFactory, ok, parseToCV, principalToString, projectErrors, projectFactory, pureProxy, rawClarityToValue, ro, roErr, roOk, toCamelCase, toKebabCase, transformArgsArray, transformArgsToCV, transformObjectArgs };
|