Skip to content

Commit

Permalink
Add Liberland
Browse files Browse the repository at this point in the history
  • Loading branch information
peachbits committed Aug 25, 2023
1 parent e1d05af commit 6d0f36a
Show file tree
Hide file tree
Showing 4 changed files with 140 additions and 5 deletions.
6 changes: 5 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import { eosPlugins } from './eos/eosInfos'
import { ethereumPlugins } from './ethereum/ethereumInfos'
import { fio } from './fio/fioInfo'
import { hedera } from './hedera/hederaInfo'
import { polkadot } from './polkadot/polkadotInfo'
import { liberland } from './polkadot/info/liberlandInfo'
import { liberlandtestnet } from './polkadot/info/liberlandTestnetInfo'
import { polkadot } from './polkadot/info/polkadotInfo'
import { ripple } from './ripple/rippleInfo'
import { solana } from './solana/solanaInfo'
import { stellar } from './stellar/stellarInfo'
Expand All @@ -22,6 +24,8 @@ const plugins = {
binance,
fio,
hedera,
liberland,
liberlandtestnet,
piratechain,
polkadot,
ripple,
Expand Down
64 changes: 64 additions & 0 deletions src/polkadot/info/liberlandInfo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import { EdgeCurrencyInfo, EdgeTokenMap } from 'edge-core-js/types'

import { makeOuterPlugin } from '../../common/innerPlugin'
import { makeMetaTokens } from '../../common/tokenHelpers'
import type { PolkadotTools } from '../PolkadotTools'
import type { PolkadotNetworkInfo } from '../polkadotTypes'

const builtinTokens: EdgeTokenMap = {
'1': {
currencyCode: 'LLM',
displayName: 'Liberland Merit',
denominations: [{ name: 'LLM', multiplier: '1000000000000' }],
networkLocation: {
contractAddress: '1' // Assets pallet ID
}
}
}

const networkInfo: PolkadotNetworkInfo = {
rpcNodes: ['wss://mainnet.liberland.org/'],
subscanBaseUrl: '',
subscanQueryLimit: 100,
lengthFeePerByte: '1000000'
}

export const currencyInfo: EdgeCurrencyInfo = {
// Basic currency information:
currencyCode: 'LLD',
displayName: 'Liberland',
pluginId: 'liberland',
walletType: 'wallet:liberland',

defaultSettings: {},

addressExplorer: '',
transactionExplorer:
'https://polkadot.js.org/apps/?rpc=wss%%3A%%2F%%2Fmainnet.liberland.org%%2F#/explorer/query/%s',

denominations: [
// An array of Objects of the possible denominations for this currency
{
name: 'LLD',
multiplier: '1000000000000',
symbol: ''
}
],
metaTokens: makeMetaTokens(builtinTokens) // Deprecated
}

export const liberland = makeOuterPlugin<PolkadotNetworkInfo, PolkadotTools>({
builtinTokens,
currencyInfo,
networkInfo,

checkEnvironment: () => {
if (global.BigInt == null) {
throw new Error('Liberland requires bigint support')
}
},

async getInnerPlugin() {
return await import('../PolkadotTools')
}
})
67 changes: 67 additions & 0 deletions src/polkadot/info/liberlandTestnetInfo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import { EdgeCurrencyInfo, EdgeTokenMap } from 'edge-core-js/types'

import { makeOuterPlugin } from '../../common/innerPlugin'
import { makeMetaTokens } from '../../common/tokenHelpers'
import type { PolkadotTools } from '../PolkadotTools'
import type { PolkadotNetworkInfo } from '../polkadotTypes'

const builtinTokens: EdgeTokenMap = {
'1': {
currencyCode: 'LKN',
displayName: 'Liberland Merit Testnet',
denominations: [{ name: 'LKN', multiplier: '1000000000000' }],
networkLocation: {
contractAddress: '1' // Assets pallet ID
}
}
}

const networkInfo: PolkadotNetworkInfo = {
rpcNodes: ['wss://testchain.liberland.org/'],
subscanBaseUrl: '',
subscanQueryLimit: 100,
lengthFeePerByte: '1000000'
}

export const currencyInfo: EdgeCurrencyInfo = {
// Basic currency information:
currencyCode: 'LDN',
displayName: 'Liberland Testnet',
pluginId: 'liberlandtestnet',
walletType: 'wallet:liberlandtestnet',

defaultSettings: {},

addressExplorer: '',
transactionExplorer:
'https://polkadot.js.org/apps/?rpc=wss%%3A%%2F%%2Ftestchain.liberland.org%%2F#/explorer/query/%s',

denominations: [
// An array of Objects of the possible denominations for this currency
{
name: 'LDN',
multiplier: '1000000000000',
symbol: ''
}
],
metaTokens: makeMetaTokens(builtinTokens) // Deprecated
}

export const liberlandtestnet = makeOuterPlugin<
PolkadotNetworkInfo,
PolkadotTools
>({
builtinTokens,
currencyInfo,
networkInfo,

checkEnvironment: () => {
if (global.BigInt == null) {
throw new Error('Liberland Testnet requires bigint support')
}
},

async getInnerPlugin() {
return await import('../PolkadotTools')
}
})
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { EdgeCurrencyInfo } from 'edge-core-js/types'

import { makeOuterPlugin } from '../common/innerPlugin'
import type { PolkadotTools } from './PolkadotTools'
import type { PolkadotNetworkInfo } from './polkadotTypes'
import { makeOuterPlugin } from '../../common/innerPlugin'
import type { PolkadotTools } from '../PolkadotTools'
import type { PolkadotNetworkInfo } from '../polkadotTypes'

const networkInfo: PolkadotNetworkInfo = {
rpcNodes: ['wss://rpc.polkadot.io'],
Expand Down Expand Up @@ -47,7 +47,7 @@ export const polkadot = makeOuterPlugin<PolkadotNetworkInfo, PolkadotTools>({
async getInnerPlugin() {
return await import(
/* webpackChunkName: "polkadot" */
'./PolkadotTools'
'../PolkadotTools'
)
}
})

0 comments on commit 6d0f36a

Please sign in to comment.