@bitgo-beta/account-lib 2.24.1-alpha.50 → 2.24.1-alpha.500
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/resources/dot/index.js +6 -2
- package/dist/resources/dot/westend.d.ts +1 -1
- package/dist/resources/dot/westend.d.ts.map +1 -1
- package/dist/resources/dot/westend.js +2 -2
- package/dist/resources/dot/westend.ts +1 -1
- package/dist/src/index.d.ts +114 -4
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +269 -17
- package/dist/src/keyPair/index.js +24 -11
- package/dist/src/utils/index.d.ts +1 -0
- package/dist/src/utils/index.d.ts.map +1 -1
- package/dist/src/utils/index.js +27 -10
- package/dist/src/utils/messages/index.d.ts +10 -0
- package/dist/src/utils/messages/index.d.ts.map +1 -0
- package/dist/src/utils/messages/index.js +30 -0
- package/dist/test/resources/ed25519Deriver.d.ts +15 -0
- package/dist/test/resources/ed25519Deriver.d.ts.map +1 -0
- package/dist/test/resources/ed25519Deriver.js +18 -0
- package/dist/test/resources/testTransaction.d.ts +11 -0
- package/dist/test/resources/testTransaction.d.ts.map +1 -0
- package/dist/test/resources/testTransaction.js +19 -0
- package/dist/test/resources/testTransactionBuilder.d.ts +26 -0
- package/dist/test/resources/testTransactionBuilder.d.ts.map +1 -0
- package/dist/test/resources/testTransactionBuilder.js +47 -0
- package/dist/test/unit/coin/baseCoin/transactionBuilder.d.ts +2 -0
- package/dist/test/unit/coin/baseCoin/transactionBuilder.d.ts.map +1 -0
- package/dist/test/unit/coin/baseCoin/transactionBuilder.js +135 -0
- package/dist/test/unit/fixtures.d.ts +16 -0
- package/dist/test/unit/fixtures.d.ts.map +1 -0
- package/dist/test/unit/fixtures.js +43 -0
- package/dist/test/unit/index.d.ts +2 -0
- package/dist/test/unit/index.d.ts.map +1 -0
- package/dist/test/unit/index.js +13 -0
- package/dist/test/unit/keyPair/index.d.ts +2 -0
- package/dist/test/unit/keyPair/index.d.ts.map +1 -0
- package/dist/test/unit/keyPair/index.js +132 -0
- package/dist/test/unit/messageFactory.d.ts +2 -0
- package/dist/test/unit/messageFactory.d.ts.map +1 -0
- package/dist/test/unit/messageFactory.js +78 -0
- package/dist/test/unit/mpc/tss/ecdsa/ecdsa.d.ts +2 -0
- package/dist/test/unit/mpc/tss/ecdsa/ecdsa.d.ts.map +1 -0
- package/dist/test/unit/mpc/tss/ecdsa/ecdsa.js +333 -0
- package/dist/test/unit/mpc/tss/eddsa/eddsa.d.ts +5 -0
- package/dist/test/unit/mpc/tss/eddsa/eddsa.d.ts.map +1 -0
- package/dist/test/unit/mpc/tss/eddsa/eddsa.js +322 -0
- package/dist/test/unit/mpc/tss/fixtures/ecdsa.d.ts +130 -0
- package/dist/test/unit/mpc/tss/fixtures/ecdsa.d.ts.map +1 -0
- package/dist/test/unit/mpc/tss/fixtures/ecdsa.js +283 -0
- package/dist/test/unit/utils/crypto.d.ts +2 -0
- package/dist/test/unit/utils/crypto.d.ts.map +1 -0
- package/dist/test/unit/utils/crypto.js +60 -0
- package/dist/test/unit/utils/ed25519KeyDeriver.d.ts +2 -0
- package/dist/test/unit/utils/ed25519KeyDeriver.d.ts.map +1 -0
- package/dist/test/unit/utils/ed25519KeyDeriver.js +23 -0
- package/dist/test/unit/utils/index.d.ts +2 -0
- package/dist/test/unit/utils/index.d.ts.map +1 -0
- package/dist/test/unit/utils/index.js +61 -0
- package/dist/test/unit/utils/messages/index.d.ts +2 -0
- package/dist/test/unit/utils/messages/index.d.ts.map +1 -0
- package/dist/test/unit/utils/messages/index.js +51 -0
- package/dist/test/unit/verifyMessage.d.ts +2 -0
- package/dist/test/unit/verifyMessage.d.ts.map +1 -0
- package/dist/test/unit/verifyMessage.js +96 -0
- package/dist/tsconfig.tsbuildinfo +1 -43715
- package/package.json +79 -32
- package/.mocharc.js +0 -10
- package/CHANGELOG.md +0 -422
- package/DEVELOPER.md +0 -93
- package/resources/README.md +0 -17
- package/resources/cspr/contract/keys-manager.wasm +0 -0
- package/resources/dot/index.ts +0 -2
- package/resources/dot/mainnet.ts +0 -2
- package/resources/dot/westend.ts +0 -2
package/DEVELOPER.md
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
# Developer Guide
|
|
2
|
-
|
|
3
|
-
Thanks for contributing to this library. Below are some tips to help you
|
|
4
|
-
understand:
|
|
5
|
-
|
|
6
|
-
- the structure of the project
|
|
7
|
-
- the important classes and how they are used
|
|
8
|
-
- how to run the test suite
|
|
9
|
-
- how to contribute to the project
|
|
10
|
-
|
|
11
|
-
## Project Architecture
|
|
12
|
-
|
|
13
|
-
### Base Classes
|
|
14
|
-
|
|
15
|
-
As specified in [the project README](README.md), there are two main classes that
|
|
16
|
-
users will interact with:
|
|
17
|
-
|
|
18
|
-
- `TransactionBuilder`: A class that implements coin specific logic to handle
|
|
19
|
-
the construction, validation, and signing of blockchain transactions.
|
|
20
|
-
- `Transaction`: JavaScript representations of blockchain transactions.
|
|
21
|
-
|
|
22
|
-
The `TransactionBuilder`'s job is to build and sign `transactions` for a
|
|
23
|
-
specific blockchain.
|
|
24
|
-
|
|
25
|
-
The flow typically looks something like:
|
|
26
|
-
|
|
27
|
-
```javascript
|
|
28
|
-
// Import package
|
|
29
|
-
const accountLib = require('@bitgo/account-lib');
|
|
30
|
-
|
|
31
|
-
// Instantiate a TransactionBuilder for the blockchain you wish to
|
|
32
|
-
// build a transaction for (in this case, Tron - testnet)
|
|
33
|
-
const txBuilder = accountLib.getBuilder('ttrx');
|
|
34
|
-
|
|
35
|
-
// Use the TransactionBuilder to build a transaction from JSON
|
|
36
|
-
const unsignedJsonTx = {...coin specific tx json...};
|
|
37
|
-
const txBuilder = txBuilder.from(unsignedJsonTx);
|
|
38
|
-
|
|
39
|
-
// Sign the transaction using the TransactionBuilder
|
|
40
|
-
txBuilder.sign({ key: 'SOME-PRIVATE-KEY' });
|
|
41
|
-
const tx = await txBuilder.build();
|
|
42
|
-
|
|
43
|
-
// Save it to json to be used elsewhere (or broadcast)
|
|
44
|
-
const signedTxJson = tx.toJson();
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
### Coin Specific Implementations
|
|
48
|
-
|
|
49
|
-
If you have spent time poking around the project, you likely noticed that we
|
|
50
|
-
have base `TransactionBuilder` and base `Transaction` classes - they live in
|
|
51
|
-
`src/coin/baseCoin`. These classes define the core interfaces that all
|
|
52
|
-
subclasses will extend and implement.
|
|
53
|
-
|
|
54
|
-
Coin specific implementations of the `TransactionBuilder` and `Transaction`
|
|
55
|
-
classes live under the coin's ticker symbol in `src/coin` (ie: `src/coin/trx`
|
|
56
|
-
for Tron). This is where the meat of the signing, validation, and encoding logic
|
|
57
|
-
lives for each blockchain supported by the library.
|
|
58
|
-
|
|
59
|
-
We recommend that you follow this pattern when adding a new coin to the library:
|
|
60
|
-
|
|
61
|
-
### Test Structure
|
|
62
|
-
|
|
63
|
-
Account Lib comes with unit tests and it is expected that all changes introduced
|
|
64
|
-
to the library increase test coverage. Tests live in `test`. Coin specific tests
|
|
65
|
-
live in `test/unit/coin/<coin-ticker>/<coin-ticker.js>`.
|
|
66
|
-
|
|
67
|
-
## (External) Resources
|
|
68
|
-
|
|
69
|
-
There are situations in which this library requires upstream dependencies, but
|
|
70
|
-
you might not want to pull in the entire library only to use the tiny slice of
|
|
71
|
-
functionality that we require. Rather, you can take snippets of the external
|
|
72
|
-
code and stick them in `resources/`. See
|
|
73
|
-
[the README in that directory for more information](resources/README.md).
|
|
74
|
-
|
|
75
|
-
## Running Tests
|
|
76
|
-
|
|
77
|
-
To run the test suite locally:
|
|
78
|
-
|
|
79
|
-
```
|
|
80
|
-
yarn test
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
## Coding Norms & Expectations
|
|
84
|
-
|
|
85
|
-
When contributing, we recommend that you follow the existing patterns defined in
|
|
86
|
-
the project. Pull requests that break these norms will likely be rejected or
|
|
87
|
-
require a round of feedback.
|
|
88
|
-
|
|
89
|
-
Take note:
|
|
90
|
-
|
|
91
|
-
> Do not specify default accessors. In TypeScript, the default accessor for a
|
|
92
|
-
> class attribute is `public`, so specifying it for functions and attributes is
|
|
93
|
-
> redundant.
|
package/resources/README.md
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
# Resources
|
|
2
|
-
|
|
3
|
-
This directory contains external logic required to handle signing/validation/address derivation for
|
|
4
|
-
a specific coin.
|
|
5
|
-
|
|
6
|
-
Typically, this manifests as a smaller snippet of code from a larger codebase, of which, this
|
|
7
|
-
library only requires a small portion of.
|
|
8
|
-
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
## XTZ Resources
|
|
12
|
-
|
|
13
|
-
Tezos multisig wallets are supported through smart contracts.
|
|
14
|
-
|
|
15
|
-
Official repositories:
|
|
16
|
-
|
|
17
|
-
- Generic multisig contract: https://github.com/murbard/smart-contracts/blob/master/multisig/michelson/generic.tz
|
|
Binary file
|
package/resources/dot/index.ts
DELETED