-
Notifications
You must be signed in to change notification settings - Fork 283
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(sdk-coin-islm): add Islamic Coin
Ticket: WIN-490
- Loading branch information
1 parent
e257093
commit 456cb30
Showing
42 changed files
with
2,445 additions
and
2 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
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
node_modules | ||
.idea | ||
public | ||
dist | ||
|
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,3 @@ | ||
node_modules/ | ||
.idea/ | ||
dist/ |
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,8 @@ | ||
require: 'ts-node/register' | ||
timeout: '60000' | ||
reporter: 'min' | ||
reporter-option: | ||
- 'cdn=true' | ||
- 'json=false' | ||
exit: true | ||
spec: ['test/unit/**/*.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,14 @@ | ||
!dist/ | ||
dist/test/ | ||
dist/tsconfig.tsbuildinfo | ||
.idea/ | ||
.prettierrc.yml | ||
tsconfig.json | ||
src/ | ||
test/ | ||
scripts/ | ||
.nyc_output | ||
CODEOWNERS | ||
node_modules/ | ||
.prettierignore | ||
.mocharc.js |
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,2 @@ | ||
.nyc_output/ | ||
dist/ |
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,3 @@ | ||
printWidth: 120 | ||
singleQuote: true | ||
trailingComma: 'es5' |
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 @@ | ||
# BitGo sdk-coin-islm | ||
|
||
SDK coins provide a modular approach to a monolithic architecture. This and all BitGoJS SDK coins allow developers to use only the coins needed for a given project. | ||
|
||
## Installation | ||
|
||
All coins are loaded traditionally through the `bitgo` package. If you are using coins individually, you will be accessing the coin via the `@bitgo/sdk-api` package. | ||
|
||
In your project install both `@bitgo/sdk-api` and `@bitgo/sdk-coin-islm`. | ||
|
||
```shell | ||
npm i @bitgo/sdk-api @bitgo/sdk-coin-islm | ||
``` | ||
|
||
Next, you will be able to initialize an instance of "bitgo" through `@bitgo/sdk-api` instead of `bitgo`. | ||
|
||
```javascript | ||
import { BitGoAPI } from '@bitgo/sdk-api'; | ||
import { Islm } from '@bitgo/sdk-coin-islm'; | ||
|
||
const sdk = new BitGoAPI(); | ||
|
||
sdk.register('islm', Islm.createInstance); | ||
``` | ||
|
||
## Development | ||
|
||
Most of the coin implementations are derived from `@bitgo/sdk-core`, `@bitgo/statics`, and coin specific packages. These implementations are used to interact with the BitGo API and BitGo platform services. | ||
|
||
You will notice that the basic version of common class extensions have been provided to you and must be resolved before the package build will succeed. Upon initiation of a given SDK coin, you will need to verify that your coin has been included in the root `tsconfig.packages.json` and that the linting, formatting, and testing succeeds when run both within the coin and from the root of BitGoJS. |
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,60 @@ | ||
{ | ||
"name": "@bitgo/sdk-coin-islm", | ||
"version": "1.0.0", | ||
"description": "BitGo SDK coin library for Islm", | ||
"main": "./dist/src/index.js", | ||
"types": "./dist/src/index.d.ts", | ||
"scripts": { | ||
"build": "yarn tsc --build --incremental --verbose .", | ||
"fmt": "prettier --write .", | ||
"check-fmt": "prettier --check .", | ||
"clean": "rm -r ./dist", | ||
"lint": "eslint --quiet .", | ||
"prepare": "npm run build", | ||
"test": "npm run coverage", | ||
"coverage": "nyc -- npm run unit-test", | ||
"unit-test": "mocha" | ||
}, | ||
"author": "BitGo SDK Team <[email protected]>", | ||
"license": "MIT", | ||
"engines": { | ||
"node": ">=16 <19" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/BitGo/BitGoJS.git", | ||
"directory": "modules/sdk-coin-islm" | ||
}, | ||
"lint-staged": { | ||
"*.{js,ts}": [ | ||
"yarn prettier --write", | ||
"yarn eslint --fix" | ||
] | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"nyc": { | ||
"extension": [ | ||
".ts" | ||
] | ||
}, | ||
"dependencies": { | ||
"@bitgo/abstract-cosmos": "^1.6.11", | ||
"@bitgo/sdk-core": "^8.24.0", | ||
"@bitgo/statics": "^27.0.0", | ||
"@cosmjs/amino": "^0.29.5", | ||
"@cosmjs/encoding": "^0.29.5", | ||
"@cosmjs/proto-signing": "^0.29.5", | ||
"@cosmjs/stargate": "^0.29.5", | ||
"bignumber.js": "^9.1.1", | ||
"cosmjs-types": "^0.6.1", | ||
"ethers": "^5.7.2", | ||
"keccak": "3.0.3", | ||
"protobufjs": "^7.2.4" | ||
}, | ||
"devDependencies": { | ||
"@bitgo/sdk-api": "^1.22.0", | ||
"@bitgo/sdk-test": "^1.2.41" | ||
} | ||
} |
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,15 @@ | ||
# Resources | ||
|
||
This directory contains external logic required to handle signing/validation/address derivation for | ||
a specific coin. | ||
|
||
Typically, this manifests as a smaller snippet of code from a larger codebase, of which, this | ||
library only requires a small portion of. | ||
|
||
--- | ||
|
||
## ISLM Resources | ||
|
||
Haqq Network (Islamic Coin) doesn't utilize the cosmos default `secp256k1` PubKey type & utilizes as different PubKey type `ethSecp256k1` exposed by ethermint. The protobuf files for `ethSecp256k1` are defined here : https://github.com/evmos/ethermint/blob/main/proto/ethermint/crypto/v1/ethsecp256k1/keys.proto | ||
|
||
This directory contains the generated TypeScript types required, and also contains the `.proto` files used to generate them. |
23 changes: 23 additions & 0 deletions
23
modules/sdk-coin-islm/resources/proto/ethermint/crypto/v1/ethsecp256k1/ethSecp256k1.proto
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,23 @@ | ||
syntax = "proto3"; | ||
package ethermint.crypto.v1.ethsecp256k1; | ||
|
||
import "gogoproto/gogo.proto"; | ||
|
||
option go_package = "github.com/evmos/ethermint/crypto/ethsecp256k1"; | ||
|
||
// PubKey defines a type alias for an ecdsa.PublicKey that implements | ||
// Tendermint's PubKey interface. It represents the 33-byte compressed public | ||
// key format. | ||
message PubKey { | ||
option (gogoproto.goproto_stringer) = false; | ||
|
||
// key is the public key in byte form | ||
bytes key = 1; | ||
} | ||
|
||
// PrivKey defines a type alias for an ecdsa.PrivateKey that implements | ||
// Tendermint's PrivateKey interface. | ||
message PrivKey { | ||
// key is the private key in byte form | ||
bytes key = 1; | ||
} |
Oops, something went wrong.