Skip to content

Commit

Permalink
feat: remove ICP ledger-related features from nns (#433)
Browse files Browse the repository at this point in the history
# Motivation

This PR effectively removes the ledger from the library `@dfinity/nns` as related features were moved to `@dfinity/ledger-icp` in #427.

# Changes

- remove files
- bump v2.0.0
- use `@dfinity/ledger-icp` as peer dependency for few utils and types
  • Loading branch information
peterpeterparker authored Oct 2, 2023
1 parent 1a3f303 commit 667d507
Show file tree
Hide file tree
Showing 33 changed files with 56 additions and 3,356 deletions.
3 changes: 2 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
"license": "Apache-2.0",
"workspaces": [
"packages/utils",
"packages/ledger",
"packages/nns-proto",
"packages/ledger",
"packages/ledger-icp",
"packages/ledger-icrc",
"packages/nns",
"packages/sns",
"packages/cmc",
"packages/ckbtc",
"packages/ic-management",
"packages/ledger-icp",
"packages/ledger-icrc"
"packages/ic-management"
],
"scripts": {
"did": "scripts/compile-idl-js",
Expand All @@ -22,7 +22,7 @@
"protoc": "bash ./scripts/update_proto.sh",
"test": "jest",
"test-all": "npm ci && npm run build --workspace=packages/utils && npm run build --workspace=packages/ledger && npm run test --workspaces",
"docs": "node scripts/docs.js && prettier --write packages/nns/README.md packages/sns/README.md packages/cmc/README.md packages/utils/README.md packages/ledger-icp/README.md packages/ledger-icrc/README.md packages/ledger/README.md packages/ckbtc/README.md packages/ic-management/README.md",
"docs": "node scripts/docs.js && prettier --write packages/**/README.md",
"build": "npm run build --workspaces",
"size": "size-limit --json",
"update:agent": "./scripts/update-agent"
Expand Down
178 changes: 0 additions & 178 deletions packages/ledger-icp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,184 +55,6 @@ const data = await metadata();

<!-- TSDOC_START -->

### :factory: AccountIdentifier

[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/nns/src/account_identifier.ts#L13)

#### Methods

- [fromHex](#gear-fromhex)
- [fromPrincipal](#gear-fromprincipal)
- [toProto](#gear-toproto)
- [toHex](#gear-tohex)
- [toUint8Array](#gear-touint8array)
- [toNumbers](#gear-tonumbers)
- [toAccountIdentifierHash](#gear-toaccountidentifierhash)

##### :gear: fromHex

| Method | Type |
| --------- | ------------------------------------ |
| `fromHex` | `(hex: string) => AccountIdentifier` |

[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/nns/src/account_identifier.ts#L16)

##### :gear: fromPrincipal

| Method | Type |
| --------------- | ------------------------------------------------------------------------------------------------------- |
| `fromPrincipal` | `({ principal, subAccount, }: { principal: Principal; subAccount?: SubAccount; }) => AccountIdentifier` |

[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/nns/src/account_identifier.ts#L20)

##### :gear: toProto

| Method | Type |
| --------- | ---------------------------------- |
| `toProto` | `() => Promise<AccountIdentifier>` |

[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/nns/src/account_identifier.ts#L49)

##### :gear: toHex

| Method | Type |
| ------- | -------------- |
| `toHex` | `() => string` |

[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/nns/src/account_identifier.ts#L57)

##### :gear: toUint8Array

| Method | Type |
| -------------- | ------------------ |
| `toUint8Array` | `() => Uint8Array` |

[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/nns/src/account_identifier.ts#L61)

##### :gear: toNumbers

| Method | Type |
| ----------- | ---------------- |
| `toNumbers` | `() => number[]` |

[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/nns/src/account_identifier.ts#L65)

##### :gear: toAccountIdentifierHash

| Method | Type |
| ------------------------- | ------------------------- |
| `toAccountIdentifierHash` | `() => AccountIdentifier` |

[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/nns/src/account_identifier.ts#L69)

### :factory: SubAccount

[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/nns/src/account_identifier.ts#L76)

#### Methods

- [fromBytes](#gear-frombytes)
- [fromPrincipal](#gear-fromprincipal)
- [fromID](#gear-fromid)
- [toUint8Array](#gear-touint8array)

##### :gear: fromBytes

| Method | Type |
| ----------- | -------------------------------------------- |
| `fromBytes` | `(bytes: Uint8Array) => SubAccount or Error` |

[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/nns/src/account_identifier.ts#L79)

##### :gear: fromPrincipal

| Method | Type |
| --------------- | -------------------------------------- |
| `fromPrincipal` | `(principal: Principal) => SubAccount` |

[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/nns/src/account_identifier.ts#L87)

##### :gear: fromID

| Method | Type |
| -------- | ---------------------------- |
| `fromID` | `(id: number) => SubAccount` |

[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/nns/src/account_identifier.ts#L100)

##### :gear: toUint8Array

| Method | Type |
| -------------- | ------------------ |
| `toUint8Array` | `() => Uint8Array` |

[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/nns/src/account_identifier.ts#L112)

### :factory: LedgerCanister

[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/nns/src/ledger.canister.ts#L32)

#### Methods

- [create](#gear-create)
- [accountBalance](#gear-accountbalance)
- [transactionFee](#gear-transactionfee)
- [transfer](#gear-transfer)
- [icrc1Transfer](#gear-icrc1transfer)

##### :gear: create

| Method | Type |
| -------- | ----------------------------------------------------- |
| `create` | `(options?: LedgerCanisterOptions) => LedgerCanister` |

[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/nns/src/ledger.canister.ts#L43)

##### :gear: accountBalance

Returns the balance of the specified account identifier.

If `certified` is true, the request is fetched as an update call, otherwise
it is fetched using a query call.

| Method | Type |
| ---------------- | ------------------------------------------------------------------------------------------------------------------------ |
| `accountBalance` | `({ accountIdentifier, certified, }: { accountIdentifier: AccountIdentifier; certified?: boolean; }) => Promise<bigint>` |

[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/nns/src/ledger.canister.ts#L75)

##### :gear: transactionFee

Returns the transaction fee of the ledger canister

| Method | Type |
| ---------------- | ----------------------- |
| `transactionFee` | `() => Promise<bigint>` |

[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/nns/src/ledger.canister.ts#L99)

##### :gear: transfer

Transfer ICP from the caller to the destination `accountIdentifier`.
Returns the index of the block containing the tx if it was successful.

| Method | Type |
| ---------- | ----------------------------------------------- |
| `transfer` | `(request: TransferRequest) => Promise<bigint>` |

[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/nns/src/ledger.canister.ts#L112)

##### :gear: icrc1Transfer

Transfer ICP from the caller to the destination `Account`.
Returns the index of the block containing the tx if it was successful.

| Method | Type |
| --------------- | ---------------------------------------------------- |
| `icrc1Transfer` | `(request: Icrc1TransferRequest) => Promise<bigint>` |

[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/nns/src/ledger.canister.ts#L142)

<!-- TSDOC_END -->

## Resources
Expand Down
Loading

0 comments on commit 667d507

Please sign in to comment.