@clarigen/core 1.0.0-next.30 → 1.0.0-next.31
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/index.d.ts +54 -48
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -171,6 +171,59 @@ interface ResultAssets {
|
|
|
171
171
|
assets: Record<string, Record<string, string>>;
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
+
interface ContractCall<T> {
|
|
175
|
+
function: ClarityAbiFunction;
|
|
176
|
+
nativeArgs: any[];
|
|
177
|
+
functionArgs: ClarityValue[];
|
|
178
|
+
contractAddress: string;
|
|
179
|
+
contractName: string;
|
|
180
|
+
_r?: T;
|
|
181
|
+
}
|
|
182
|
+
interface ContractCallTyped<Args extends UnknownArgs, R> extends Omit<ContractCall<R>, 'nativeArgs'> {
|
|
183
|
+
nativeArgs: ArgsType<Args>;
|
|
184
|
+
}
|
|
185
|
+
declare type ContractFunctions = {
|
|
186
|
+
[key: string]: TypedAbiFunction<UnknownArgs, unknown>;
|
|
187
|
+
};
|
|
188
|
+
declare type AllContracts = Record<string, TypedAbi>;
|
|
189
|
+
declare type UnknownArg = TypedAbiArg<unknown, string>;
|
|
190
|
+
declare type UnknownArgs = UnknownArg[];
|
|
191
|
+
declare type ArgsTuple<T extends UnknownArgs> = {
|
|
192
|
+
[K in keyof T]: T[K] extends TypedAbiArg<infer A, string> ? A : never;
|
|
193
|
+
};
|
|
194
|
+
declare type ArgsRecordUnion<T extends TypedAbiArg<unknown, string>> = T extends TypedAbiArg<infer A, infer N> ? {
|
|
195
|
+
[K in T as N]: A;
|
|
196
|
+
} : never;
|
|
197
|
+
declare type InnerUnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
|
198
|
+
declare type Compact<T> = {
|
|
199
|
+
[K in keyof T]: T[K];
|
|
200
|
+
};
|
|
201
|
+
declare type UnionToIntersection<T> = Compact<InnerUnionToIntersection<T>>;
|
|
202
|
+
declare type ArgsRecord<T extends UnknownArgs> = UnionToIntersection<ArgsRecordUnion<T[number]>>;
|
|
203
|
+
declare type ArgsType<T extends UnknownArgs> = [ArgsRecord<T>] | ArgsTuple<T>;
|
|
204
|
+
declare type ContractCallFunction<Args extends UnknownArgs, R> = (...args: ArgsType<Args>) => ContractCallTyped<Args, R>;
|
|
205
|
+
declare type FnToContractCall<T> = T extends TypedAbiFunction<infer Arg, infer R> ? ContractCallFunction<Arg, R> : never;
|
|
206
|
+
declare type FunctionsToContractCalls<T> = T extends ContractFunctions ? {
|
|
207
|
+
[key in keyof T]: FnToContractCall<T[key]>;
|
|
208
|
+
} : never;
|
|
209
|
+
declare type ContractsToContractCalls<T> = T extends AllContracts ? {
|
|
210
|
+
[key in keyof T]: FunctionsToContractCalls<T[key]['functions']>;
|
|
211
|
+
} : never;
|
|
212
|
+
declare type FullContract<T> = T extends TypedAbi ? FunctionsToContractCalls<T['functions']> & T & {
|
|
213
|
+
identifier: string;
|
|
214
|
+
} & {
|
|
215
|
+
contractFile: string;
|
|
216
|
+
} : never;
|
|
217
|
+
declare type ContractFactory<T extends AllContracts> = {
|
|
218
|
+
[key in keyof T]: FullContract<T[key]>;
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
declare type Kebab<T extends string, A extends string = ''> = T extends `${infer F}${infer R}` ? Kebab<R, `${A}${F extends Lowercase<F> ? '' : '-'}${Lowercase<F>}`> : A;
|
|
222
|
+
declare type KebabObject<T> = T extends Uint8Array ? T : T extends Record<string, unknown> ? {
|
|
223
|
+
[K in keyof T as K extends string ? Kebab<K> : K]: KebabObject<T[K]>;
|
|
224
|
+
} : T;
|
|
225
|
+
declare type ExtractArgs<F> = F extends TypedAbiFunction<infer Args, unknown> ? ArgsTuple<Args> : never;
|
|
226
|
+
declare type ExtractArgsRecord<F> = F extends TypedAbiFunction<infer Args, unknown> ? ArgsRecord<Args> : never;
|
|
174
227
|
declare type ContractBuilder<T> = (contractAddress: string, contractName: string) => T;
|
|
175
228
|
interface Contract<T> {
|
|
176
229
|
address: string;
|
|
@@ -345,53 +398,6 @@ interface MakeContractsOptions {
|
|
|
345
398
|
}
|
|
346
399
|
declare function makeContracts<T extends Contracts<any>>(contracts: T, options?: MakeContractsOptions): ContractInstances<T>;
|
|
347
400
|
|
|
348
|
-
interface ContractCall<T> {
|
|
349
|
-
function: ClarityAbiFunction;
|
|
350
|
-
nativeArgs: any[];
|
|
351
|
-
functionArgs: ClarityValue[];
|
|
352
|
-
contractAddress: string;
|
|
353
|
-
contractName: string;
|
|
354
|
-
_r?: T;
|
|
355
|
-
}
|
|
356
|
-
interface ContractCallTyped<Args extends UnknownArgs, R> extends Omit<ContractCall<R>, 'nativeArgs'> {
|
|
357
|
-
nativeArgs: ArgsType<Args>;
|
|
358
|
-
}
|
|
359
|
-
declare type ContractFunctions = {
|
|
360
|
-
[key: string]: TypedAbiFunction<UnknownArgs, unknown>;
|
|
361
|
-
};
|
|
362
|
-
declare type AllContracts = Record<string, TypedAbi>;
|
|
363
|
-
declare type UnknownArg = TypedAbiArg<unknown, string>;
|
|
364
|
-
declare type UnknownArgs = UnknownArg[];
|
|
365
|
-
declare type ArgsTuple<T extends UnknownArgs> = {
|
|
366
|
-
[K in keyof T]: T[K] extends TypedAbiArg<infer A, string> ? A : never;
|
|
367
|
-
};
|
|
368
|
-
declare type ArgsRecordUnion<T extends TypedAbiArg<unknown, string>> = T extends TypedAbiArg<infer A, infer N> ? {
|
|
369
|
-
[K in T as N]: A;
|
|
370
|
-
} : never;
|
|
371
|
-
declare type InnerUnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
|
372
|
-
declare type Compact<T> = {
|
|
373
|
-
[K in keyof T]: T[K];
|
|
374
|
-
};
|
|
375
|
-
declare type UnionToIntersection<T> = Compact<InnerUnionToIntersection<T>>;
|
|
376
|
-
declare type ArgsRecord<T extends UnknownArgs> = UnionToIntersection<ArgsRecordUnion<T[number]>>;
|
|
377
|
-
declare type ArgsType<T extends UnknownArgs> = [ArgsRecord<T>] | ArgsTuple<T>;
|
|
378
|
-
declare type ContractCallFunction<Args extends UnknownArgs, R> = (...args: ArgsType<Args>) => ContractCallTyped<Args, R>;
|
|
379
|
-
declare type FnToContractCall<T> = T extends TypedAbiFunction<infer Arg, infer R> ? ContractCallFunction<Arg, R> : never;
|
|
380
|
-
declare type FunctionsToContractCalls<T> = T extends ContractFunctions ? {
|
|
381
|
-
[key in keyof T]: FnToContractCall<T[key]>;
|
|
382
|
-
} : never;
|
|
383
|
-
declare type ContractsToContractCalls<T> = T extends AllContracts ? {
|
|
384
|
-
[key in keyof T]: FunctionsToContractCalls<T[key]['functions']>;
|
|
385
|
-
} : never;
|
|
386
|
-
declare type FullContract<T> = T extends TypedAbi ? FunctionsToContractCalls<T['functions']> & T & {
|
|
387
|
-
identifier: string;
|
|
388
|
-
} & {
|
|
389
|
-
contractFile: string;
|
|
390
|
-
} : never;
|
|
391
|
-
declare type ContractFactory<T extends AllContracts> = {
|
|
392
|
-
[key in keyof T]: FullContract<T[key]>;
|
|
393
|
-
};
|
|
394
|
-
|
|
395
401
|
interface PureContractInfo {
|
|
396
402
|
abi: ClarityAbi;
|
|
397
403
|
contractAddress: string;
|
|
@@ -538,4 +544,4 @@ declare function functionsFactory<T extends ContractFunctions>(functions: T, ide
|
|
|
538
544
|
declare function contractFactory<T extends TypedAbi, Id extends string>(abi: T, identifier: Id): FullContractWithIdentifier<T, Id>;
|
|
539
545
|
declare function deploymentFactory<T extends AllContracts>(contracts: T, deployer: DeploymentPlan): ContractFactory<T>;
|
|
540
546
|
|
|
541
|
-
export { AbiPrimitiveTo, AbiTupleTo, AbiTypeTo, AllContracts, ArgsType, ClarityAbi, ClarityAbiArg, ClarityAbiFunction, ClarityAbiMap, ClarityAbiType, ClarityAbiTypeBool, ClarityAbiTypeBuffer, ClarityAbiTypeFungibleToken, ClarityAbiTypeInt128, ClarityAbiTypeList, ClarityAbiTypeNonFungibleToken, ClarityAbiTypeNone, ClarityAbiTypeOptional, ClarityAbiTypePrimitive, ClarityAbiTypePrincipal, ClarityAbiTypeResponse, ClarityAbiTypeStringAscii, ClarityAbiTypeStringUtf8, ClarityAbiTypeTraitReference, ClarityAbiTypeTuple, ClarityAbiTypeUInt128, ClarityAbiVariable, Contract, ContractBuilder, ContractCall, ContractCallFunction, ContractCallTyped, ContractCalls, ContractDeployments, ContractFactory, ContractFn, ContractFunctions, ContractInstance, ContractInstances, ContractReturn, ContractReturnErr, ContractReturnOk, Contracts, ContractsToContractCalls, CoreNodeEvent, CoreNodeEventBase, CoreNodeEventType, DEPLOYMENT_NETWORKS, DeploymentNetwork, DeploymentPlan, DeploymentsForContracts, ErrType, FnToContractCall, FtBurnEvent, FtMintEvent, FtTransferEvent, FullContract, FullContractWithIdentifier, FunctionsToContractCalls, MAINNET_BURN_ADDRESS, NftBurnEvent, NftMintEvent, NftTransferEvent, NonStandardClarityValue, OkType, Project, ProjectFactory, Response, ResponseErr, ResponseOk, ResultAssets, SimnetDeploymentPlan, SmartContractEvent, StxBurnEvent, StxLockEvent, StxMintEvent, StxTransferEvent, TESTNET_BURN_ADDRESS, TypedAbi, TypedAbiArg, TypedAbiFunction, TypedAbiMap, TypedAbiVariable, UnionToIntersection, bootContractIdentifier, broadcast, contractFactory, contractsFactory, cvToString, cvToValue, deploymentFactory, err, expectErr, expectOk, fetchMapGet, filterEvents, findJsTupleKey, functionsFactory, getContractIdentifier, getContractNameFromPath, getContractPrincipalCV, hexToCvValue, makeContracts, ok, parseToCV, projectFactory, pureProxy, ro, roErr, roOk, toCamelCase, toKebabCase, transformArgsArray, transformArgsToCV, transformObjectArgs };
|
|
547
|
+
export { AbiPrimitiveTo, AbiTupleTo, AbiTypeTo, AllContracts, ArgsRecord, ArgsTuple, ArgsType, ClarityAbi, ClarityAbiArg, ClarityAbiFunction, ClarityAbiMap, ClarityAbiType, ClarityAbiTypeBool, ClarityAbiTypeBuffer, ClarityAbiTypeFungibleToken, ClarityAbiTypeInt128, ClarityAbiTypeList, ClarityAbiTypeNonFungibleToken, ClarityAbiTypeNone, ClarityAbiTypeOptional, ClarityAbiTypePrimitive, ClarityAbiTypePrincipal, ClarityAbiTypeResponse, ClarityAbiTypeStringAscii, ClarityAbiTypeStringUtf8, ClarityAbiTypeTraitReference, ClarityAbiTypeTuple, ClarityAbiTypeUInt128, ClarityAbiVariable, Contract, ContractBuilder, ContractCall, ContractCallFunction, ContractCallTyped, ContractCalls, ContractDeployments, ContractFactory, ContractFn, ContractFunctions, ContractInstance, ContractInstances, ContractReturn, ContractReturnErr, ContractReturnOk, Contracts, ContractsToContractCalls, CoreNodeEvent, CoreNodeEventBase, CoreNodeEventType, DEPLOYMENT_NETWORKS, DeploymentNetwork, DeploymentPlan, DeploymentsForContracts, ErrType, ExtractArgs, ExtractArgsRecord, FnToContractCall, FtBurnEvent, FtMintEvent, FtTransferEvent, FullContract, FullContractWithIdentifier, FunctionsToContractCalls, Kebab, KebabObject, MAINNET_BURN_ADDRESS, NftBurnEvent, NftMintEvent, NftTransferEvent, NonStandardClarityValue, OkType, Project, ProjectFactory, Response, ResponseErr, ResponseOk, ResultAssets, SimnetDeploymentPlan, SmartContractEvent, StxBurnEvent, StxLockEvent, StxMintEvent, StxTransferEvent, TESTNET_BURN_ADDRESS, TypedAbi, TypedAbiArg, TypedAbiFunction, TypedAbiMap, TypedAbiVariable, UnionToIntersection, bootContractIdentifier, broadcast, contractFactory, contractsFactory, cvToString, cvToValue, deploymentFactory, err, expectErr, expectOk, fetchMapGet, filterEvents, findJsTupleKey, functionsFactory, getContractIdentifier, getContractNameFromPath, getContractPrincipalCV, hexToCvValue, makeContracts, ok, parseToCV, projectFactory, pureProxy, ro, roErr, roOk, toCamelCase, toKebabCase, transformArgsArray, transformArgsToCV, transformObjectArgs };
|
package/package.json
CHANGED