Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosala committed Aug 30, 2023
1 parent c18bc58 commit 3bdde2e
Show file tree
Hide file tree
Showing 7 changed files with 1,030 additions and 472 deletions.
417 changes: 211 additions & 206 deletions README.md

Large diffs are not rendered by default.

27 changes: 27 additions & 0 deletions app/src/substrate/substrate_strings.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ static const char* STR_MO_REWARDS = "Rewards";
static const char* STR_MO_CONTRACTS = "Contracts";
static const char* STR_MO_POLYMESHCONTRACTS = "Polymeshcontracts";
static const char* STR_MO_PREIMAGE = "Preimage";
static const char* STR_MO_NFT = "Nft";

// Methods names
static const char* STR_ME_REMARK = "Remark";
Expand All @@ -72,6 +73,7 @@ static const char* STR_ME_TRANSFER_WITH_MEMO = "Transfer with memo";
static const char* STR_ME_DEPOSIT_BLOCK_REWARD_RESERVE_BALANCE = "Deposit block reward reserve balance";
static const char* STR_ME_SET_BALANCE = "Set balance";
static const char* STR_ME_BURN_ACCOUNT_BALANCE = "Burn account balance";
static const char* STR_ME_CDD_REGISTER_DID = "Cdd register did";
static const char* STR_ME_INVALIDATE_CDD_CLAIMS = "Invalidate cdd claims";
static const char* STR_ME_ACCEPT_PRIMARY_KEY = "Accept primary key";
static const char* STR_ME_CHANGE_CDD_REQUIREMENT_FOR_MK_ROTATION = "Change cdd requirement for mk rotation";
Expand All @@ -91,7 +93,9 @@ static const char* STR_ME_ADD_SECONDARY_KEYS_WITH_AUTHORIZATION = "Add secondary
static const char* STR_ME_SET_SECONDARY_KEY_PERMISSIONS = "Set secondary key permissions";
static const char* STR_ME_REMOVE_SECONDARY_KEYS = "Remove secondary keys";
static const char* STR_ME_REGISTER_CUSTOM_CLAIM_TYPE = "Register custom claim type";
static const char* STR_ME_CDD_REGISTER_DID_WITH_CDD = "Cdd register did with cdd";
static const char* STR_ME_CREATE_CHILD_IDENTITY = "Create child identity";
static const char* STR_ME_CREATE_CHILD_IDENTITIES = "Create child identities";
static const char* STR_ME_UNLINK_CHILD_IDENTITY = "Unlink child identity";
static const char* STR_ME_SET_ACTIVE_MEMBERS_LIMIT = "Set active members limit";
static const char* STR_ME_DISABLE_MEMBER = "Disable member";
Expand Down Expand Up @@ -197,6 +201,7 @@ static const char* STR_ME_REGISTER_ASSET_METADATA_LOCAL_TYPE = "Register asset m
static const char* STR_ME_REGISTER_ASSET_METADATA_GLOBAL_TYPE = "Register asset metadata global type";
static const char* STR_ME_REDEEM_FROM_PORTFOLIO = "Redeem from portfolio";
static const char* STR_ME_UPDATE_ASSET_TYPE = "Update asset type";
static const char* STR_ME_REMOVE_LOCAL_METADATA_KEY = "Remove local metadata key";
static const char* STR_ME_REMOVE_METADATA_VALUE = "Remove metadata value";
static const char* STR_ME_EXEMPT_TICKER_AFFIRMATION = "Exempt ticker affirmation";
static const char* STR_ME_REMOVE_TICKER_AFFIRMATION_EXEMPTION = "Remove ticker affirmation exemption";
Expand All @@ -208,14 +213,17 @@ static const char* STR_ME_RECLAIM = "Reclaim";
static const char* STR_ME_REMOVE_DISTRIBUTION = "Remove distribution";
static const char* STR_ME_CREATE_CHECKPOINT = "Create checkpoint";
static const char* STR_ME_SET_SCHEDULES_MAX_COMPLEXITY = "Set schedules max complexity";
static const char* STR_ME_CREATE_SCHEDULE = "Create schedule";
static const char* STR_ME_REMOVE_SCHEDULE = "Remove schedule";
static const char* STR_ME_ADD_COMPLIANCE_REQUIREMENT = "Add compliance requirement";
static const char* STR_ME_REMOVE_COMPLIANCE_REQUIREMENT = "Remove compliance requirement";
static const char* STR_ME_REPLACE_ASSET_COMPLIANCE = "Replace asset compliance";
static const char* STR_ME_RESET_ASSET_COMPLIANCE = "Reset asset compliance";
static const char* STR_ME_PAUSE_ASSET_COMPLIANCE = "Pause asset compliance";
static const char* STR_ME_RESUME_ASSET_COMPLIANCE = "Resume asset compliance";
static const char* STR_ME_ADD_DEFAULT_TRUSTED_CLAIM_ISSUER = "Add default trusted claim issuer";
static const char* STR_ME_REMOVE_DEFAULT_TRUSTED_CLAIM_ISSUER = "Remove default trusted claim issuer";
static const char* STR_ME_CHANGE_COMPLIANCE_REQUIREMENT = "Change compliance requirement";
static const char* STR_ME_SET_MAX_DETAILS_LENGTH = "Set max details length";
static const char* STR_ME_SET_DEFAULT_TARGETS = "Set default targets";
static const char* STR_ME_SET_DEFAULT_WITHHOLDING_TAX = "Set default withholding tax";
Expand All @@ -224,6 +232,7 @@ static const char* STR_ME_INITIATE_CORPORATE_ACTION = "Initiate corporate action
static const char* STR_ME_LINK_CA_DOC = "Link ca doc";
static const char* STR_ME_REMOVE_CA = "Remove ca";
static const char* STR_ME_CHANGE_RECORD_DATE = "Change record date";
static const char* STR_ME_INITIATE_CORPORATE_ACTION_AND_DISTRIBUTE = "Initiate corporate action and distribute";
static const char* STR_ME_ATTACH_BALLOT = "Attach ballot";
static const char* STR_ME_CHANGE_END = "Change end";
static const char* STR_ME_CHANGE_META = "Change meta";
Expand All @@ -250,21 +259,27 @@ static const char* STR_ME_DELETE_PORTFOLIO = "Delete portfolio";
static const char* STR_ME_RENAME_PORTFOLIO = "Rename portfolio";
static const char* STR_ME_QUIT_PORTFOLIO_CUSTODY = "Quit portfolio custody";
static const char* STR_ME_ACCEPT_PORTFOLIO_CUSTODY = "Accept portfolio custody";
static const char* STR_ME_MOVE_PORTFOLIO_FUNDS = "Move portfolio funds";
static const char* STR_ME_PRE_APPROVE_PORTFOLIO = "Pre approve portfolio";
static const char* STR_ME_REMOVE_PORTFOLIO_PRE_APPROVAL = "Remove portfolio pre approval";
static const char* STR_ME_CHANGE_COEFFICIENT = "Change coefficient";
static const char* STR_ME_CREATE_VENUE = "Create venue";
static const char* STR_ME_UPDATE_VENUE_DETAILS = "Update venue details";
static const char* STR_ME_UPDATE_VENUE_TYPE = "Update venue type";
static const char* STR_ME_AFFIRM_WITH_RECEIPTS = "Affirm with receipts";
static const char* STR_ME_SET_VENUE_FILTERING = "Set venue filtering";
static const char* STR_ME_ALLOW_VENUES = "Allow venues";
static const char* STR_ME_DISALLOW_VENUES = "Disallow venues";
static const char* STR_ME_UPDATE_VENUE_SIGNERS = "Update venue signers";
static const char* STR_ME_EXECUTE_MANUAL_INSTRUCTION = "Execute manual instruction";
static const char* STR_ME_ADD_INSTRUCTION = "Add instruction";
static const char* STR_ME_ADD_AND_AFFIRM_INSTRUCTION = "Add and affirm instruction";
static const char* STR_ME_AFFIRM_INSTRUCTION = "Affirm instruction";
static const char* STR_ME_WITHDRAW_AFFIRMATION = "Withdraw affirmation";
static const char* STR_ME_REJECT_INSTRUCTION = "Reject instruction";
static const char* STR_ME_EXECUTE_SCHEDULED_INSTRUCTION = "Execute scheduled instruction";
static const char* STR_ME_CREATE_FUNDRAISER = "Create fundraiser";
static const char* STR_ME_INVEST = "Invest";
static const char* STR_ME_FREEZE_FUNDRAISER = "Freeze fundraiser";
static const char* STR_ME_UNFREEZE_FUNDRAISER = "Unfreeze fundraiser";
static const char* STR_ME_MODIFY_FUNDRAISER_WINDOW = "Modify fundraiser window";
Expand All @@ -274,13 +289,17 @@ static const char* STR_ME_REIMBURSEMENT = "Reimbursement";
static const char* STR_ME_BATCH = "Batch";
static const char* STR_ME_RELAY_TX = "Relay tx";
static const char* STR_ME_BATCH_ALL = "Batch all";
static const char* STR_ME_DISPATCH_AS = "Dispatch as";
static const char* STR_ME_FORCE_BATCH = "Force batch";
static const char* STR_ME_WITH_WEIGHT = "With weight";
static const char* STR_ME_BATCH_OLD = "Batch old";
static const char* STR_ME_BATCH_ATOMIC = "Batch atomic";
static const char* STR_ME_BATCH_OPTIMISTIC = "Batch optimistic";
static const char* STR_ME_CREATE_GROUP = "Create group";
static const char* STR_ME_SET_GROUP_PERMISSIONS = "Set group permissions";
static const char* STR_ME_REMOVE_AGENT = "Remove agent";
static const char* STR_ME_ABDICATE = "Abdicate";
static const char* STR_ME_CHANGE_GROUP = "Change group";
static const char* STR_ME_ACCEPT_BECOME_AGENT = "Accept become agent";
static const char* STR_ME_CREATE_GROUP_AND_ADD_AUTH = "Create group and add auth";
static const char* STR_ME_CREATE_AND_CHANGE_CUSTOM_GROUP = "Create and change custom group";
Expand All @@ -301,10 +320,14 @@ static const char* STR_ME_INSTANTIATE_WITH_CODE = "Instantiate with code";
static const char* STR_ME_INSTANTIATE = "Instantiate";
static const char* STR_ME_INSTANTIATE_WITH_CODE_PERMS = "Instantiate with code perms";
static const char* STR_ME_INSTANTIATE_WITH_HASH_PERMS = "Instantiate with hash perms";
static const char* STR_ME_UPDATE_CALL_RUNTIME_WHITELIST = "Update call runtime whitelist";
static const char* STR_ME_NOTE_PREIMAGE = "Note preimage";
static const char* STR_ME_UNNOTE_PREIMAGE = "Unnote preimage";
static const char* STR_ME_REQUEST_PREIMAGE = "Request preimage";
static const char* STR_ME_UNREQUEST_PREIMAGE = "Unrequest preimage";
static const char* STR_ME_CREATE_NFT_COLLECTION = "Create nft collection";
static const char* STR_ME_ISSUE_NFT = "Issue nft";
static const char* STR_ME_REDEEM_NFT = "Redeem nft";

