dj8yfo / app-near-rs Goto Github PK
View Code? Open in Web Editor NEW(unpublished) Near Ledger App
License: Apache License 2.0
(unpublished) Near Ledger App
License: Apache License 2.0
Looking at the tests, I didn’t see a test for 1 yoctoNEAR deposit, which is quite common pattern in NEAR to require the transaction to be signed with a full access key. There are also a few other corner cases, so here is the list of suggested test cases for the NEAR amounts:
INS_GET_PUBLIC_KEY
and INS_GET_WALLET_ID
- #4assert_eq!(mem::size_of::<Transfer>, 16)
assert_eq!(mem::size_of::<TransactionPrefix>, 224)
public_key
, nonce
, block_hash
fields of transaction prefix be displayed as wellassert_eq!(mem::size_of::<CreateAccount>, 0)
AccountId
be Secp256K1PublicKey
representation as hex string 128 bytes long?assert_eq!(mem::size_of::<DeleteAccount>, 76)
assert_eq!(mem::size_of::<DeleteKey>, 65)
assert_eq!(mem::size_of::<Stake>, 88)
assert_eq!(mem::size_of::<AddKey>, 88), assert_eq!(mem::size_of::<FunctionCallPermission>, 328)
assert_eq!(mem::size_of::<DeployContract>, 56)
Vec<u8>
SHA256 in near-cli-rs
assert_eq!(mem::size_of::<FunctionCallCommon>, 88)
, assert_eq!(mem::size_of::<CappedString<200>>, 212)
app-near
app-near
app-near
CreateAccountAction
DeleteAccountAction
app-near
DeleteKeyAction
app-near
StakeAction
app-near
TransferAction
AddKeyAction
app-near
app-near
displays this case identical to Full Access one (Public Key field and access_key.Nonce field of action is not displayed, no details show on Function Call Permission)code
field of action not displayed in app-near
; sha256 of code
field is displayed in app-near-rs
FunctionCallAction
gas
field of action isn't displayed in app-near
(string args
argument)gas
field of action isn't diplayed, binary args
argument displayed as blank in app-near
nep-413
message protocolThe protocol is similar to regular transaction signing, which has 20 bytes of 5-component BIP32Path followed by borsh
serialization of transaction transferred over multiple apdu messages. There're two differences:
2
-> 7
const INS_SIGN_TRANSACTION: u8 = 2; // Instruction code to sign a transaction on the Ledger
const INS_SIGN_NEP413_MESSAGE: u8 = 7; // Instruction code to sign a nep-413 message with Ledger
borsh
serialization of NEP413Payload
:pub struct NEP413Payload {
pub messsage: String,
pub nonce: [u8; 32],
pub recipient: String,
pub callback_url: Option<String>,
}
Sample code which forms and sends such a message is targeted by this link.
nep-366
message protocolThe protocol is similar to regular transaction signing, which has 20 bytes of 5-component BIP32Path followed by borsh
serialization of transaction transferred over multiple apdu messages. There're two differences:
2
-> 8
const INS_SIGN_TRANSACTION: u8 = 2; // Instruction code to sign a transaction on the Ledger
const INS_SIGN_NEP366_DELEGATE_ACTION: u8 = 8; // Instruction code to sign a nep-366 delegate action with Ledger
borsh
serialization of DelegateAction
:pub struct DelegateAction {
/// Signer of the delegated actions
pub sender_id: AccountId,
/// Receiver of the delegated actions.
pub receiver_id: AccountId,
/// List of actions to be executed.
///
/// With the meta transactions MVP defined in NEP-366, nested
/// DelegateActions are not allowed. A separate type is used to enforce it.
pub actions: Vec<NonDelegateAction>,
/// Nonce to ensure that the same delegate action is not sent twice by a
/// relayer and should match for given account's `public_key`.
/// After this action is processed it will increment.
pub nonce: Nonce,
/// The maximal height of the block in the blockchain below which the given DelegateAction is valid.
pub max_block_height: BlockHeight,
/// Public key used to sign this delegated action.
pub public_key: PublicKey,
}
pub type Nonce = u64;
pub type BlockHeight = u64;
Sample code which forms and sends such a message is targeted by this link.
ASCII
-only in LedgerHQ/ledger-device-rust-sdk#124.
These LedgerHQ/ledger-device-rust-sdk#124 and LedgerHQ/ledger-device-rust-sdk#146 haven't been resolved yet, but have been worked around by #47
Looking at the tests, I noticed that gas is printed as a long number that is hard to reason about. It is not critical to see exact amount of gas when signing a transaction, so I suggest we display it with TGas precision (100 TGas, 10.5 TGas)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.