Skip to content

Commit

Permalink
feat: upgrade logion types. (polkadot-js#7857)
Browse files Browse the repository at this point in the history
  • Loading branch information
gdethier authored Jul 11, 2022
1 parent 7f622dd commit ad19db0
Show file tree
Hide file tree
Showing 4 changed files with 190 additions and 11 deletions.
2 changes: 1 addition & 1 deletion packages/apps-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"@interlay/interbtc-types": "1.7.0",
"@kiltprotocol/type-definitions": "0.1.23",
"@laminar/type-definitions": "0.3.1",
"@logion/node-api": "0.2.1",
"@logion/node-api": "0.3.1",
"@mangata-finance/types": "^0.5.0",
"@metaverse-network-sdk/type-definitions": "^0.0.1-13",
"@parallel-finance/type-definitions": "1.7.7",
Expand Down
91 changes: 88 additions & 3 deletions packages/apps-config/src/api/spec/logion-parachain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,103 @@

import type { OverrideBundleDefinition } from '@polkadot/types/types';

import logionDefault from '@logion/node-api/dist/interfaces/definitions';

// structs need to be in order
/* eslint-disable sort-keys */

const logionDefault = {
Address: 'MultiAddress',
LookupSource: 'MultiAddress',
PeerId: '(Vec<u8>)',
AccountInfo: 'AccountInfoWithDualRefCount',
TAssetBalance: 'u128',
AssetId: 'u64',
AssetDetails: {
owner: 'AccountId',
issuer: 'AccountId',
admin: 'AccountId',
freezer: 'AccountId',
supply: 'Balance',
deposit: 'DepositBalance',
max_zombies: 'u32',
min_balance: 'Balance',
zombies: 'u32',
accounts: 'u32',
is_frozen: 'bool'
},
AssetMetadata: {
deposit: 'DepositBalance',
name: 'Vec<u8>',
symbol: 'Vec<u8>',
decimals: 'u8'
},
LocId: 'u128',
LegalOfficerCaseOf: {
owner: 'AccountId',
requester: 'Requester',
metadata: 'Vec<MetadataItem>',
files: 'Vec<File>',
closed: 'bool',
loc_type: 'LocType',
links: 'Vec<LocLink>',
void_info: 'Option<LocVoidInfo<LocId>>',
replacer_of: 'Option<LocId>',
collection_last_block_submission: 'Option<BlockNumber>',
collection_max_size: 'Option<CollectionSize>'
},
MetadataItem: {
name: 'Vec<u8>',
value: 'Vec<u8>',
submitter: 'AccountId'
},
LocType: {
_enum: [
'Transaction',
'Identity',
'Collection'
]
},
LocLink: {
id: 'LocId',
nature: 'Vec<u8>'
},
File: {
hash: 'Hash',
nature: 'Vec<u8>',
submitter: 'AccountId'
},
LocVoidInfo: {
replacer: 'Option<LocId>'
},
StorageVersion: {
_enum: [
'V1',
'V2MakeLocVoid',
'V3RequesterEnum',
'V4ItemSubmitter',
'V5Collection'
]
},
Requester: {
_enum: {
None: null,
Account: 'AccountId',
Loc: 'LocId'
}
},
CollectionSize: 'u32',
CollectionItemId: 'Hash',
CollectionItem: {
description: 'Vec<u8>'
}
};

const definitions: OverrideBundleDefinition = {
types: [
{
// on all versions
minmax: [0, undefined],
types: {
...logionDefault.types
...logionDefault
}
}
]
Expand Down
98 changes: 96 additions & 2 deletions packages/apps-config/src/api/spec/logion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,105 @@ import logionDefault, { session as logionSession } from '@logion/node-api/dist/i
// structs need to be in order
/* eslint-disable sort-keys */

const defaultTypesUpTo109 = {
Address: 'MultiAddress',
LookupSource: 'MultiAddress',
PeerId: '(Vec<u8>)',
AccountInfo: 'AccountInfoWithDualRefCount',
TAssetBalance: 'u128',
AssetId: 'u64',
AssetDetails: {
owner: 'AccountId',
issuer: 'AccountId',
admin: 'AccountId',
freezer: 'AccountId',
supply: 'Balance',
deposit: 'DepositBalance',
max_zombies: 'u32',
min_balance: 'Balance',
zombies: 'u32',
accounts: 'u32',
is_frozen: 'bool'
},
AssetMetadata: {
deposit: 'DepositBalance',
name: 'Vec<u8>',
symbol: 'Vec<u8>',
decimals: 'u8'
},
LocId: 'u128',
LegalOfficerCaseOf: {
owner: 'AccountId',
requester: 'Requester',
metadata: 'Vec<MetadataItem>',
files: 'Vec<File>',
closed: 'bool',
loc_type: 'LocType',
links: 'Vec<LocLink>',
void_info: 'Option<LocVoidInfo<LocId>>',
replacer_of: 'Option<LocId>',
collection_last_block_submission: 'Option<BlockNumber>',
collection_max_size: 'Option<CollectionSize>'
},
MetadataItem: {
name: 'Vec<u8>',
value: 'Vec<u8>',
submitter: 'AccountId'
},
LocType: {
_enum: [
'Transaction',
'Identity',
'Collection'
]
},
LocLink: {
id: 'LocId',
nature: 'Vec<u8>'
},
File: {
hash: 'Hash',
nature: 'Vec<u8>',
submitter: 'AccountId'
},
LocVoidInfo: {
replacer: 'Option<LocId>'
},
StorageVersion: {
_enum: [
'V1',
'V2MakeLocVoid',
'V3RequesterEnum',
'V4ItemSubmitter',
'V5Collection'
]
},
Requester: {
_enum: {
None: null,
Account: 'AccountId',
Loc: 'LocId'
}
},
CollectionSize: 'u32',
CollectionItemId: 'Hash',
CollectionItem: {
description: 'Vec<u8>'
}
};

const definitions: OverrideBundleDefinition = {
types: [
{
// on all versions
minmax: [0, undefined],
minmax: [0, 109],
types: {
...defaultTypesUpTo109,
...logionSession.types
}
},
{
// Latest
minmax: [110, undefined],
types: {
...logionDefault.types,
...logionSession.types
Expand Down
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2351,9 +2351,9 @@ __metadata:
languageName: node
linkType: hard

"@logion/node-api@npm:0.2.1":
version: 0.2.1
resolution: "@logion/node-api@npm:0.2.1"
"@logion/node-api@npm:0.3.1":
version: 0.3.1
resolution: "@logion/node-api@npm:0.3.1"
dependencies:
"@polkadot/api": ^8.8.2
"@polkadot/util": ^9.4.1
Expand All @@ -2362,7 +2362,7 @@ __metadata:
fast-sha256: ^1.3.0
moment: ^2.29.1
uuid: ^8.3.2
checksum: c0e30d9a1bfcc28fcfcf6894c0a1f6d4980294b58792f6f4ee34024a4d223ba3645752a5855f6f7ce6302af05ca6d0c717460111aa9cedf74d28677e5dc9a0b5
checksum: 99d76e8654d5609eb3562c3c58e6a3681227d57e7842184c0abc6467714d8054b66696fdda5fbc77f695ff9b7d5b46f23b04653f1fd5a5077caa094ef4c9f352
languageName: node
linkType: hard

Expand Down Expand Up @@ -3045,7 +3045,7 @@ __metadata:
"@interlay/interbtc-types": 1.7.0
"@kiltprotocol/type-definitions": 0.1.23
"@laminar/type-definitions": 0.3.1
"@logion/node-api": 0.2.1
"@logion/node-api": 0.3.1
"@mangata-finance/types": ^0.5.0
"@metaverse-network-sdk/type-definitions": ^0.0.1-13
"@parallel-finance/type-definitions": 1.7.7
Expand Down

0 comments on commit ad19db0

Please sign in to comment.