// Items names
static const char* STR_IT_remark = "Remark";
Expand Down Expand Up @@ -518,6 +541,10 @@ static const char* STR_IT_endowment = "Endowment";
static const char* STR_IT_updates = "Updates";
static const char* STR_IT_bytes = "Bytes";
static const char* STR_IT_hash = "Hash";
static const char* STR_IT_nft_type = "Nft type";
static const char* STR_IT_collection_keys = "Collection keys";
static const char* STR_IT_nft_metadata_attributes = "Nft metadata attributes";
static const char* STR_IT_nft_id = "Nft id";

// Country Codes
static const uint8_t COUNTRY_CODES_SIZE = 250;
Expand Down
96 changes: 36 additions & 60 deletions docs/APDUSPEC.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,22 +64,23 @@ The general structure of commands and responses is as follows:

---

### INS_GET_ADDR_ED25519
### INS_GET_ADDR

#### Command

| Field | Type | Content | Expected | |
| ------- | -------- | ------------------------- | ---------- | --- |
| CLA | byte (1) | Application Identifier | 0x91 | |
| INS | byte (1) | Instruction ID | 0x01 | |
| P1 | byte (1) | Request User confirmation | No = 0 | |
| P2 | byte (1) | Parameter 2 | ignored | |
| L | byte (1) | Bytes in payload | (depends) | |
| Path[0] | byte (4) | Derivation Path Data | 0x80000000 | 44 |
| Path[1] | byte (4) | Derivation Path Data | 0x80000000 | 595 |
| Path[2] | byte (4) | Derivation Path Data | ? | |
| Path[3] | byte (4) | Derivation Path Data | ? | |
| Path[4] | byte (4) | Derivation Path Data | ? | |
| Field | Type | Content | Expected | |
| ------- | -------- | ------------------------- | ----------- | --- |
| CLA | byte (1) | Application Identifier | 0x91 | |
| INS | byte (1) | Instruction ID | 0x01 | |
| P1 | byte (1) | Request User confirmation | No = 0 | |
| P2 | byte (1) | Signature scheme | Ed25519 = 0 | |
| | | | Sr25519 = 1 | |
| L | byte (1) | Bytes in payload | (depends) | |
| Path[0] | byte (4) | Derivation Path Data | 0x80000000 | 44 |
| Path[1] | byte (4) | Derivation Path Data | 0x80000000 | 595 |
| Path[2] | byte (4) | Derivation Path Data | ? | |
| Path[3] | byte (4) | Derivation Path Data | ? | |
| Path[4] | byte (4) | Derivation Path Data | ? | |

