-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #228 from logion-network/feature/invited-contributor
Invited Contributor / Misc
- Loading branch information
Showing
28 changed files
with
4,774 additions
and
3,026 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"name": "Client (Browser)", | ||
"name": "client-browser", | ||
"entryPoints": [ | ||
"./src/index.ts" | ||
] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"name": "Client (Node.JS)", | ||
"name": "client-node", | ||
"entryPoints": [ | ||
"./src/index.ts" | ||
] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"name": "Client (React Native FS)", | ||
"name": "client-react-native-fs", | ||
"entryPoints": [ | ||
"./src/index.ts" | ||
] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"name": "Client", | ||
"name": "client", | ||
"entryPoints": [ | ||
"./src/index.ts" | ||
] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"name": "Crossmint", | ||
"name": "crossmint", | ||
"entryPoints": [ | ||
"./src/index.ts" | ||
] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"name": "Extension", | ||
"name": "extension", | ||
"entryPoints": [ | ||
"./src/index.ts" | ||
] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { setup, ALICE, REQUESTER, signAndSend } from "./Util.js"; | ||
import { UUID } from "../src/index.js"; | ||
|
||
export async function createIdentityLocTest() { | ||
const { requester, alice, api } = await setup(); | ||
|
||
const createLocExtrinsic = api.polkadot.tx.logionLoc.createPolkadotIdentityLoc( | ||
api.adapters.toLocId(IDENTITY_LOC_ID), | ||
ALICE, | ||
0n, | ||
api.adapters.emptyPalletLogionLocItemsParams(), | ||
); | ||
await signAndSend(requester, createLocExtrinsic); | ||
|
||
const closeExtrinsic = api.polkadot.tx.logionLoc.close( | ||
api.adapters.toLocId(IDENTITY_LOC_ID), | ||
null, | ||
true, | ||
); | ||
await signAndSend(alice, closeExtrinsic); | ||
|
||
const loc = await api.queries.getLegalOfficerCase(IDENTITY_LOC_ID); | ||
expect(loc?.owner).toBe(ALICE); | ||
expect(loc?.requesterAddress?.address).toBe(REQUESTER); | ||
expect(loc?.requesterAddress?.type).toBe("Polkadot"); | ||
expect(loc?.closed).toBe(true); | ||
expect(loc?.locType).toBe("Identity"); | ||
} | ||
|
||
const IDENTITY_LOC_ID = new UUID("9cecf5ad-f1b3-40de-be62-37b43305bd9d"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import { UUID, Adapters, Hash, Lgnt } from "../src/index.js"; | ||
import { ALICE, INVITED_CONTRIBUTOR, setup, signAndSend, signAndSendBatch } from "./Util.js"; | ||
|
||
export async function invitedContributors() { | ||
const { api, alice, invitedContributor, requester } = await setup(); | ||
|
||
const invitedContributorIdentityLocId = new UUID(); | ||
const collectionLocId = new UUID(); | ||
await signAndSend(alice, | ||
api.polkadot.tx.balances.transferAllowDeath(INVITED_CONTRIBUTOR, Lgnt.from(200).canonical), | ||
); | ||
await signAndSend(invitedContributor, | ||
api.polkadot.tx.logionLoc.createPolkadotIdentityLoc( | ||
invitedContributorIdentityLocId.toDecimalString(), | ||
ALICE, | ||
0, | ||
api.adapters.emptyPalletLogionLocItemsParams(), | ||
), | ||
); | ||
await signAndSend(alice, | ||
api.polkadot.tx.logionLoc.close( | ||
invitedContributorIdentityLocId.toDecimalString(), | ||
null, | ||
false, | ||
), | ||
); | ||
await signAndSendBatch(requester, [ | ||
api.polkadot.tx.logionLoc.createCollectionLoc( | ||
collectionLocId.toDecimalString(), | ||
ALICE, | ||
null, | ||
200, | ||
true, | ||
0, | ||
0, | ||
0, | ||
0, | ||
api.adapters.emptyPalletLogionLocItemsParams(), | ||
), | ||
api.polkadot.tx.logionLoc.setInvitedContributorSelection( | ||
collectionLocId.toDecimalString(), | ||
INVITED_CONTRIBUTOR, | ||
true, | ||
), | ||
]); | ||
await signAndSend(alice, | ||
api.polkadot.tx.logionLoc.close( | ||
collectionLocId.toDecimalString(), | ||
null, | ||
false, | ||
), | ||
); | ||
|
||
const recordId = "0x5b2ef8140cfcf72237f2182b9f5eb05eb643a26f9a823e5e804d5543976a4fb9"; | ||
const recordDescription = Hash.of("Some description"); | ||
const recordFileName = Hash.of("File name"); | ||
const recordFileContentType = Hash.of("text/plain"); | ||
const recordFileSize = "5"; | ||
const recordFileHash = Hash.fromHex("0x7d6fd7774f0d87624da6dcf16d0d3d104c3191e771fbe2f39c86aed4b2bf1a0f"); | ||
await signAndSend(invitedContributor, api.polkadot.tx.logionLoc.addTokensRecord( | ||
api.adapters.toLocId(collectionLocId), | ||
recordId, | ||
recordDescription.bytes, | ||
api.adapters.newTokensRecordFileVec([ | ||
{ | ||
name: recordFileName, | ||
contentType: recordFileContentType, | ||
size: recordFileSize, | ||
hash: recordFileHash, | ||
} | ||
]), | ||
)); | ||
|
||
const record = Adapters.toTokensRecord((await api.polkadot.query.logionLoc.tokensRecordsMap(collectionLocId.toDecimalString(), recordId)).unwrap()); | ||
expect(record.description).toEqual(recordDescription); | ||
expect(record.files.length).toBe(1); | ||
expect(record.files[0].name).toEqual(recordFileName); | ||
expect(record.files[0].contentType).toEqual(recordFileContentType); | ||
expect(record.files[0].size).toBe(recordFileSize); | ||
expect(record.files[0].hash).toEqual(recordFileHash); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"name": "Node API", | ||
"name": "node-api", | ||
"entryPoints": [ | ||
"./src/index.ts" | ||
] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.