export type CoreIntentLockStatus = 'Unlocked' | 'Locked'; export type CoreGoverningStrategy = 'ConsiderDescendants' | 'CoerceDescendants'; export type CoreReadAccess = {domains: Array, users: Array, endpoints: Array, policies: Array, accounts: Array, transactions: Array, requests: Array, events: Array}; export type CorePermissions = {readAccess: CoreReadAccess}; export type CoreStringsMap = {[key: string]: string}; export type CoreLoginId = {id: string, providerId: string}; export type CoreCreateDomainGenesisUser = {id: string, alias: string, publicKey: unknown, roles: Array, lock: CoreIntentLockStatus, description?: string | undefined, customProperties: CoreStringsMap, loginIds?: Array | undefined}; export type CoreIntentType = 'v0_NotarizeData' | 'v0_ExecuteExtension' | 'v0_CreateDomain' | 'v0_UpdateDomain' | 'v0_UpdateDomainPermissions' | 'v0_UnlockDomain' | 'v0_LockDomain' | 'v0_CreateUser' | 'v0_UpdateUser' | 'v0_UnlockUser' | 'v0_LockUser' | 'v0_CreatePolicy' | 'v0_UpdatePolicy' | 'v0_UnlockPolicy' | 'v0_LockPolicy' | 'v0_CreateVault' | 'v0_UpdateVault' | 'v0_UnlockVault' | 'v0_LockVault' | 'v0_RewrapVaultKeyMaterial' | 'v0_UnlockTicker' | 'v0_LockTicker' | 'v0_CreateEndpoint' | 'v0_UpdateEndpoint' | 'v0_UnlockEndpoint' | 'v0_LockEndpoint' | 'v0_CreateAccount' | 'v0_MigrateSilo3AccountBatch' | 'v0_UpdateAccount' | 'v0_UnlockAccount' | 'v0_LockAccount' | 'v0_AddAccountLedgers' | 'v0_CreateTransactionOrder' | 'v0_ReleaseQuarantinedTransfers' | 'v0_CreateTicker' | 'v0_AttemptTransactionOrderCancellation' | 'v0_ValidateTickers' | 'v0_UpdateTicker' | 'v0_CreateTransferOrder' | 'v0_SignManifest' | 'v0_SetSystemProperty' | 'v0_CreateLedger' | 'v0_UpdateLedger' | 'v0_AddTrustedPublicKeysForMigration' | 'v0_RegisterTrustedPublicKey' | 'v0_CreateBackup' | 'v0_AcknowledgeBackup'; export type CorePolicyScope = 'Self' | 'Descendants' | 'SelfAndDescendants'; export type CoreScriptingEngine = 'Javascript_v0'; export type CorePolicyConditionAnd = {left: CorePolicyCondition, right: CorePolicyCondition, type: 'And'}; export type CorePolicyConditionExpression = {expression: string, type: 'Expression'}; export type CorePolicyConditionOr = {left: CorePolicyCondition, right: CorePolicyCondition, type: 'Or'}; export type CorePolicyCondition = CorePolicyConditionAnd | CorePolicyConditionExpression | CorePolicyConditionOr; export type CoreWorkflowConditionAnd = {left: CoreWorkflowCondition, right: CoreWorkflowCondition, type: 'And'}; export type CoreWorkflowConditionOr = {left: CoreWorkflowCondition, right: CoreWorkflowCondition, type: 'Or'}; export type CoreWorkflowConditionRoleQuorum = {role: string, quorum: number, type: 'RoleQuorum'}; export type CoreWorkflowCondition = CoreWorkflowConditionAnd | CoreWorkflowConditionOr | CoreWorkflowConditionRoleQuorum; export type CoreIntentOrigin = 'UserSigned' | 'SystemSigned'; export type CoreCreateDomainGenesisPolicy = {id: string, alias: string, rank: number, intentTypes?: Array | undefined, scope: CorePolicyScope, scriptingEngine: CoreScriptingEngine, condition?: CorePolicyCondition | undefined, workflow?: Array | undefined, lock: CoreIntentLockStatus, description?: string | undefined, customProperties: CoreStringsMap, intentOrigin?: CoreIntentOrigin | undefined}; export type CoreCreateDomainsPayload = {id: string, alias: string, lock: CoreIntentLockStatus, governingStrategy?: CoreGoverningStrategy | undefined, permissions: CorePermissions, description?: string | undefined, customProperties: CoreStringsMap, users: Array, policies: Array, descendants: Array}; export type CoreRootDomainSetup = {id: string, alias: string, lock: CoreIntentLockStatus, governingStrategy?: CoreGoverningStrategy | undefined, permissions: CorePermissions, description?: string | undefined, customProperties: CoreStringsMap, users: Array, policies: Array, descendants?: Array | undefined}; export type CoreKeyType = 'Secp256r1' | 'Secp256k1' | 'Ed25519'; export type CoreGenesisCryptoSetup = {apiSigning: CoreKeyType, collectionSigning: CoreKeyType, messageSigning: CoreKeyType}; export type CoreValidatedTickerKind = 'Native' | 'Contract' | 'Token'; export type CoreAlgorandTickerProperties = {type: 'Native'}; export type CoreTickerLedgerDetailsAlgorand = {properties: CoreAlgorandTickerProperties, type: 'Algorand'}; export type CoreBitcoinTickerProperties = {type: 'Native'}; export type CoreTickerLedgerDetailsBitcoin = {properties: CoreBitcoinTickerProperties, type: 'Bitcoin'}; export type CoreCardanoTickerProperties = {type: 'Native'}; export type CoreTickerLedgerDetailsCardano = {properties: CoreCardanoTickerProperties, type: 'Cardano'}; export type CoreEthereumTickerPropertiesERC1155 = {address: string, tokenId: string, type: 'ERC1155'}; export type CoreEthereumTickerPropertiesERC20 = {address: string, type: 'ERC20'}; export type CoreEthereumTickerPropertiesERC721 = {address: string, tokenId: string, type: 'ERC721'}; export type CoreEthereumTickerPropertiesNative = {type: 'Native'}; export type CoreEthereumTickerProperties = CoreEthereumTickerPropertiesERC1155 | CoreEthereumTickerPropertiesERC20 | CoreEthereumTickerPropertiesERC721 | CoreEthereumTickerPropertiesNative; export type CoreTickerLedgerDetailsEthereum = {properties: CoreEthereumTickerProperties, type: 'Ethereum'}; export type CoreHederaTickerPropertiesFungibleToken = {id: string, type: 'FungibleToken'}; export type CoreHederaTickerPropertiesNative = {type: 'Native'}; export type CoreHederaTickerPropertiesNonFungibleToken = {id: string, serialNumber: number, type: 'NonFungibleToken'}; export type CoreHederaTickerProperties = CoreHederaTickerPropertiesFungibleToken | CoreHederaTickerPropertiesNative | CoreHederaTickerPropertiesNonFungibleToken; export type CoreTickerLedgerDetailsHedera = {properties: CoreHederaTickerProperties, type: 'Hedera'}; export type CoreSolanaTickerPropertiesNative = {type: 'Native'}; export type CoreSolanaTokenType = 'SPL' | 'SPL2022'; export type CoreSolanaTickerPropertiesToken = {mint: string, tokenType: CoreSolanaTokenType, type: 'Token'}; export type CoreSolanaTickerProperties = CoreSolanaTickerPropertiesNative | CoreSolanaTickerPropertiesToken; export type CoreTickerLedgerDetailsSolana = {properties: CoreSolanaTickerProperties, type: 'Solana'}; export type CoreStellarTickerPropertiesNative = {type: 'Native'}; export type CoreStellarTickerPropertiesToken = {code: string, issuer: string, type: 'Token'}; export type CoreStellarTickerProperties = CoreStellarTickerPropertiesNative | CoreStellarTickerPropertiesToken; export type CoreTickerLedgerDetailsStellar = {properties: CoreStellarTickerProperties, type: 'Stellar'}; export type CoreSubstrateTickerProperties = {type: 'Native'}; export type CoreTickerLedgerDetailsSubstrate = {properties: CoreSubstrateTickerProperties, type: 'Substrate'}; export type CoreTezosTickerProperties = {type: 'Native'}; export type CoreTickerLedgerDetailsTezos = {properties: CoreTezosTickerProperties, type: 'Tezos'}; export type CoreTronTickerPropertiesNative = {type: 'Native'}; export type CoreTronTickerPropertiesTRC20 = {contractAddress: string, type: 'TRC20'}; export type CoreTronTickerProperties = CoreTronTickerPropertiesNative | CoreTronTickerPropertiesTRC20; export type CoreTickerLedgerDetailsTron = {properties: CoreTronTickerProperties, type: 'Tron'}; export type CoreXrplTickerPropertiesFungibleToken = {currencyCode: string, issuer: string, type: 'FungibleToken'}; export type CoreXrplTickerPropertiesMultiPurposeToken = {issuanceId: string, type: 'MultiPurposeToken'}; export type CoreXrplTickerPropertiesNative = {type: 'Native'}; export type CoreXrplTickerProperties = CoreXrplTickerPropertiesFungibleToken | CoreXrplTickerPropertiesMultiPurposeToken | CoreXrplTickerPropertiesNative; export type CoreTickerLedgerDetailsXRPL = {properties: CoreXrplTickerProperties, type: 'XRPL'}; export type CoreTickerLedgerDetails = CoreTickerLedgerDetailsAlgorand | CoreTickerLedgerDetailsBitcoin | CoreTickerLedgerDetailsCardano | CoreTickerLedgerDetailsEthereum | CoreTickerLedgerDetailsHedera | CoreTickerLedgerDetailsSolana | CoreTickerLedgerDetailsStellar | CoreTickerLedgerDetailsSubstrate | CoreTickerLedgerDetailsTezos | CoreTickerLedgerDetailsTron | CoreTickerLedgerDetailsXRPL; export type CoreTickerToValidate = {id: string, ledgerId: string, kind: CoreValidatedTickerKind, name: string, decimals?: number | undefined, symbol?: string | undefined, ledgerDetails: CoreTickerLedgerDetails, lock: CoreIntentLockStatus, description?: string | undefined, customProperties: CoreStringsMap}; export type CoreNotarySystemSignedIntentsEnabledValue = {enabled: boolean}; export type CoreReadWriteSystemPropertyKeyValueNotarySystemSignedIntentsEnabledProperty = {value: CoreNotarySystemSignedIntentsEnabledValue, type: 'NotarySystemSignedIntentsEnabledProperty'}; export type CoreAccountPublicKeyOnly = {value: unknown, type: 'PublicKey'}; export type CoreStateReviewAuthorityValue = {publicKey: CoreAccountPublicKeyOnly}; export type CoreReadWriteSystemPropertyKeyValueStateReviewAuthorityProperty = {value: CoreStateReviewAuthorityValue, type: 'StateReviewAuthorityProperty'}; export type CoreReadWriteSystemPropertyKeyValue = CoreReadWriteSystemPropertyKeyValueNotarySystemSignedIntentsEnabledProperty | CoreReadWriteSystemPropertyKeyValueStateReviewAuthorityProperty; export type CoreLedgerParametersAlgorand = {genesisId: string, genesisHash: string, nativeTickerSymbol: string, nativeTickerName: string, nativeTickerDecimals: number, type: 'Algorand'}; export type CoreBitcoinLikeVaultLedgerIdentifier = 'btc' | 'ltc' | 'bch' | 'doge' | 'dash'; export type CoreNetwork = 'mainnet' | 'testnet' | 'regtest'; export type CoreLedgerParametersBitcoin = {supportsSegWit: boolean, vaultLedgerIdentifier: CoreBitcoinLikeVaultLedgerIdentifier, network: CoreNetwork, tickerSymbol: string, tickerName: string, dustLimit: string, type: 'Bitcoin'}; export type CoreLedgerParametersCardano = {nativeTickerSymbol: string, nativeTickerName: string, testnetMagic?: number | undefined, type: 'Cardano'}; export type CoreEthereumLikeVaultLedgerIdentifier = 'eth' | 'etc'; export type CoreLedgerParametersEthereum = {chainId: number, vaultLedgerIdentifier: CoreEthereumLikeVaultLedgerIdentifier, nativeTickerSymbol: string, nativeTickerName: string, supportsEIP1559: boolean, type: 'Ethereum'}; export type CoreLedgerParametersHedera = {nativeTickerSymbol: string, nativeTickerName: string, type: 'Hedera'}; export type CoreLedgerParametersSolana = {nativeTickerSymbol: string, nativeTickerName: string, lamportsPerSignature: string, type: 'Solana'}; export type CoreLedgerParametersStellar = {nativeTickerSymbol: string, nativeTickerName: string, networkPassphrase: string, type: 'Stellar'}; export type CoreSubstrateFeeParameters = {baseExtrinsic: number, readWeight: number, writeWeight: number, transactionByteFee: string, weightToFeePolynomial: Array, type: 'TransactionPayment'}; export type CoreSubstrateMethodFeeParameters = {base: number, reads: number, writes: number, type: 'MethodWeight'}; export type CoreSubstrateMethodInfo = {name: string, methodId: number, feeParameters: CoreSubstrateMethodFeeParameters}; export type CoreSubstratePalletInfo = {name: string, moduleId: number, methods: Array}; export type CoreSubstrateChainType = 'RelayChain' | 'AssetHub'; export type CoreSubstrateRuntimeInfo = {transactionVersion: number, feeParameters: CoreSubstrateFeeParameters, pallets: Array, chainType?: CoreSubstrateChainType | undefined}; export type CoreLedgerParametersSubstrate = {genesisHash: unknown, addressPrefix: number, nativeTickerSymbol: string, nativeTickerName: string, nativeTickerDecimals: number, supportedRuntimeVersions: Array, type: 'Substrate'}; export type CoreLedgerParametersTezos = {nativeTickerSymbol: string, nativeTickerName: string, chainId: string, type: 'Tezos'}; export type CoreLedgerParametersTron = {nativeTickerSymbol: string, nativeTickerName: string, type: 'Tron'}; export type CoreLedgerParametersXRPL = {nativeTickerSymbol: string, nativeTickerName: string, networkId: number, type: 'XRPL'}; export type CoreLedgerParameters = CoreLedgerParametersAlgorand | CoreLedgerParametersBitcoin | CoreLedgerParametersCardano | CoreLedgerParametersEthereum | CoreLedgerParametersHedera | CoreLedgerParametersSolana | CoreLedgerParametersStellar | CoreLedgerParametersSubstrate | CoreLedgerParametersTezos | CoreLedgerParametersTron | CoreLedgerParametersXRPL; export type CoreCreateLedgerGenesis = {id: string, alias: string, parameters: CoreLedgerParameters, description?: string | undefined, customProperties: CoreStringsMap}; export type CoreGenesisRequest = {rootDomainSetup: CoreRootDomainSetup, cryptoSetup?: CoreGenesisCryptoSetup | undefined, tickers?: Array | undefined, systemProperties?: Array | undefined, ledgers?: Array | undefined, systemSignaturesPublicKey?: unknown | undefined}; export type CreateApiV1GenesisArgs = {body: CoreGenesisRequest}; export type CreateApiV1GenesisOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Run the genesis * * POST /v1/genesis */ export const createApiV1Genesis = async (args: CreateApiV1GenesisArgs, options: CreateApiV1GenesisOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/v1/genesis${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };