diff --git a/package-lock.json b/package-lock.json index d035eec1b..4cb57de3b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13613,6 +13613,26 @@ "thenify-all": "^1.0.0" } }, + "node_modules/nanoid": { + "version": "3.3.7", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", + "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "optional": true, + "peer": true, + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, "node_modules/natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", @@ -17047,6 +17067,36 @@ "node": ">= 0.4" } }, + "node_modules/postcss": { + "version": "8.4.40", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.40.tgz", + "integrity": "sha512-YF2kKIUzAofPMpfH6hOi2cGnv/HrUlfucspc7pDyvv7kGdqXrfj8SCl/t8owkEgKEuu8ZcRjSOxFxVLqwChZ2Q==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "optional": true, + "peer": true, + "dependencies": { + "nanoid": "^3.3.7", + "picocolors": "^1.0.1", + "source-map-js": "^1.2.0" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, "node_modules/postcss-load-config": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/postcss-load-config/-/postcss-load-config-6.0.1.tgz", @@ -18331,6 +18381,17 @@ "node": ">=0.10.0" } }, + "node_modules/source-map-js": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.0.tgz", + "integrity": "sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg==", + "dev": true, + "optional": true, + "peer": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/source-map-support": { "version": "0.5.13", "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.13.tgz", diff --git a/src/types/account.ts b/src/types/account.ts index 4da859a92..fec5c0754 100644 --- a/src/types/account.ts +++ b/src/types/account.ts @@ -78,19 +78,19 @@ export type SimulateTransactionDetails = { export type EstimateFeeAction = | { - type: TransactionType.INVOKE; + type: typeof TransactionType.INVOKE; payload: AllowArray; } | { - type: TransactionType.DECLARE; + type: typeof TransactionType.DECLARE; payload: DeclareContractPayload; } | { - type: TransactionType.DEPLOY_ACCOUNT; + type: typeof TransactionType.DEPLOY_ACCOUNT; payload: DeployAccountContractPayload; } | { - type: TransactionType.DEPLOY; + type: typeof TransactionType.DEPLOY; payload: UniversalDeployerContractPayload; }; diff --git a/src/types/api/rpcspec_0_6/contract.ts b/src/types/api/rpcspec_0_6/contract.ts index 36987b380..e822c3fff 100644 --- a/src/types/api/rpcspec_0_6/contract.ts +++ b/src/types/api/rpcspec_0_6/contract.ts @@ -11,7 +11,7 @@ export type ABI = Array< FUNCTION | CONSTRUCTOR | L1_HANDLER | EVENT | STRUCT | ENUM | INTERFACE | IMPL >; -export type FUNCTION = { +type FUNCTION = { type: 'function'; name: string; inputs: Array<{ @@ -24,7 +24,7 @@ export type FUNCTION = { state_mutability: 'view' | 'external'; }; -export type CONSTRUCTOR = { +type CONSTRUCTOR = { type: 'constructor'; name: 'constructor'; inputs: Array<{ @@ -33,7 +33,7 @@ export type CONSTRUCTOR = { }>; }; -export type L1_HANDLER = { +type L1_HANDLER = { type: 'l1_handler'; name: string; inputs: Array<{ @@ -46,22 +46,22 @@ export type L1_HANDLER = { state_mutability: 'view' | 'external'; }; -export type EVENT = { +type EVENT = { type: 'event'; name: string; } & (ENUM_EVENT | STRUCT_EVENT); -export type STRUCT_EVENT = { +type STRUCT_EVENT = { kind: 'struct'; members: Array; }; -export type ENUM_EVENT = { +type ENUM_EVENT = { kind: 'enum'; variants: Array; }; -export type STRUCT = { +type STRUCT = { type: 'struct'; name: string; members: Array<{ @@ -70,7 +70,7 @@ export type STRUCT = { }>; }; -export type ENUM = { +type ENUM = { type: 'enum'; name: string; variants: Array<{ @@ -79,21 +79,19 @@ export type ENUM = { }>; }; -export type INTERFACE = { +type INTERFACE = { type: 'interface'; name: string; items: Array; }; -export type IMPL = { +type IMPL = { type: 'impl'; name: string; interface_name: string; }; -export type EVENT_KIND = 'struct' | 'enum'; - -export type EVENT_FIELD = { +type EVENT_FIELD = { name: string; type: string; kind: 'key' | 'data' | 'nested'; diff --git a/src/types/api/rpcspec_0_6/index.ts b/src/types/api/rpcspec_0_6/index.ts index f94bba375..b9bf0f4db 100644 --- a/src/types/api/rpcspec_0_6/index.ts +++ b/src/types/api/rpcspec_0_6/index.ts @@ -2,8 +2,8 @@ * version 0.6.0 */ -export { Methods } from './methods'; -export { ABI } from './contract'; +export * from './methods'; +export * from './contract'; export * as Errors from './errors'; export * as SPEC from './components'; export * from './nonspec'; diff --git a/src/types/api/rpcspec_0_6/methods.ts b/src/types/api/rpcspec_0_6/methods.ts index c0e6c878c..1f96c14b3 100644 --- a/src/types/api/rpcspec_0_6/methods.ts +++ b/src/types/api/rpcspec_0_6/methods.ts @@ -39,8 +39,6 @@ import { TransactionWithHash, } from './nonspec'; -export type Methods = ReadMethods & WriteMethods & TraceMethods; - type ReadMethods = { // Returns the version of the Starknet JSON-RPC specification being used starknet_specVersion: { @@ -328,3 +326,5 @@ type TraceMethods = { errors: Errors.BLOCK_NOT_FOUND | Errors.TRANSACTION_EXECUTION_ERROR; }; }; + +export type Methods = ReadMethods & WriteMethods & TraceMethods; diff --git a/src/types/api/rpcspec_0_6/nonspec.ts b/src/types/api/rpcspec_0_6/nonspec.ts index 676ee45ed..8a9bb7e42 100644 --- a/src/types/api/rpcspec_0_6/nonspec.ts +++ b/src/types/api/rpcspec_0_6/nonspec.ts @@ -39,6 +39,7 @@ import { TXN_RECEIPT, TXN_STATUS, } from './components'; +import { ValuesType } from '../../helpers/valuesType'; // METHOD RESPONSES // response starknet_getClass @@ -107,84 +108,106 @@ export type NonceUpdates = NONCE_UPDATE[]; export type ReplacedClasses = REPLACED_CLASS[]; // Enums Derived From Spec Types (require manual check for changes) -export enum ETransactionType { - DECLARE = 'DECLARE', - DEPLOY = 'DEPLOY', - DEPLOY_ACCOUNT = 'DEPLOY_ACCOUNT', - INVOKE = 'INVOKE', - L1_HANDLER = 'L1_HANDLER', -} - -export enum ESimulationFlag { - SKIP_VALIDATE = 'SKIP_VALIDATE', - SKIP_FEE_CHARGE = 'SKIP_FEE_CHARGE', -} - -export enum ETransactionStatus { - RECEIVED = 'RECEIVED', - REJECTED = 'REJECTED', - ACCEPTED_ON_L2 = 'ACCEPTED_ON_L2', - ACCEPTED_ON_L1 = 'ACCEPTED_ON_L1', -} - -export enum ETransactionFinalityStatus { - ACCEPTED_ON_L2 = 'ACCEPTED_ON_L2', - ACCEPTED_ON_L1 = 'ACCEPTED_ON_L1', -} - -export enum ETransactionExecutionStatus { - SUCCEEDED = 'SUCCEEDED', - REVERTED = 'REVERTED', -} - -export enum EBlockTag { - PENDING = 'pending', - LATEST = 'latest', -} +export const ETransactionType = { + DECLARE: 'DECLARE', + DEPLOY: 'DEPLOY', + DEPLOY_ACCOUNT: 'DEPLOY_ACCOUNT', + INVOKE: 'INVOKE', + L1_HANDLER: 'L1_HANDLER', +} as const; + +export type ETransactionType = ValuesType; + +export const ESimulationFlag = { + SKIP_VALIDATE: 'SKIP_VALIDATE', + SKIP_FEE_CHARGE: 'SKIP_FEE_CHARGE', +} as const; + +export type ESimulationFlag = ValuesType; + +export const ETransactionStatus = { + RECEIVED: 'RECEIVED', + REJECTED: 'REJECTED', + ACCEPTED_ON_L2: 'ACCEPTED_ON_L2', + ACCEPTED_ON_L1: 'ACCEPTED_ON_L1', +} as const; + +export type ETransactionStatus = ValuesType; + +export const ETransactionFinalityStatus = { + ACCEPTED_ON_L2: 'ACCEPTED_ON_L2', + ACCEPTED_ON_L1: 'ACCEPTED_ON_L1', +} as const; + +export type ETransactionFinalityStatus = ValuesType; + +export const ETransactionExecutionStatus = { + SUCCEEDED: 'SUCCEEDED', + REVERTED: 'REVERTED', +} as const; + +export type ETransactionExecutionStatus = ValuesType; + +export const EBlockTag = { + PENDING: 'pending', + LATEST: 'latest', +} as const; + +export type EBlockTag = ValuesType; // 'L1' | 'L2' -export enum EDataAvailabilityMode { - L1 = 'L1', - L2 = 'L2', -} +export const EDataAvailabilityMode = { + L1: 'L1', + L2: 'L2', +} as const; + +export type EDataAvailabilityMode = ValuesType; // 0 | 1 -export enum EDAMode { - L1, - L2, -} +export const EDAMode = { + L1: 0, + L2: 1, +} as const; + +export type EDAMode = ValuesType; /** * V_ Transaction versions HexString * F_ Fee Transaction Versions HexString (2 ** 128 + TRANSACTION_VERSION) */ -export enum ETransactionVersion { - V0 = '0x0', - V1 = '0x1', - V2 = '0x2', - V3 = '0x3', - F0 = '0x100000000000000000000000000000000', - F1 = '0x100000000000000000000000000000001', - F2 = '0x100000000000000000000000000000002', - F3 = '0x100000000000000000000000000000003', -} +export const ETransactionVersion = { + V0: '0x0', + V1: '0x1', + V2: '0x2', + V3: '0x3', + F0: '0x100000000000000000000000000000000', + F1: '0x100000000000000000000000000000001', + F2: '0x100000000000000000000000000000002', + F3: '0x100000000000000000000000000000003', +} as const; + +export type ETransactionVersion = ValuesType; /** * Old Transaction Versions */ -export enum ETransactionVersion2 { - V0 = '0x0', - V1 = '0x1', - V2 = '0x2', - F0 = '0x100000000000000000000000000000000', - F1 = '0x100000000000000000000000000000001', - F2 = '0x100000000000000000000000000000002', -} +export const ETransactionVersion2 = { + V0: '0x0', + V1: '0x1', + V2: '0x2', + F0: '0x100000000000000000000000000000000', + F1: '0x100000000000000000000000000000001', + F2: '0x100000000000000000000000000000002', +} as const; + +export type ETransactionVersion2 = ValuesType; /** * V3 Transaction Versions */ -export enum ETransactionVersion3 { - V3 = '0x3', - F3 = '0x100000000000000000000000000000003', -} +export const ETransactionVersion3 = { + V3: '0x3', + F3: '0x100000000000000000000000000000003', +} as const; + +export type ETransactionVersion3 = ValuesType; diff --git a/src/types/calldata.ts b/src/types/calldata.ts index 4a572f2bf..75729969b 100644 --- a/src/types/calldata.ts +++ b/src/types/calldata.ts @@ -1,21 +1,29 @@ -export enum ValidateType { - DEPLOY = 'DEPLOY', - CALL = 'CALL', - INVOKE = 'INVOKE', -} +import { ValuesType } from './helpers/valuesType'; -export enum Uint { - u8 = 'core::integer::u8', - u16 = 'core::integer::u16', - u32 = 'core::integer::u32', - u64 = 'core::integer::u64', - u128 = 'core::integer::u128', - u256 = 'core::integer::u256', // This one is struct - u512 = 'core::integer::u512', // This one is struct -} +export const ValidateType = { + DEPLOY: 'DEPLOY', + CALL: 'CALL', + INVOKE: 'INVOKE', +} as const; -export enum Literal { - ClassHash = 'core::starknet::class_hash::ClassHash', - ContractAddress = 'core::starknet::contract_address::ContractAddress', - Secp256k1Point = 'core::starknet::secp256k1::Secp256k1Point', -} +export type ValidateType = ValuesType; + +export const Uint = { + u8: 'core::integer::u8', + u16: 'core::integer::u16', + u32: 'core::integer::u32', + u64: 'core::integer::u64', + u128: 'core::integer::u128', + u256: 'core::integer::u256', // This one is struct + u512: 'core::integer::u512', // This one is struct +} as const; + +export type Uint = ValuesType; + +export const Literal = { + ClassHash: 'core::starknet::class_hash::ClassHash', + ContractAddress: 'core::starknet::contract_address::ContractAddress', + Secp256k1Point: 'core::starknet::secp256k1::Secp256k1Point', +} as const; + +export type Literal = ValuesType; diff --git a/src/types/lib/contract/index.ts b/src/types/lib/contract/index.ts index a773f636d..317edda65 100644 --- a/src/types/lib/contract/index.ts +++ b/src/types/lib/contract/index.ts @@ -1,3 +1,4 @@ +import { ValuesType } from '../../helpers/valuesType'; import { LegacyCompiledContract, LegacyContractClass } from './legacy'; import { CompiledSierra, SierraContractClass } from './sierra'; @@ -20,11 +21,13 @@ export type CompiledContract = LegacyCompiledContract | CompiledSierra; export type CairoContract = ContractClass | CompiledContract; // Basic elements -export enum EntryPointType { - EXTERNAL = 'EXTERNAL', - L1_HANDLER = 'L1_HANDLER', - CONSTRUCTOR = 'CONSTRUCTOR', -} +export const EntryPointType = { + EXTERNAL: 'EXTERNAL', + L1_HANDLER: 'L1_HANDLER', + CONSTRUCTOR: 'CONSTRUCTOR', +} as const; + +export type EntryPointType = ValuesType; export * from './abi'; export * from './legacy'; diff --git a/src/types/lib/index.ts b/src/types/lib/index.ts index 425211b2d..c5f4d8a34 100644 --- a/src/types/lib/index.ts +++ b/src/types/lib/index.ts @@ -1,3 +1,4 @@ +import { ValuesType } from '../helpers/valuesType'; import { StarknetChainId } from '../../constants'; import { weierstrass } from '../../utils/ec'; import { EDataAvailabilityMode, ResourceBounds } from '../api'; @@ -160,50 +161,62 @@ export type InvocationsDetailsWithNonce = | (InvocationsDetails & { nonce: BigNumberish }) | V3TransactionDetails; -export enum TransactionType { - DECLARE = 'DECLARE', - DEPLOY = 'DEPLOY', - DEPLOY_ACCOUNT = 'DEPLOY_ACCOUNT', - INVOKE = 'INVOKE_FUNCTION', -} +export const TransactionType = { + DECLARE: 'DECLARE', + DEPLOY: 'DEPLOY', + DEPLOY_ACCOUNT: 'DEPLOY_ACCOUNT', + INVOKE: 'INVOKE_FUNCTION', +} as const; + +export type TransactionType = ValuesType; /** * new statuses are defined by props: finality_status and execution_status * to be #deprecated */ -export enum TransactionStatus { - NOT_RECEIVED = 'NOT_RECEIVED', - RECEIVED = 'RECEIVED', - ACCEPTED_ON_L2 = 'ACCEPTED_ON_L2', - ACCEPTED_ON_L1 = 'ACCEPTED_ON_L1', - REJECTED = 'REJECTED', - REVERTED = 'REVERTED', -} - -export enum TransactionFinalityStatus { - NOT_RECEIVED = 'NOT_RECEIVED', - RECEIVED = 'RECEIVED', - ACCEPTED_ON_L2 = 'ACCEPTED_ON_L2', - ACCEPTED_ON_L1 = 'ACCEPTED_ON_L1', -} - -export enum TransactionExecutionStatus { - REJECTED = 'REJECTED', - REVERTED = 'REVERTED', - SUCCEEDED = 'SUCCEEDED', -} - -export enum BlockStatus { - PENDING = 'PENDING', - ACCEPTED_ON_L1 = 'ACCEPTED_ON_L1', - ACCEPTED_ON_L2 = 'ACCEPTED_ON_L2', - REJECTED = 'REJECTED', -} - -export enum BlockTag { - PENDING = 'pending', - LATEST = 'latest', -} +export const TransactionStatus = { + NOT_RECEIVED: 'NOT_RECEIVED', + RECEIVED: 'RECEIVED', + ACCEPTED_ON_L2: 'ACCEPTED_ON_L2', + ACCEPTED_ON_L1: 'ACCEPTED_ON_L1', + REJECTED: 'REJECTED', + REVERTED: 'REVERTED', +} as const; + +export type TransactionStatus = ValuesType; + +export const TransactionFinalityStatus = { + NOT_RECEIVED: 'NOT_RECEIVED', + RECEIVED: 'RECEIVED', + ACCEPTED_ON_L2: 'ACCEPTED_ON_L2', + ACCEPTED_ON_L1: 'ACCEPTED_ON_L1', +} as const; + +export type TransactionFinalityStatus = ValuesType; + +export const TransactionExecutionStatus = { + REJECTED: 'REJECTED', + REVERTED: 'REVERTED', + SUCCEEDED: 'SUCCEEDED', +} as const; + +export type TransactionExecutionStatus = ValuesType; + +export const BlockStatus = { + PENDING: 'PENDING', + ACCEPTED_ON_L1: 'ACCEPTED_ON_L1', + ACCEPTED_ON_L2: 'ACCEPTED_ON_L2', + REJECTED: 'REJECTED', +} as const; + +export type BlockStatus = ValuesType; + +export const BlockTag = { + PENDING: 'pending', + LATEST: 'latest', +} as const; + +export type BlockTag = ValuesType; export type BlockNumber = BlockTag | null | number; diff --git a/src/types/provider/response.ts b/src/types/provider/response.ts index a91534778..e4cd70411 100644 --- a/src/types/provider/response.ts +++ b/src/types/provider/response.ts @@ -71,7 +71,7 @@ export interface MessageToL1 { export type RevertedTransactionReceiptResponse = { type?: TransactionType | any; // RPC only // any due to RPC Spec issue - execution_status: TransactionExecutionStatus.REVERTED | any; // any due to RPC Spec issue + execution_status: typeof TransactionExecutionStatus.REVERTED | any; // any due to RPC Spec issue finality_status: TransactionFinalityStatus | any; status?: TransactionStatus; // SEQ only actual_fee: string; @@ -85,7 +85,7 @@ export type RevertedTransactionReceiptResponse = { }; export type RejectedTransactionReceiptResponse = { - status: `${TransactionStatus.REJECTED}`; + status: typeof TransactionStatus.REJECTED; transaction_failure_reason: { code: string; error_message: string; diff --git a/src/utils/calldata/enum/CairoOption.ts b/src/utils/calldata/enum/CairoOption.ts index 13a8df94d..53e83ba6a 100644 --- a/src/utils/calldata/enum/CairoOption.ts +++ b/src/utils/calldata/enum/CairoOption.ts @@ -1,7 +1,11 @@ -export enum CairoOptionVariant { - Some = 0, - None = 1, -} +import { ValuesType } from '../../../types/helpers/valuesType'; + +export const CairoOptionVariant = { + Some: 0, + None: 1, +} as const; + +export type CairoOptionVariant = ValuesType; /** * Class to handle Cairo Option @@ -18,8 +22,8 @@ export class CairoOption { readonly None?: boolean; - constructor(variant: CairoOptionVariant, someContent?: T) { - if (!(variant in CairoOptionVariant)) { + constructor(variant: CairoOptionVariant | number, someContent?: T) { + if (!(variant in Object.values(CairoOptionVariant))) { throw new Error('Wrong variant : should be CairoOptionVariant.Some or .None.'); } if (variant === CairoOptionVariant.Some) { diff --git a/src/utils/calldata/enum/CairoResult.ts b/src/utils/calldata/enum/CairoResult.ts index f6fae9467..c09a0b46a 100644 --- a/src/utils/calldata/enum/CairoResult.ts +++ b/src/utils/calldata/enum/CairoResult.ts @@ -1,7 +1,11 @@ -export enum CairoResultVariant { - Ok = 0, - Err = 1, -} +import { ValuesType } from '../../../types/helpers/valuesType'; + +export const CairoResultVariant = { + Ok: 0, + Err: 1, +} as const; + +export type CairoResultVariant = ValuesType; /** * Class to handle Cairo Result @@ -18,8 +22,8 @@ export class CairoResult { readonly Err?: U; - constructor(variant: CairoResultVariant, resultContent: T | U) { - if (!(variant in CairoResultVariant)) { + constructor(variant: CairoResultVariant | number, resultContent: T | U) { + if (!(variant in Object.values(CairoResultVariant))) { throw new Error('Wrong variant : should be CairoResultVariant.Ok or .Err.'); } if (variant === CairoResultVariant.Ok) { diff --git a/src/utils/starknetId.ts b/src/utils/starknetId.ts index 3e3b42db9..5df3ad48e 100644 --- a/src/utils/starknetId.ts +++ b/src/utils/starknetId.ts @@ -124,10 +124,10 @@ export function useEncoded(decoded: string): bigint { return encoded; } -export enum StarknetIdContract { - MAINNET = '0x6ac597f8116f886fa1c97a23fa4e08299975ecaf6b598873ca6792b9bbfb678', - TESTNET_SEPOLIA = '0x154bc2e1af9260b9e66af0e9c46fc757ff893b3ff6a85718a810baf1474', -} +export const StarknetIdContract = { + MAINNET: '0x6ac597f8116f886fa1c97a23fa4e08299975ecaf6b598873ca6792b9bbfb678', + TESTNET_SEPOLIA: '0x154bc2e1af9260b9e66af0e9c46fc757ff893b3ff6a85718a810baf1474', +} as const; /** * Returns the Starknet ID contract address based on the provided chain ID. @@ -154,10 +154,10 @@ export function getStarknetIdContract(chainId: StarknetChainId): string { } } -export enum StarknetIdIdentityContract { - MAINNET = '0x05dbdedc203e92749e2e746e2d40a768d966bd243df04a6b712e222bc040a9af', - TESTNET_SEPOLIA = '0x3697660a0981d734780731949ecb2b4a38d6a58fc41629ed611e8defda', -} +export const StarknetIdIdentityContract = { + MAINNET: '0x05dbdedc203e92749e2e746e2d40a768d966bd243df04a6b712e222bc040a9af', + TESTNET_SEPOLIA: '0x3697660a0981d734780731949ecb2b4a38d6a58fc41629ed611e8defda', +} as const; /** * Returns the Starknet ID identity contract address for the given chain ID. @@ -214,10 +214,10 @@ export function getStarknetIdMulticallContract(chainId: StarknetChainId): string } } -export enum StarknetIdVerifierContract { - MAINNET = '0x07d14dfd8ee95b41fce179170d88ba1f0d5a512e13aeb232f19cfeec0a88f8bf', - TESTNET_SEPOLIA = '0x60B94fEDe525f815AE5E8377A463e121C787cCCf3a36358Aa9B18c12c4D566', -} +export const StarknetIdVerifierContract = { + MAINNET: '0x07d14dfd8ee95b41fce179170d88ba1f0d5a512e13aeb232f19cfeec0a88f8bf', + TESTNET_SEPOLIA: '0x60B94fEDe525f815AE5E8377A463e121C787cCCf3a36358Aa9B18c12c4D566', +} as const; /** * Returns the address of the Starknet ID Verifier contract based on the specified chain ID. @@ -244,10 +244,10 @@ export function getStarknetIdVerifierContract(chainId: StarknetChainId): string } } -export enum StarknetIdPfpContract { - MAINNET = '0x070aaa20ec4a46da57c932d9fd89ca5e6bb9ca3188d3df361a32306aff7d59c7', - TESTNET_SEPOLIA = '0x9e7bdb8dabd02ea8cfc23b1d1c5278e46490f193f87516ed5ff2dfec02', -} +export const StarknetIdPfpContract = { + MAINNET: '0x070aaa20ec4a46da57c932d9fd89ca5e6bb9ca3188d3df361a32306aff7d59c7', + TESTNET_SEPOLIA: '0x9e7bdb8dabd02ea8cfc23b1d1c5278e46490f193f87516ed5ff2dfec02', +} as const; /** * Retrieves the contract address of the Starknet.id profile picture verifier contract based on the given chain ID. @@ -276,10 +276,10 @@ export function getStarknetIdPfpContract(chainId: StarknetChainId): string { } } -export enum StarknetIdPopContract { - MAINNET = '0x0293eb2ba9862f762bd3036586d5755a782bd22e6f5028320f1d0405fd47bff4', - TESTNET_SEPOLIA = '0x15ae88ae054caa74090b89025c1595683f12edf7a4ed2ad0274de3e1d4a', -} +export const StarknetIdPopContract = { + MAINNET: '0x0293eb2ba9862f762bd3036586d5755a782bd22e6f5028320f1d0405fd47bff4', + TESTNET_SEPOLIA: '0x15ae88ae054caa74090b89025c1595683f12edf7a4ed2ad0274de3e1d4a', +} as const; /** * Retrieves the Starknet ID Proof of Personhood (IdPop) verifier contract address for the given chain ID. diff --git a/tsconfig.json b/tsconfig.json index 324ccba44..162031dac 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,6 @@ { "compilerOptions": { /* Visit https://aka.ms/tsconfig.json to read more about this file */ - /* Projects */ // "incremental": true, /* Enable incremental compilation */ // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ @@ -9,7 +8,6 @@ // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects */ // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ - /* Language and Environment */ "target": "ES2022" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */, "lib": [ @@ -25,7 +23,6 @@ // "reactNamespace": "", /* Specify the object invoked for `createElement`. This only applies when targeting `react` JSX emit. */ // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ - /* Modules */ "module": "ES2022" /* Specify what module code is generated. */, // "rootDir": "./", /* Specify the root folder within your source files. */ @@ -38,12 +35,10 @@ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ // "resolveJsonModule": true, /* Enable importing .json files */ // "noResolve": true, /* Disallow `import`s, `require`s or ``s from expanding the number of files TypeScript should add to a project. */ - /* JavaScript Support */ // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */ // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */ - /* Emit */ "declaration": true /* Generate .d.ts files from TypeScript and JavaScript files in your project. */, // "declarationMap": true, /* Create sourcemaps for d.ts files. */ @@ -67,14 +62,12 @@ // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ // "preserveConstEnums": true, /* Disable erasing `const enum` declarations in generated code. */ // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ - /* Interop Constraints */ // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */, // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */, - /* Type Checking */ "strict": true /* Enable all strict type-checking options. */ // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied `any` type.. */ @@ -95,7 +88,6 @@ // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type */ // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ - /* Completeness */ // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ // "skipLibCheck": true /* Skip type checking all .d.ts files. */