#### Response

Expand All @@ -91,46 +92,20 @@ The general structure of commands and responses is as follows:

---

### INS_GET_ADDR_SR25519
### INS_SIGN

#### Command

| Field | Type | Content | Expected | |
| ------- | -------- | ------------------------- | ---------- | --- |
| CLA | byte (1) | Application Identifier | 0x91 | |
| INS | byte (1) | Instruction ID | 0x11 | |
| P1 | byte (1) | Request User confirmation | No = 0 | |
| P2 | byte (1) | Parameter 2 | ignored | |
| L | byte (1) | Bytes in payload | (depends) | |
| Path[0] | byte (4) | Derivation Path Data | 0x80000000 | 44 |
| Path[1] | byte (4) | Derivation Path Data | 0x80000000 | 595 |
| Path[2] | byte (4) | Derivation Path Data | ? | |
| Path[3] | byte (4) | Derivation Path Data | ? | |
| Path[4] | byte (4) | Derivation Path Data | ? | |

#### Response

| Field | Type | Content | Note |
| ------- | --------- | ----------- | ------------------------ |
| PK | byte (32) | Public Key | |
| ADDR | byte (??) | DOT address | |
| SW1-SW2 | byte (2) | Return code | see list of return codes |

---

### INS_SIGN_ED25519

