0.5.3 • Published 2 years ago

@dcspark/milkomeda-js-sdk v0.5.3

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

Milkomeda Constants

This is a package that hosts static configurations of Milkomeda deployments. This is useful to avoid having each project integrating Milkomeda hard-coding static configurations.

Contents

Example of the exposed payload of one of the Milkomeda Networks (devnet)

{
    [NETWORK_NAME]: {
        isMainnet: false,
        name: NETWORK_NAME,
        mainchain: {
            protocol: ProtocolNames.cardanoProtocol,
            id: toChainId({
                networkId: registry.Testnet.NetworkId,
                networkMagic: registry.Testnet.NetworkMagic
            })
        },
        sidechain: { protocol: ProtocolNames.evmProtocol, id: 200101 },
        backendEndpoint: BackendEndpoints.devnet,
        protocolMagic: ProtocolMagic.devnet,
        timeIntervalForAddressMs: 86400000,
        sidechainContract: "0x000000000000000000000000000000000000BbBB"
    },
}
  • isMainnet - boolean informing if the specific network configuration is mainnet or not,
  • mainchain - consists of mainchain information such as protocol and its id,
  • sidechain - consists of sidechain information such as protocol name and sidechain id,
  • backendEndpoint - provides url value for the service, which exposes additional information about specific version of the sidechain,
  • protocolMagic - introduces protocol magic compatible with appropriate Milkomeda network,
  • timeIntervalForAddressMs - time interval of a possible address change defined in miliseconds,
  • sidechainContract - address of the sidechain contract to which client can connect to

Additionally, the package introduces helper types & function which returns a JSON object.

# Milkomeda metadata generator
generateMilkomedaMetadata(
    address, # address is EVM address
    protocolMagic # protocol magic for specific network
)

Metadata of a transaction consists of two parameters - protocol magic & evm address. Exemplary metadata for testnet transaction is as follows:

{
    87: "devnet.cardano-evm.c1"
    88: "0xEVM_TESTNET_ADDRESS"
}