#### Command

| Field | Type | Content | Expected |
| ----- | -------- | ---------------------- | --------- |
| CLA | byte (1) | Application Identifier | 0x91 |
| INS | byte (1) | Instruction ID | 0x02 |
| P1 | byte (1) | Payload desc | 0 = init |
| | | | 1 = add |
| | | | 2 = last |
| P2 | byte (1) | ---- | not used |
| L | byte (1) | Bytes in payload | (depends) |
| Field | Type | Content | Expected |
| ----- | -------- | ---------------------- | ----------- |
| CLA | byte (1) | Application Identifier | 0x91 |
| INS | byte (1) | Instruction ID | 0x02 |
| P1 | byte (1) | Payload desc | 0 = init |
| | | | 1 = add |
| | | | 2 = last |
| P2 | byte (1) | Signature scheme | Ed25519 = 0 |
| | | | Sr25519 = 1 |
| L | byte (1) | Bytes in payload | (depends) |

The first packet/chunk includes only the derivation path

Expand Down Expand Up @@ -161,19 +136,20 @@ All other packets/chunks contain data chunks that are described below

---

### INS_SIGN_SR25519
### INS_SIGN_RAW

#### Command

| Field | Type | Content | Expected |
| ----- | -------- | ---------------------- | --------- |
| CLA | byte (1) | Application Identifier | 0x91 |
| INS | byte (1) | Instruction ID | 0x12 |
| P1 | byte (1) | Payload desc | 0 = init |
| | | | 1 = add |
| | | | 2 = last |
| P2 | byte (1) | ---- | not used |
| L | byte (1) | Bytes in payload | (depends) |
| Field | Type | Content | Expected |
| ----- | -------- | ---------------------- | ----------- |
| CLA | byte (1) | Application Identifier | 0x91 |
| INS | byte (1) | Instruction ID | 0x03 |
| P1 | byte (1) | Payload desc | 0 = init |
| | | | 1 = add |
| | | | 2 = last |
| P2 | byte (1) | Signature scheme | Ed25519 = 0 |
| | | | Sr25519 = 1 |
| L | byte (1) | Bytes in payload | (depends) |

The first packet/chunk includes only the derivation path

Expand Down
Loading

0 comments on commit 3bdde2e

Please sign in to comment.