diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 00000000..c9ccc231 Binary files /dev/null and b/.DS_Store differ diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 1a3a0c42..62806bdf 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -20,9 +20,9 @@ jobs: # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v2 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} cache: 'npm' diff --git a/.github/workflows/publish-npm.yml b/.github/workflows/publish-npm.yml index 7edc38ee..f5bc9384 100644 --- a/.github/workflows/publish-npm.yml +++ b/.github/workflows/publish-npm.yml @@ -8,10 +8,10 @@ jobs: publish: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: token: ${{ secrets.RELEASE_TOKEN }} - - uses: actions/setup-node@v2 + - uses: actions/setup-node@v4 with: node-version: '16.x' registry-url: 'https://registry.npmjs.org' diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 00000000..3c032078 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +18 diff --git a/CHANGELOG.md b/CHANGELOG.md index 9df8e49d..0bb2cd81 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,323 @@ All notable changes to this project will be documented in this file. Dates are displayed in UTC. +#### [v5.38.0](https://github.com/fireblocks/fireblocks-sdk-js/compare/v5.37.0...v5.38.0) + +> 5 June 2025 + +- added ncw header [`#329`](https://github.com/fireblocks/fireblocks-sdk-js/pull/329) + +#### [v5.37.0](https://github.com/fireblocks/fireblocks-sdk-js/compare/v5.36.0...v5.37.0) + +> 26 March 2025 + +- feat: blockchains and assets endpoints GA [`#326`](https://github.com/fireblocks/fireblocks-sdk-js/pull/326) +- feat: change asset and blockchain apis response [`#319`](https://github.com/fireblocks/fireblocks-sdk-js/pull/319) +- Add paginated endpoint to get balance on /internal_wallets/<wallet id>/assets [`#322`](https://github.com/fireblocks/fireblocks-sdk-js/pull/322) +- mak type non optional [`#321`](https://github.com/fireblocks/fireblocks-sdk-js/pull/321) + +#### [v5.36.0](https://github.com/fireblocks/fireblocks-sdk-js/compare/v5.35.0...v5.36.0) + +> 23 January 2025 + +- Travel Rule - beneficiaryVASPdid is optional [`#320`](https://github.com/fireblocks/fireblocks-sdk-js/pull/320) +- feat: add getTransactionReceipt method and TransactionReceiptResponseDto type [`#318`](https://github.com/fireblocks/fireblocks-sdk-js/pull/318) + +#### [v5.35.0](https://github.com/fireblocks/fireblocks-sdk-js/compare/v5.34.0...v5.35.0) + +> 19 December 2024 + +- Add asset and blockchain beta apis [`#317`](https://github.com/fireblocks/fireblocks-sdk-js/pull/317) +- NCW: add getWalletDevice method to retrieve specific wallet device details [`#315`](https://github.com/fireblocks/fireblocks-sdk-js/pull/315) +- [ncw] delete signing algo EP [`#309`](https://github.com/fireblocks/fireblocks-sdk-js/pull/309) +- staking-sdk: add amount to the UnstakeRequestDto for liquid unstake [`#316`](https://github.com/fireblocks/fireblocks-sdk-js/pull/316) + +#### [v5.34.0](https://github.com/fireblocks/fireblocks-sdk-js/compare/v5.33.0...v5.34.0) + +> 2 December 2024 + +- WLT-1945 - [Fireblocks JS SDK] Fix missing field in return type of WalletSetupStatusResponse [`#313`](https://github.com/fireblocks/fireblocks-sdk-js/pull/313) +- staking-sdk: add solana split support [`#312`](https://github.com/fireblocks/fireblocks-sdk-js/pull/312) +- GetPublicKey For NCW [`#294`](https://github.com/fireblocks/fireblocks-sdk-js/pull/294) +- support fallback function in abi [`#306`](https://github.com/fireblocks/fireblocks-sdk-js/pull/306) + +#### [v5.33.0](https://github.com/fireblocks/fireblocks-sdk-js/compare/v5.32.0...v5.33.0) + +> 6 November 2024 + +- fix: upgrade axios from 1.6.0 to 1.7.7 [`#301`](https://github.com/fireblocks/fireblocks-sdk-js/pull/301) +- fix: upgrade jsonwebtoken from 9.0.0 to 9.0.2 [`#303`](https://github.com/fireblocks/fireblocks-sdk-js/pull/303) +- fix: package.json & package-lock.json to reduce vulnerabilities [`#304`](https://github.com/fireblocks/fireblocks-sdk-js/pull/304) +- add useGasless option [`#300`](https://github.com/fireblocks/fireblocks-sdk-js/pull/300) +- [ncw] change ethNetwork from number to string on asset response [`#299`](https://github.com/fireblocks/fireblocks-sdk-js/pull/299) + +#### [v5.32.0](https://github.com/fireblocks/fireblocks-sdk-js/compare/v5.31.2...v5.32.0) + +> 28 October 2024 + +- Get/set VASP assigned to vault [`#296`](https://github.com/fireblocks/fireblocks-sdk-js/pull/296) +- OC-5460 - Add externalId in WriteCallFunctionDto && OC-5461 - Add SDK to support fee and feeLevel [`#298`](https://github.com/fireblocks/fireblocks-sdk-js/pull/298) +- [OC-5077] Updated fetch-abi to fetch_abi [`#293`](https://github.com/fireblocks/fireblocks-sdk-js/pull/293) + +#### [v5.31.2](https://github.com/fireblocks/fireblocks-sdk-js/compare/v5.31.1...v5.31.2) + +> 10 September 2024 + +- Update publish-npm.yml [`7fc1307`](https://github.com/fireblocks/fireblocks-sdk-js/commit/7fc130780c6971b52bdd2f7950dcde492b54d1a4) + +#### [v5.31.1](https://github.com/fireblocks/fireblocks-sdk-js/compare/v5.31.0...v5.31.1) + +> 10 September 2024 + +- Update publish-npm.yml [`0c240cd`](https://github.com/fireblocks/fireblocks-sdk-js/commit/0c240cd2473c57a47e2db0de635d48e0f5d0271e) + +#### [v5.31.0](https://github.com/fireblocks/fireblocks-sdk-js/compare/v5.30.0...v5.31.0) + +> 9 September 2024 + +- add maxTotalFee tx-request param [`#290`](https://github.com/fireblocks/fireblocks-sdk-js/pull/290) + +#### [v5.30.0](https://github.com/fireblocks/fireblocks-sdk-js/compare/v5.29.0...v5.30.0) + +> 29 August 2024 + +- Fix issue with add abi [`#291`](https://github.com/fireblocks/fireblocks-sdk-js/pull/291) +- Add-rescan-txs [`#283`](https://github.com/fireblocks/fireblocks-sdk-js/pull/283) + +#### [v5.29.0](https://github.com/fireblocks/fireblocks-sdk-js/compare/v5.28.1...v5.29.0) + +> 7 August 2024 + +- add set asset price api [`#277`](https://github.com/fireblocks/fireblocks-sdk-js/pull/277) +- Add link contract routes [`#287`](https://github.com/fireblocks/fireblocks-sdk-js/pull/287) +- removed unnecessary field from BurnCollectionTokenRequest [`#289`](https://github.com/fireblocks/fireblocks-sdk-js/pull/289) + +#### [v5.28.1](https://github.com/fireblocks/fireblocks-sdk-js/compare/v5.28.0...v5.28.1) + +> 29 July 2024 + +- [OC-4662] Tokenization Collection API - Changed token metadata objects' fields from camel Case to snake case [`#288`](https://github.com/fireblocks/fireblocks-sdk-js/pull/288) + +#### [v5.28.0](https://github.com/fireblocks/fireblocks-sdk-js/compare/v5.27.2...v5.28.0) + +> 15 July 2024 + +- Add Tokenization Collections API [`#285`](https://github.com/fireblocks/fireblocks-sdk-js/pull/285) + +#### [v5.27.2](https://github.com/fireblocks/fireblocks-sdk-js/compare/v5.27.1...v5.27.2) + +> 20 June 2024 + +- feat: set ncw wallet required algorithms [`#281`](https://github.com/fireblocks/fireblocks-sdk-js/pull/281) +- fix: getWalletDevices type [`#278`](https://github.com/fireblocks/fireblocks-sdk-js/pull/278) + +#### [v5.27.1](https://github.com/fireblocks/fireblocks-sdk-js/compare/v5.27.0...v5.27.1) + +> 20 June 2024 + +- functions instead of abi [`#280`](https://github.com/fireblocks/fireblocks-sdk-js/pull/280) + +#### [v5.27.0](https://github.com/fireblocks/fireblocks-sdk-js/compare/v5.26.0...v5.27.0) + +> 17 June 2024 + +- Add algorithm id to asset response [`#271`](https://github.com/fireblocks/fireblocks-sdk-js/pull/271) +- Fetch address by chain and tx hash [`#279`](https://github.com/fireblocks/fireblocks-sdk-js/pull/279) + +#### [v5.26.0](https://github.com/fireblocks/fireblocks-sdk-js/compare/v5.25.1...v5.26.0) + +> 28 May 2024 + +- Update Tokenization DTOs and deprecate unused route [`#276`](https://github.com/fireblocks/fireblocks-sdk-js/pull/276) + +#### [v5.25.1](https://github.com/fireblocks/fireblocks-sdk-js/compare/v5.25.0...v5.25.1) + +> 15 April 2024 + +- Tokenization api changes [`#273`](https://github.com/fireblocks/fireblocks-sdk-js/pull/273) + +#### [v5.25.0](https://github.com/fireblocks/fireblocks-sdk-js/compare/v5.24.0...v5.25.0) + +> 10 April 2024 + +- NCW: get unspent inputs [`#272`](https://github.com/fireblocks/fireblocks-sdk-js/pull/272) + +#### [v5.24.0](https://github.com/fireblocks/fireblocks-sdk-js/compare/v5.23.0...v5.24.0) + +> 1 April 2024 + +- Add registerNewAsset function [`#264`](https://github.com/fireblocks/fireblocks-sdk-js/pull/264) +- NCW: wallet & device setup status EPs [`#267`](https://github.com/fireblocks/fireblocks-sdk-js/pull/267) + +#### [v5.23.0](https://github.com/fireblocks/fireblocks-sdk-js/compare/v5.22.0...v5.23.0) + +> 14 March 2024 + +- Tokenization - Add displayName [`#262`](https://github.com/fireblocks/fireblocks-sdk-js/pull/262) + +#### [v5.22.0](https://github.com/fireblocks/fireblocks-sdk-js/compare/v5.21.0...v5.22.0) + +> 12 March 2024 + +- Remove colon from supported screening URL [`#265`](https://github.com/fireblocks/fireblocks-sdk-js/pull/265) +- Add supported screening assets route [`#259`](https://github.com/fireblocks/fireblocks-sdk-js/pull/259) + +#### [v5.21.0](https://github.com/fireblocks/fireblocks-sdk-js/compare/v5.20.0...v5.21.0) + +> 28 February 2024 + +- staking-sdk: fix PositionStatus missing statuses, StakeResponse respo… [`#260`](https://github.com/fireblocks/fireblocks-sdk-js/pull/260) +- Update README.md [`#261`](https://github.com/fireblocks/fireblocks-sdk-js/pull/261) +- staking-sdk: update staking sdk [`#254`](https://github.com/fireblocks/fireblocks-sdk-js/pull/254) +- assetId [`#256`](https://github.com/fireblocks/fireblocks-sdk-js/pull/256) + +#### [v5.20.0](https://github.com/fireblocks/fireblocks-sdk-js/compare/v5.19.0...v5.20.0) + +> 30 January 2024 + +- Add `errorDescription` to `TransactionResponse` [`#251`](https://github.com/fireblocks/fireblocks-sdk-js/pull/251) + +#### [v5.19.0](https://github.com/fireblocks/fireblocks-sdk-js/compare/v5.18.1...v5.19.0) + +> 30 January 2024 + +- Add spam changes to js sdk [`#250`](https://github.com/fireblocks/fireblocks-sdk-js/pull/250) +- Renamed management routes [`#248`](https://github.com/fireblocks/fireblocks-sdk-js/pull/248) + +#### [v5.18.1](https://github.com/fireblocks/fireblocks-sdk-js/compare/v5.18.0...v5.18.1) + +> 26 January 2024 + +- Tokenization updated API [`#247`](https://github.com/fireblocks/fireblocks-sdk-js/pull/247) +- update type of addressFormat to string | undefined [`#243`](https://github.com/fireblocks/fireblocks-sdk-js/pull/243) + +#### [v5.18.0](https://github.com/fireblocks/fireblocks-sdk-js/compare/v5.17.0...v5.18.0) + +> 18 January 2024 + +- feat: Add request interceptor and httpsAgent options [`#245`](https://github.com/fireblocks/fireblocks-sdk-js/pull/245) +- add missing amountUsd [`#239`](https://github.com/fireblocks/fireblocks-sdk-js/pull/239) + +#### [v5.17.0](https://github.com/fireblocks/fireblocks-sdk-js/compare/v5.16.0...v5.17.0) + +> 7 January 2024 + +- Audit logs api [`#240`](https://github.com/fireblocks/fireblocks-sdk-js/pull/240) + +#### [v5.16.0](https://github.com/fireblocks/fireblocks-sdk-js/compare/v5.15.1...v5.16.0) + +> 31 December 2023 + +- fix: add missing params [`#241`](https://github.com/fireblocks/fireblocks-sdk-js/pull/241) + +#### [v5.15.1](https://github.com/fireblocks/fireblocks-sdk-js/compare/v5.15.0...v5.15.1) + +> 26 December 2023 + +- Rename management paths [`#238`](https://github.com/fireblocks/fireblocks-sdk-js/pull/238) + +#### [v5.15.0](https://github.com/fireblocks/fireblocks-sdk-js/compare/v5.14.0...v5.15.0) + +> 24 December 2023 + +- Support tenant's OTA configuration functionality [`#237`](https://github.com/fireblocks/fireblocks-sdk-js/pull/237) +- feat: Add PeerType [`#227`](https://github.com/fireblocks/fireblocks-sdk-js/pull/227) + +#### [v5.14.0](https://github.com/fireblocks/fireblocks-sdk-js/compare/v5.13.0...v5.14.0) + +> 12 December 2023 + +- Fix empty querystring scenario [`#235`](https://github.com/fireblocks/fireblocks-sdk-js/pull/235) +- Exposing external aml endpoints for screening setting [`#226`](https://github.com/fireblocks/fireblocks-sdk-js/pull/226) +- User management [`#189`](https://github.com/fireblocks/fireblocks-sdk-js/pull/189) + +#### [v5.13.0](https://github.com/fireblocks/fireblocks-sdk-js/compare/v5.12.0...v5.13.0) + +> 7 December 2023 + +- Bump axios from 0.27.2 to 1.6.0 [`#231`](https://github.com/fireblocks/fireblocks-sdk-js/pull/231) +- feat: ncw latest backup [`#225`](https://github.com/fireblocks/fireblocks-sdk-js/pull/225) +- Bump semver from 5.7.1 to 5.7.2 [`#182`](https://github.com/fireblocks/fireblocks-sdk-js/pull/182) + +#### [v5.12.0](https://github.com/fireblocks/fireblocks-sdk-js/compare/v5.11.0...v5.12.0) + +> 28 November 2023 + +- Added sourceWalletId for NCW under TransactionFilter [`#228`](https://github.com/fireblocks/fireblocks-sdk-js/pull/228) +- Add get asset wallets paginated endpoint [`#150`](https://github.com/fireblocks/fireblocks-sdk-js/pull/150) + +#### [v5.11.0](https://github.com/fireblocks/fireblocks-sdk-js/compare/v5.10.0...v5.11.0) + +> 16 November 2023 + +- staking-sdk: update staking sdk [`#222`](https://github.com/fireblocks/fireblocks-sdk-js/pull/222) +- Revert mistake in updateVaultAccount [`#224`](https://github.com/fireblocks/fireblocks-sdk-js/pull/224) +- Add getPaginatedAddresses method [`#223`](https://github.com/fireblocks/fireblocks-sdk-js/pull/223) + +#### [v5.10.0](https://github.com/fireblocks/fireblocks-sdk-js/compare/v5.9.0...v5.10.0) + +> 15 November 2023 + +- contract-service - adding endpoints [`#221`](https://github.com/fireblocks/fireblocks-sdk-js/pull/221) +- added bulk functions [`#209`](https://github.com/fireblocks/fireblocks-sdk-js/pull/209) +- Staking sdk [`#216`](https://github.com/fireblocks/fireblocks-sdk-js/pull/216) + +#### [v5.9.0](https://github.com/fireblocks/fireblocks-sdk-js/compare/v5.8.0...v5.9.0) + +> 17 October 2023 + +- COR-31331: Add support paged exchange account endpoint [`#213`](https://github.com/fireblocks/fireblocks-sdk-js/pull/213) +- feat: added multi nft token status update endpoint [`#214`](https://github.com/fireblocks/fireblocks-sdk-js/pull/214) +- feat: NCW supported assets [`#215`](https://github.com/fireblocks/fireblocks-sdk-js/pull/215) + +#### [v5.8.0](https://github.com/fireblocks/fireblocks-sdk-js/compare/v5.7.0...v5.8.0) + +> 28 September 2023 + +- contract-registry - adding endpoints [`#210`](https://github.com/fireblocks/fireblocks-sdk-js/pull/210) +- added sort to transaction filter [`#185`](https://github.com/fireblocks/fireblocks-sdk-js/pull/185) + +#### [v5.7.0](https://github.com/fireblocks/fireblocks-sdk-js/compare/v5.6.1...v5.7.0) + +> 19 September 2023 + +- Travel Rule Configuration and Policy routes [`#187`](https://github.com/fireblocks/fireblocks-sdk-js/pull/187) +- Change Collection and Token response [`#205`](https://github.com/fireblocks/fireblocks-sdk-js/pull/205) +- feat: adding tap endpoints [`#207`](https://github.com/fireblocks/fireblocks-sdk-js/pull/207) + +#### [v5.6.1](https://github.com/fireblocks/fireblocks-sdk-js/compare/v5.6.0...v5.6.1) + +> 5 September 2023 + +- Added list owned assets endpoint and NCW for NFTs [`#206`](https://github.com/fireblocks/fireblocks-sdk-js/pull/206) +- Add Smart Transfers user groups endpoints [`#202`](https://github.com/fireblocks/fireblocks-sdk-js/pull/202) + +#### [v5.6.0](https://github.com/fireblocks/fireblocks-sdk-js/compare/v5.5.1...v5.6.0) + +> 24 August 2023 + +- added registry endpoint for uploading contracts [`#190`](https://github.com/fireblocks/fireblocks-sdk-js/pull/190) + +#### [v5.5.1](https://github.com/fireblocks/fireblocks-sdk-js/compare/v5.5.0...v5.5.1) + +> 23 August 2023 + +- Rename NCW base path [`#198`](https://github.com/fireblocks/fireblocks-sdk-js/pull/198) + +#### [v5.5.0](https://github.com/fireblocks/fireblocks-sdk-js/compare/v5.4.0...v5.5.0) + +> 22 August 2023 + +- fix: add NCW methods [`#197`](https://github.com/fireblocks/fireblocks-sdk-js/pull/197) +- add NCW feature [`#192`](https://github.com/fireblocks/fireblocks-sdk-js/pull/192) +- changed return type to pending instead of TokenLink [`#188`](https://github.com/fireblocks/fireblocks-sdk-js/pull/188) + +#### [v5.4.0](https://github.com/fireblocks/fireblocks-sdk-js/compare/v5.3.1...v5.4.0) + +> 7 August 2023 + +- Support users groups crud [`#179`](https://github.com/fireblocks/fireblocks-sdk-js/pull/179) + #### [v5.3.1](https://github.com/fireblocks/fireblocks-sdk-js/compare/v5.3.0...v5.3.1) > 2 August 2023 diff --git a/README.md b/README.md index 3d4234da..3c7f525c 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ ### About This repository contains the official Javascript & Typescript SDK for Fireblocks API. -For the complete API reference, go to [API reference](https://docs.fireblocks.com/api/swagger-ui/). +For the complete API reference, go to [API reference](https://developers.fireblocks.com/reference/api-overview). ## v4 Migration Please read the [following guide](./docs/V4-MIGRATION.md) for migration. diff --git a/package-lock.json b/package-lock.json index 5b4b9336..9967fed9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,17 +1,17 @@ { "name": "fireblocks-sdk", - "version": "5.3.1", + "version": "5.38.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "fireblocks-sdk", - "version": "5.3.1", + "version": "5.38.0", "license": "MIT", "dependencies": { - "@notabene/pii-sdk": "^1.16.0", - "axios": "^0.27.2", - "jsonwebtoken": "9.0.0", + "@notabene/pii-sdk": "^1.17.1", + "axios": "^1.7.7", + "jsonwebtoken": "^9.0.2", "platform": "^1.3.6", "qs": "^6.11.0", "query-string": "^7.1.3", @@ -24,7 +24,7 @@ "@types/qs": "^6.9.7", "@types/uuid": "^8.3.1", "tslint": "6.1.3", - "typescript": "3.9.7" + "typescript": "^5.3.2" } }, "node_modules/@babel/code-frame": { @@ -65,42 +65,6 @@ "node": ">=6.9.0" } }, - "node_modules/@did-core/data-model": { - "version": "0.1.1-unstable.15", - "resolved": "https://registry.npmjs.org/@did-core/data-model/-/data-model-0.1.1-unstable.15.tgz", - "integrity": "sha512-l7gxLxegcXW7389G+j6o+S24lS8uasmJx5txWpW3QadNvOawKwvWn8bV59SdHSK806xNzIZaCLKmXKxebs8yAQ==", - "dependencies": { - "factory.ts": "^0.5.1" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/@did-core/did-ld-json": { - "version": "0.1.1-unstable.15", - "resolved": "https://registry.npmjs.org/@did-core/did-ld-json/-/did-ld-json-0.1.1-unstable.15.tgz", - "integrity": "sha512-p2jKRxSU+eJJqd+ewCklYp/XZ6ysISk8VU2/kANCoB/WwUy/kVgw2rUNScRDXw2utr9Qj36P8EZTYi4aj7vRCQ==", - "dependencies": { - "@transmute/did-context": "^0.6.1-unstable.25", - "jsonld-checker": "^0.1.6" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/@digitalbazaar/http-client": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@digitalbazaar/http-client/-/http-client-1.2.0.tgz", - "integrity": "sha512-W9KQQ5pUJcaR0I4c2HPJC0a7kRbZApIorZgPnEDwMBgj16iQzutGLrCXYaZOmxqVLVNqqlQ4aUJh+HBQZy4W6Q==", - "dependencies": { - "esm": "^3.2.22", - "ky": "^0.25.1", - "ky-universal": "^0.8.2" - }, - "engines": { - "node": ">=10.0.0" - } - }, "node_modules/@ethersproject/bytes": { "version": "5.7.0", "resolved": "https://registry.npmjs.org/@ethersproject/bytes/-/bytes-5.7.0.tgz", @@ -139,21 +103,53 @@ "resolved": "https://registry.npmjs.org/@multiformats/base-x/-/base-x-4.0.1.tgz", "integrity": "sha512-eMk0b9ReBbV23xXU693TAIrLyeO5iTgBZGSJfpqriG8UkYvr/hC9u9pyMlAakDNHWmbhMZCDs6KQO0jzKD8OTw==" }, + "node_modules/@noble/ciphers": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/@noble/ciphers/-/ciphers-0.4.1.tgz", + "integrity": "sha512-QCOA9cgf3Rc33owG0AYBB9wszz+Ul2kramWN8tXG44Gyciud/tbkEqvxRF/IpqQaBpRBNi9f4jdNxqB2CQCIXg==", + "license": "MIT", + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@noble/curves": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.2.0.tgz", + "integrity": "sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw==", + "dependencies": { + "@noble/hashes": "1.3.2" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@noble/hashes": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.2.tgz", + "integrity": "sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ==", + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, "node_modules/@notabene/pii-sdk": { - "version": "1.16.0", - "resolved": "https://registry.npmjs.org/@notabene/pii-sdk/-/pii-sdk-1.16.0.tgz", - "integrity": "sha512-eeFvuHdQz/SBAjNVkbbcIPhPBUk9b44qD12jrqPxc3A276KRv7n3aJ3OjTkFD2mhoqlnmz1kKE56z0N84OVyxQ==", + "version": "1.17.1", + "resolved": "https://registry.npmjs.org/@notabene/pii-sdk/-/pii-sdk-1.17.1.tgz", + "integrity": "sha512-lCDPl58SQBAEihDIHtkghVH7fNOtdngDM9DJrDW+odEKAnB0+o6r5V+AeiNYIfRwkn8nXiCW7i3SsNMmLlj5Zw==", + "license": "MIT", "dependencies": { "@ethersproject/bytes": "5.7.0", + "@noble/curves": "^1.1.0", "@stablelib/ed25519": "1.0.3", - "@transmute/did-key-ed25519": "0.3.0-unstable.10", - "axios": "^0.27.2", + "axios": "^1.6.0", "axios-oauth-client": "^1.5.0", "axios-token-interceptor": "^0.2.0", "base64url": "3.0.1", "bs58": "5.0.0", "debug": "^4.3.4", - "did-jwt": "6.11.6", + "did-jwt": "^7.0", "dotenv": "^16.0.3", "lodash": "^4.17.21", "multibase": "4.0.6", @@ -175,55 +171,29 @@ "uuid": "dist/bin/uuid" } }, - "node_modules/@stablelib/aead": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@stablelib/aead/-/aead-1.0.1.tgz", - "integrity": "sha512-q39ik6sxGHewqtO0nP4BuSe3db5G1fEJE8ukvngS2gLkBXyy6E7pLubhbYgnkDFv6V8cWaxcE4Xn0t6LWcJkyg==" + "node_modules/@scure/base": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.9.tgz", + "integrity": "sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg==", + "license": "MIT", + "funding": { + "url": "https://paulmillr.com/funding/" + } }, "node_modules/@stablelib/binary": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/@stablelib/binary/-/binary-1.0.1.tgz", "integrity": "sha512-ClJWvmL6UBM/wjkvv/7m5VP3GMr9t0osr4yVgLZsLCOz4hGN9gIAFEqnJ0TsSMAN+n840nf2cHZnA5/KFqHC7Q==", + "license": "MIT", "dependencies": { "@stablelib/int": "^1.0.1" } }, - "node_modules/@stablelib/bytes": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@stablelib/bytes/-/bytes-1.0.1.tgz", - "integrity": "sha512-Kre4Y4kdwuqL8BR2E9hV/R5sOrUj6NanZaZis0V6lX5yzqC3hBuVSDXUIBqQv/sCpmuWRiHLwqiT1pqqjuBXoQ==" - }, - "node_modules/@stablelib/chacha": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@stablelib/chacha/-/chacha-1.0.1.tgz", - "integrity": "sha512-Pmlrswzr0pBzDofdFuVe1q7KdsHKhhU24e8gkEwnTGOmlC7PADzLVxGdn2PoNVBBabdg0l/IfLKg6sHAbTQugg==", - "dependencies": { - "@stablelib/binary": "^1.0.1", - "@stablelib/wipe": "^1.0.1" - } - }, - "node_modules/@stablelib/chacha20poly1305": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@stablelib/chacha20poly1305/-/chacha20poly1305-1.0.1.tgz", - "integrity": "sha512-MmViqnqHd1ymwjOQfghRKw2R/jMIGT3wySN7cthjXCBdO+qErNPUBnRzqNpnvIwg7JBCg3LdeCZZO4de/yEhVA==", - "dependencies": { - "@stablelib/aead": "^1.0.1", - "@stablelib/binary": "^1.0.1", - "@stablelib/chacha": "^1.0.1", - "@stablelib/constant-time": "^1.0.1", - "@stablelib/poly1305": "^1.0.1", - "@stablelib/wipe": "^1.0.1" - } - }, - "node_modules/@stablelib/constant-time": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@stablelib/constant-time/-/constant-time-1.0.1.tgz", - "integrity": "sha512-tNOs3uD0vSJcK6z1fvef4Y+buN7DXhzHDPqRLSXUel1UfqMB1PWNsnnAezrKfEwTLpN0cGH2p9NNjs6IqeD0eg==" - }, "node_modules/@stablelib/ed25519": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/@stablelib/ed25519/-/ed25519-1.0.3.tgz", "integrity": "sha512-puIMWaX9QlRsbhxfDc5i+mNPMY+0TmQEskunY1rZEBPi1acBCVQAhnsk/1Hk50DGPtVsZtAWQg4NHGlVaO9Hqg==", + "license": "MIT", "dependencies": { "@stablelib/random": "^1.0.2", "@stablelib/sha512": "^1.0.1", @@ -233,53 +203,30 @@ "node_modules/@stablelib/hash": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/@stablelib/hash/-/hash-1.0.1.tgz", - "integrity": "sha512-eTPJc/stDkdtOcrNMZ6mcMK1e6yBbqRBaNW55XA1jU8w/7QdnCF0CmMmOD1m7VSkBR44PWrMHU2l6r8YEQHMgg==" + "integrity": "sha512-eTPJc/stDkdtOcrNMZ6mcMK1e6yBbqRBaNW55XA1jU8w/7QdnCF0CmMmOD1m7VSkBR44PWrMHU2l6r8YEQHMgg==", + "license": "MIT" }, "node_modules/@stablelib/int": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/@stablelib/int/-/int-1.0.1.tgz", - "integrity": "sha512-byr69X/sDtDiIjIV6m4roLVWnNNlRGzsvxw+agj8CIEazqWGOQp2dTYgQhtyVXV9wpO6WyXRQUzLV/JRNumT2w==" - }, - "node_modules/@stablelib/keyagreement": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@stablelib/keyagreement/-/keyagreement-1.0.1.tgz", - "integrity": "sha512-VKL6xBwgJnI6l1jKrBAfn265cspaWBPAPEc62VBQrWHLqVgNRE09gQ/AnOEyKUWrrqfD+xSQ3u42gJjLDdMDQg==", - "dependencies": { - "@stablelib/bytes": "^1.0.1" - } - }, - "node_modules/@stablelib/poly1305": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@stablelib/poly1305/-/poly1305-1.0.1.tgz", - "integrity": "sha512-1HlG3oTSuQDOhSnLwJRKeTRSAdFNVB/1djy2ZbS35rBSJ/PFqx9cf9qatinWghC2UbfOYD8AcrtbUQl8WoxabA==", - "dependencies": { - "@stablelib/constant-time": "^1.0.1", - "@stablelib/wipe": "^1.0.1" - } + "integrity": "sha512-byr69X/sDtDiIjIV6m4roLVWnNNlRGzsvxw+agj8CIEazqWGOQp2dTYgQhtyVXV9wpO6WyXRQUzLV/JRNumT2w==", + "license": "MIT" }, "node_modules/@stablelib/random": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/@stablelib/random/-/random-1.0.2.tgz", "integrity": "sha512-rIsE83Xpb7clHPVRlBj8qNe5L8ISQOzjghYQm/dZ7VaM2KHYwMW5adjQjrzTZCchFnNCNhkwtnOBa9HTMJCI8w==", + "license": "MIT", "dependencies": { "@stablelib/binary": "^1.0.1", "@stablelib/wipe": "^1.0.1" } }, - "node_modules/@stablelib/sha256": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@stablelib/sha256/-/sha256-1.0.1.tgz", - "integrity": "sha512-GIIH3e6KH+91FqGV42Kcj71Uefd/QEe7Dy42sBTeqppXV95ggCcxLTk39bEr+lZfJmp+ghsR07J++ORkRELsBQ==", - "dependencies": { - "@stablelib/binary": "^1.0.1", - "@stablelib/hash": "^1.0.1", - "@stablelib/wipe": "^1.0.1" - } - }, "node_modules/@stablelib/sha512": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/@stablelib/sha512/-/sha512-1.0.1.tgz", "integrity": "sha512-13gl/iawHV9zvDKciLo1fQ8Bgn2Pvf7OV6amaRVKiq3pjQ3UmEpXxWiAfV8tYjUpeZroBxtyrwtdooQT/i3hzw==", + "license": "MIT", "dependencies": { "@stablelib/binary": "^1.0.1", "@stablelib/hash": "^1.0.1", @@ -289,106 +236,8 @@ "node_modules/@stablelib/wipe": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/@stablelib/wipe/-/wipe-1.0.1.tgz", - "integrity": "sha512-WfqfX/eXGiAd3RJe4VU2snh/ZPwtSjLG4ynQ/vYzvghTh7dHFcI1wl+nrkWG6lGhukOxOsUHfv8dUXr58D0ayg==" - }, - "node_modules/@stablelib/x25519": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@stablelib/x25519/-/x25519-1.0.3.tgz", - "integrity": "sha512-KnTbKmUhPhHavzobclVJQG5kuivH+qDLpe84iRqX3CLrKp881cF160JvXJ+hjn1aMyCwYOKeIZefIH/P5cJoRw==", - "dependencies": { - "@stablelib/keyagreement": "^1.0.1", - "@stablelib/random": "^1.0.2", - "@stablelib/wipe": "^1.0.1" - } - }, - "node_modules/@stablelib/xchacha20": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@stablelib/xchacha20/-/xchacha20-1.0.1.tgz", - "integrity": "sha512-1YkiZnFF4veUwBVhDnDYwo6EHeKzQK4FnLiO7ezCl/zu64uG0bCCAUROJaBkaLH+5BEsO3W7BTXTguMbSLlWSw==", - "dependencies": { - "@stablelib/binary": "^1.0.1", - "@stablelib/chacha": "^1.0.1", - "@stablelib/wipe": "^1.0.1" - } - }, - "node_modules/@stablelib/xchacha20poly1305": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@stablelib/xchacha20poly1305/-/xchacha20poly1305-1.0.1.tgz", - "integrity": "sha512-B1Abj0sMJ8h3HNmGnJ7vHBrAvxuNka6cJJoZ1ILN7iuacXp7sUYcgOVEOTLWj+rtQMpspY9tXSCRLPmN1mQNWg==", - "dependencies": { - "@stablelib/aead": "^1.0.1", - "@stablelib/chacha20poly1305": "^1.0.1", - "@stablelib/constant-time": "^1.0.1", - "@stablelib/wipe": "^1.0.1", - "@stablelib/xchacha20": "^1.0.1" - } - }, - "node_modules/@transmute/did-context": { - "version": "0.6.1-unstable.37", - "resolved": "https://registry.npmjs.org/@transmute/did-context/-/did-context-0.6.1-unstable.37.tgz", - "integrity": "sha512-p/QnG3QKS4218hjIDgdvJOFATCXsAnZKgy4egqRrJLlo3Y6OaDBg7cA73dixOwUPoEKob0K6rLIGcsCI/L1acw==" - }, - "node_modules/@transmute/did-key-common": { - "version": "0.3.0-unstable.10", - "resolved": "https://registry.npmjs.org/@transmute/did-key-common/-/did-key-common-0.3.0-unstable.10.tgz", - "integrity": "sha512-Iryh/HcGIvmTtWFTRaG/JEgbUsqI5OqKqkR2676yQWK4ajLMsyNattz5n0ZfFQk/4U7Ee6pJvvKRduFDAqqV0Q==", - "dependencies": { - "@did-core/data-model": "^0.1.1-unstable.13", - "@did-core/did-ld-json": "^0.1.1-unstable.13", - "@transmute/did-context": "^0.6.1-unstable.36", - "@transmute/ld-key-pair": "^0.6.1-unstable.36", - "@transmute/security-context": "^0.6.1-unstable.36" - }, - "engines": { - "node": ">=14" - } - }, - "node_modules/@transmute/did-key-ed25519": { - "version": "0.3.0-unstable.10", - "resolved": "https://registry.npmjs.org/@transmute/did-key-ed25519/-/did-key-ed25519-0.3.0-unstable.10.tgz", - "integrity": "sha512-9QdXl58DjwqBuOJBx6DtvaNW2bZLmVBxMSq2En4RAQcGIz1GGulyEQ1NB7PLIAgnam3LIFxiK6RiQGQTfJmmJg==", - "dependencies": { - "@transmute/did-key-common": "^0.3.0-unstable.10", - "@transmute/ed25519-key-pair": "^0.6.1-unstable.37" - }, - "engines": { - "node": ">=14" - } - }, - "node_modules/@transmute/ed25519-key-pair": { - "version": "0.6.1-unstable.37", - "resolved": "https://registry.npmjs.org/@transmute/ed25519-key-pair/-/ed25519-key-pair-0.6.1-unstable.37.tgz", - "integrity": "sha512-l34yzE/QnQwmdk5xY9g2kD55e4XPp/jTZQzPu7I6J4Ar+bMaL/0RLL/pgvwyI7qUpsddxRf4WPZCCcZveqPcdA==", - "dependencies": { - "@stablelib/ed25519": "^1.0.1", - "@transmute/ld-key-pair": "^0.6.1-unstable.37", - "@transmute/x25519-key-pair": "^0.6.1-unstable.37" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/@transmute/ld-key-pair": { - "version": "0.6.1-unstable.37", - "resolved": "https://registry.npmjs.org/@transmute/ld-key-pair/-/ld-key-pair-0.6.1-unstable.37.tgz", - "integrity": "sha512-DcTpEruAQBfOd2laZkg3uCQ+67Y7dw2hsvo42NAQ5tItCIx5AClP7zccri7T2JUcfDUFaE32z/BLTMEKYt3XZQ==" - }, - "node_modules/@transmute/security-context": { - "version": "0.6.1-unstable.37", - "resolved": "https://registry.npmjs.org/@transmute/security-context/-/security-context-0.6.1-unstable.37.tgz", - "integrity": "sha512-GtLmG65qlORrz/2S4I74DT+vA4+qXsFxrMr0cNOXjUqZBd/AW1PTrFnryLF9907BfoiD58HC9qb1WVGWjSlBYw==" - }, - "node_modules/@transmute/x25519-key-pair": { - "version": "0.6.1-unstable.37", - "resolved": "https://registry.npmjs.org/@transmute/x25519-key-pair/-/x25519-key-pair-0.6.1-unstable.37.tgz", - "integrity": "sha512-j6zR9IoJmgVhUCVH8YVGpsgQf99SxPKZ00LGnUheBAQzgj2lULGBQ44G+GqBCdzfT0qweptTfp1RjqqHEpizeA==", - "dependencies": { - "@stablelib/x25519": "^1.0.0", - "@transmute/ld-key-pair": "^0.6.1-unstable.37" - }, - "engines": { - "node": ">=10" - } + "integrity": "sha512-WfqfX/eXGiAd3RJe4VU2snh/ZPwtSjLG4ynQ/vYzvghTh7dHFcI1wl+nrkWG6lGhukOxOsUHfv8dUXr58D0ayg==", + "license": "MIT" }, "node_modules/@types/jsonwebtoken": { "version": "9.0.2", @@ -434,17 +283,6 @@ "dev": true, "license": "MIT" }, - "node_modules/abort-controller": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", - "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", - "dependencies": { - "event-target-shim": "^5.0.0" - }, - "engines": { - "node": ">=6.5" - } - }, "node_modules/ansi-styles": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", @@ -475,13 +313,14 @@ "license": "MIT" }, "node_modules/axios": { - "version": "0.27.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz", - "integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==", + "version": "1.7.7", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.7.tgz", + "integrity": "sha512-S4kL7XrjgBmvdGut0sN3yJxqYzrDOnivkBiN0OFs6hLiUam3UPvswUo0kqGyhqUZGEOytHyumEdXsAkgCOUf3Q==", "license": "MIT", "dependencies": { - "follow-redirects": "^1.14.9", - "form-data": "^4.0.0" + "follow-redirects": "^1.15.6", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" } }, "node_modules/axios-oauth-client": { @@ -525,16 +364,6 @@ "node": ">=6.0.0" } }, - "node_modules/bech32": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/bech32/-/bech32-2.0.0.tgz", - "integrity": "sha512-LcknSilhIGatDAsY1ak2I8VtGaHNhgMSYVxFrGLXv+xLHytaKZKcaUJJUE7qmBr7h33o5YQwP55pMI0xmkpJwg==" - }, - "node_modules/bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" - }, "node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -546,11 +375,6 @@ "concat-map": "0.0.1" } }, - "node_modules/brorand": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", - "integrity": "sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w==" - }, "node_modules/bs58": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/bs58/-/bs58-5.0.0.tgz", @@ -565,11 +389,6 @@ "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==", "license": "BSD-3-Clause" }, - "node_modules/buffer-from": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", - "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==" - }, "node_modules/builtin-modules": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", @@ -596,7 +415,8 @@ "node_modules/canonicalize": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/canonicalize/-/canonicalize-2.0.0.tgz", - "integrity": "sha512-ulDEYPv7asdKvqahuAY35c1selLdzDwHqugK92hfkzvlDCwXRRelDkR+Er33md/PtnpqHemgkuDPanZ4fiYZ8w==" + "integrity": "sha512-ulDEYPv7asdKvqahuAY35c1selLdzDwHqugK92hfkzvlDCwXRRelDkR+Er33md/PtnpqHemgkuDPanZ4fiYZ8w==", + "license": "Apache-2.0" }, "node_modules/chalk": { "version": "2.4.2", @@ -613,19 +433,6 @@ "node": ">=4" } }, - "node_modules/clone-deep": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-4.0.1.tgz", - "integrity": "sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ==", - "dependencies": { - "is-plain-object": "^2.0.4", - "kind-of": "^6.0.2", - "shallow-clone": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, "node_modules/color-convert": { "version": "1.9.3", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", @@ -718,28 +525,27 @@ } }, "node_modules/did-jwt": { - "version": "6.11.6", - "resolved": "https://registry.npmjs.org/did-jwt/-/did-jwt-6.11.6.tgz", - "integrity": "sha512-OfbWknRxJuUqH6Lk0x+H1FsuelGugLbBDEwsoJnicFOntIG/A4y19fn0a8RLxaQbWQ5gXg0yDq5E2huSBiiXzw==", + "version": "7.4.7", + "resolved": "https://registry.npmjs.org/did-jwt/-/did-jwt-7.4.7.tgz", + "integrity": "sha512-Apz7nIfIHSKWIMaEP5L/K8xkwByvjezjTG0xiqwKdnNj1x8M0+Yasury5Dm/KPltxi2PlGfRPf3IejRKZrT8mQ==", + "license": "Apache-2.0", "dependencies": { - "@stablelib/ed25519": "^1.0.2", - "@stablelib/random": "^1.0.1", - "@stablelib/sha256": "^1.0.1", - "@stablelib/x25519": "^1.0.2", - "@stablelib/xchacha20poly1305": "^1.0.1", - "bech32": "^2.0.0", + "@noble/ciphers": "^0.4.0", + "@noble/curves": "^1.0.0", + "@noble/hashes": "^1.3.0", + "@scure/base": "^1.1.3", "canonicalize": "^2.0.0", - "did-resolver": "^4.0.0", - "elliptic": "^6.5.4", - "js-sha3": "^0.8.0", - "multiformats": "^9.6.5", - "uint8arrays": "^3.0.0" + "did-resolver": "^4.1.0", + "multibase": "^4.0.6", + "multiformats": "^9.6.2", + "uint8arrays": "3.1.1" } }, "node_modules/did-resolver": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/did-resolver/-/did-resolver-4.1.0.tgz", - "integrity": "sha512-S6fWHvCXkZg2IhS4RcVHxwuyVejPR7c+a4Go0xbQ9ps5kILa8viiYQgrM4gfTyeTjJ0ekgJH9gk/BawTpmkbZA==" + "integrity": "sha512-S6fWHvCXkZg2IhS4RcVHxwuyVejPR7c+a4Go0xbQ9ps5kILa8viiYQgrM4gfTyeTjJ0ekgJH9gk/BawTpmkbZA==", + "license": "Apache-2.0" }, "node_modules/diff": { "version": "4.0.2", @@ -769,20 +575,6 @@ "safe-buffer": "^5.0.1" } }, - "node_modules/elliptic": { - "version": "6.5.4", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", - "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", - "dependencies": { - "bn.js": "^4.11.9", - "brorand": "^1.1.0", - "hash.js": "^1.0.0", - "hmac-drbg": "^1.0.1", - "inherits": "^2.0.4", - "minimalistic-assert": "^1.0.1", - "minimalistic-crypto-utils": "^1.0.1" - } - }, "node_modules/escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", @@ -793,14 +585,6 @@ "node": ">=0.8.0" } }, - "node_modules/esm": { - "version": "3.2.25", - "resolved": "https://registry.npmjs.org/esm/-/esm-3.2.25.tgz", - "integrity": "sha512-U1suiZ2oDVWv4zPO56S0NcR5QriEahGtdN2OR6FiOG4WJvcjBVFB0qI4+eKoWFH483PKGuLuu6V8Z4T5g63UVA==", - "engines": { - "node": ">=6" - } - }, "node_modules/esprima": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", @@ -815,26 +599,6 @@ "node": ">=4" } }, - "node_modules/event-target-shim": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", - "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", - "engines": { - "node": ">=6" - } - }, - "node_modules/factory.ts": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/factory.ts/-/factory.ts-0.5.2.tgz", - "integrity": "sha512-I4YDKuyMW+s2PocnWh/Ekv9wSStt/MNN1ZRb1qhy0Kv056ndlzbLHDsW9KEmTAqMpLI3BtjSqEdZ7ZfdnaXn9w==", - "dependencies": { - "clone-deep": "^4.0.1", - "source-map-support": "^0.5.19" - }, - "engines": { - "node": ">= 14" - } - }, "node_modules/fetch-blob": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.2.0.tgz", @@ -868,9 +632,9 @@ } }, "node_modules/follow-redirects": { - "version": "1.15.2", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", - "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==", + "version": "1.15.9", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.9.tgz", + "integrity": "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==", "funding": [ { "type": "individual", @@ -995,25 +759,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/hash.js": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", - "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", - "dependencies": { - "inherits": "^2.0.3", - "minimalistic-assert": "^1.0.1" - } - }, - "node_modules/hmac-drbg": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", - "integrity": "sha512-Tti3gMqLdZfhOQY1Mzf/AanLiqh1WTiJgEj26ZuYQ9fbkLomzGchCws4FyrSd4VkpBfiNhaE1On+lOz894jvXg==", - "dependencies": { - "hash.js": "^1.0.3", - "minimalistic-assert": "^1.0.0", - "minimalistic-crypto-utils": "^1.0.1" - } - }, "node_modules/inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", @@ -1029,6 +774,7 @@ "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true, "license": "ISC" }, "node_modules/is-core-module": { @@ -1044,30 +790,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-plain-object": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", - "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", - "dependencies": { - "isobject": "^3.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/js-sha3": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", - "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==" - }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -1089,66 +811,22 @@ "js-yaml": "bin/js-yaml.js" } }, - "node_modules/jsonld": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/jsonld/-/jsonld-5.2.0.tgz", - "integrity": "sha512-JymgT6Xzk5CHEmHuEyvoTNviEPxv6ihLWSPu1gFdtjSAyM6cFqNrv02yS/SIur3BBIkCf0HjizRc24d8/FfQKw==", - "dependencies": { - "@digitalbazaar/http-client": "^1.1.0", - "canonicalize": "^1.0.1", - "lru-cache": "^6.0.0", - "rdf-canonize": "^3.0.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/jsonld-checker": { - "version": "0.1.8", - "resolved": "https://registry.npmjs.org/jsonld-checker/-/jsonld-checker-0.1.8.tgz", - "integrity": "sha512-jclmnPRrm5SEpaIV6IiSTJxplRAqIWHduQLsUfrYpZM41Ng48m1RN2/aUyHze/ynfO0D2UhlJBt8SdObsH5GBw==", - "dependencies": { - "jsonld": "^5.2.0", - "node-fetch": "^2.6.1" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/jsonld-checker/node_modules/node-fetch": { - "version": "2.6.11", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.11.tgz", - "integrity": "sha512-4I6pdBY1EthSqDmJkiNk3JIT8cswwR9nfeW/cPdUagJYEQG7R95WRH74wpz7ma8Gh/9dI9FP+OU+0E4FvtA55w==", - "dependencies": { - "whatwg-url": "^5.0.0" - }, - "engines": { - "node": "4.x || >=6.0.0" - }, - "peerDependencies": { - "encoding": "^0.1.0" - }, - "peerDependenciesMeta": { - "encoding": { - "optional": true - } - } - }, - "node_modules/jsonld/node_modules/canonicalize": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/canonicalize/-/canonicalize-1.0.8.tgz", - "integrity": "sha512-0CNTVCLZggSh7bc5VkX5WWPWO+cyZbNd07IHIsSXLia/eAq+r836hgk+8BKoEh7949Mda87VUOitx5OddVj64A==" - }, "node_modules/jsonwebtoken": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.0.tgz", - "integrity": "sha512-tuGfYXxkQGDPnLJ7SibiQgVgeDgfbPq2k2ICcbgqW8WxWLBAxKQM/ZCu/IT8SOSwmaYl4dpTFCW5xZv7YbbWUw==", + "version": "9.0.2", + "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.2.tgz", + "integrity": "sha512-PRp66vJ865SSqOlgqS8hujT5U4AOgMfhrwYIuIhfKaoSCZcirrmASQr8CX7cUg+RMih+hgznrjp99o+W4pJLHQ==", "license": "MIT", "dependencies": { "jws": "^3.2.2", - "lodash": "^4.17.21", + "lodash.includes": "^4.3.0", + "lodash.isboolean": "^3.0.3", + "lodash.isinteger": "^4.0.4", + "lodash.isnumber": "^3.0.3", + "lodash.isplainobject": "^4.0.6", + "lodash.isstring": "^4.0.1", + "lodash.once": "^4.0.0", "ms": "^2.1.1", - "semver": "^7.3.8" + "semver": "^7.5.4" }, "engines": { "node": ">=12", @@ -1176,86 +854,6 @@ "safe-buffer": "^5.0.1" } }, - "node_modules/kind-of": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", - "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/ky": { - "version": "0.25.1", - "resolved": "https://registry.npmjs.org/ky/-/ky-0.25.1.tgz", - "integrity": "sha512-PjpCEWlIU7VpiMVrTwssahkYXX1by6NCT0fhTUX34F3DTinARlgMpriuroolugFPcMgpPWrOW4mTb984Qm1RXA==", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sindresorhus/ky?sponsor=1" - } - }, - "node_modules/ky-universal": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/ky-universal/-/ky-universal-0.8.2.tgz", - "integrity": "sha512-xe0JaOH9QeYxdyGLnzUOVGK4Z6FGvDVzcXFTdrYA1f33MZdEa45sUDaMBy98xQMcsd2XIBrTXRrRYnegcSdgVQ==", - "dependencies": { - "abort-controller": "^3.0.0", - "node-fetch": "3.0.0-beta.9" - }, - "engines": { - "node": ">=10.17" - }, - "funding": { - "url": "https://github.com/sindresorhus/ky-universal?sponsor=1" - }, - "peerDependencies": { - "ky": ">=0.17.0", - "web-streams-polyfill": ">=2.0.0" - }, - "peerDependenciesMeta": { - "web-streams-polyfill": { - "optional": true - } - } - }, - "node_modules/ky-universal/node_modules/data-uri-to-buffer": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-3.0.1.tgz", - "integrity": "sha512-WboRycPNsVw3B3TL559F7kuBUM4d8CgMEvk6xEJlOp7OBPjt6G7z8WMWlD2rOFZLk6OYfFIUGsCOWzcQH9K2og==", - "engines": { - "node": ">= 6" - } - }, - "node_modules/ky-universal/node_modules/fetch-blob": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-2.1.2.tgz", - "integrity": "sha512-YKqtUDwqLyfyMnmbw8XD6Q8j9i/HggKtPEI+pZ1+8bvheBu78biSmNaXWusx1TauGqtUUGx/cBb1mKdq2rLYow==", - "engines": { - "node": "^10.17.0 || >=12.3.0" - }, - "peerDependenciesMeta": { - "domexception": { - "optional": true - } - } - }, - "node_modules/ky-universal/node_modules/node-fetch": { - "version": "3.0.0-beta.9", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.0.0-beta.9.tgz", - "integrity": "sha512-RdbZCEynH2tH46+tj0ua9caUHVWrd/RHnRfvly2EVdqGmI3ndS1Vn/xjm5KuGejDt2RNDQsVRLPNd2QPwcewVg==", - "dependencies": { - "data-uri-to-buffer": "^3.0.1", - "fetch-blob": "^2.1.1" - }, - "engines": { - "node": "^10.17 || >=12.3" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/node-fetch" - } - }, "node_modules/lock": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/lock/-/lock-1.1.0.tgz", @@ -1268,6 +866,48 @@ "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", "license": "MIT" }, + "node_modules/lodash.includes": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz", + "integrity": "sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==", + "license": "MIT" + }, + "node_modules/lodash.isboolean": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz", + "integrity": "sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg==", + "license": "MIT" + }, + "node_modules/lodash.isinteger": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz", + "integrity": "sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA==", + "license": "MIT" + }, + "node_modules/lodash.isnumber": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz", + "integrity": "sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw==", + "license": "MIT" + }, + "node_modules/lodash.isplainobject": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", + "integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==", + "license": "MIT" + }, + "node_modules/lodash.isstring": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", + "integrity": "sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==", + "license": "MIT" + }, + "node_modules/lodash.once": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", + "integrity": "sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==", + "license": "MIT" + }, "node_modules/lru-cache": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", @@ -1301,16 +941,6 @@ "node": ">= 0.6" } }, - "node_modules/minimalistic-assert": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", - "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" - }, - "node_modules/minimalistic-crypto-utils": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", - "integrity": "sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg==" - }, "node_modules/minimatch": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", @@ -1460,6 +1090,11 @@ "integrity": "sha512-fnWVljUchTro6RiCFvCXBbNhJc2NijN7oIQxbwsyL0buWJPG85v81ehlHI9fXrJsMNgTofEoWIQeClKpgxFLrg==", "license": "MIT" }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" + }, "node_modules/qs": { "version": "6.11.1", "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.1.tgz", @@ -1493,17 +1128,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/rdf-canonize": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/rdf-canonize/-/rdf-canonize-3.4.0.tgz", - "integrity": "sha512-fUeWjrkOO0t1rg7B2fdyDTvngj+9RlUyL92vOdiB7c0FPguWVsniIMjEtHH+meLBO9rzkUlUzBVXgWrjI8P9LA==", - "dependencies": { - "setimmediate": "^1.0.5" - }, - "engines": { - "node": ">=12" - } - }, "node_modules/resolve": { "version": "1.22.2", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.2.tgz", @@ -1543,10 +1167,9 @@ "license": "MIT" }, "node_modules/semver": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.0.tgz", - "integrity": "sha512-+XC0AD/R7Q2mPSRuy2Id0+CGTZ98+8f+KvwirxOKIEyid+XSx6HbC63p+O4IndTHuX5Z+JxQ0TghCkO5Cg/2HA==", - "license": "ISC", + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dependencies": { "lru-cache": "^6.0.0" }, @@ -1557,22 +1180,6 @@ "node": ">=10" } }, - "node_modules/setimmediate": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", - "integrity": "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==" - }, - "node_modules/shallow-clone": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-3.0.1.tgz", - "integrity": "sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA==", - "dependencies": { - "kind-of": "^6.0.2" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/side-channel": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", @@ -1587,23 +1194,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/source-map-support": { - "version": "0.5.21", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", - "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", - "dependencies": { - "buffer-from": "^1.0.0", - "source-map": "^0.6.0" - } - }, "node_modules/split-on-first": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/split-on-first/-/split-on-first-1.1.0.tgz", @@ -1655,11 +1245,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/tr46": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" - }, "node_modules/tslib": { "version": "2.5.2", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.2.tgz", @@ -1697,9 +1282,9 @@ } }, "node_modules/tslint/node_modules/semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", "dev": true, "bin": { "semver": "bin/semver" @@ -1733,17 +1318,16 @@ "license": "0BSD" }, "node_modules/typescript": { - "version": "3.9.7", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.7.tgz", - "integrity": "sha512-BLbiRkiBzAwsjut4x/dsibSTB6yWpwT5qWmC2OfuCg3GgVQCSgMs4vEctYPhsaGtd0AeuuHMkjZ2h2WG8MSzRw==", + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.2.tgz", + "integrity": "sha512-6l+RyNy7oAHDfxC4FzSJcz9vnjTKxrLpDG5M2Vu4SHRVNg6xzqZp6LYSR9zjqQTu8DU/f5xwxUdADOkbrIX2gQ==", "dev": true, - "license": "Apache-2.0", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" }, "engines": { - "node": ">=4.2.0" + "node": ">=14.17" } }, "node_modules/uint8arrays": { @@ -1777,20 +1361,6 @@ "node": ">= 8" } }, - "node_modules/webidl-conversions": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" - }, - "node_modules/whatwg-url": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", - "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", - "dependencies": { - "tr46": "~0.0.3", - "webidl-conversions": "^3.0.0" - } - }, "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", diff --git a/package.json b/package.json index d5547ed9..eaf7d942 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fireblocks-sdk", - "version": "5.3.1", + "version": "5.38.0", "main": "dist/src/fireblocks-sdk.js", "types": "dist/src/fireblocks-sdk.d.ts", "scripts": { @@ -15,9 +15,9 @@ }, "license": "MIT", "dependencies": { - "@notabene/pii-sdk": "^1.16.0", - "axios": "^0.27.2", - "jsonwebtoken": "9.0.0", + "@notabene/pii-sdk": "^1.17.1", + "axios": "^1.7.7", + "jsonwebtoken": "^9.0.2", "platform": "^1.3.6", "qs": "^6.11.0", "query-string": "^7.1.3", @@ -30,7 +30,7 @@ "@types/qs": "^6.9.7", "@types/uuid": "^8.3.1", "tslint": "6.1.3", - "typescript": "3.9.7" + "typescript": "^5.3.2" }, "files": [ "dist/**/*" diff --git a/src/api-client.ts b/src/api-client.ts index fccecb7a..df49db32 100644 --- a/src/api-client.ts +++ b/src/api-client.ts @@ -1,9 +1,11 @@ import os from "os"; import platform from "platform"; +import axios, { AxiosInstance } from "axios"; +import queryString from "query-string"; + import { IAuthProvider } from "./iauth-provider"; import { RequestOptions, TransactionPageResponse } from "./types"; import { SDKOptions } from "./fireblocks-sdk"; -import axios, { AxiosInstance } from "axios"; import { version as SDK_VERSION } from "../package.json"; export class ApiClient { @@ -14,12 +16,16 @@ export class ApiClient { baseURL: this.apiBaseUrl, proxy: this.options?.proxy, timeout: this.options?.timeoutInMs, + httpsAgent: this.options?.httpsAgent, headers: { "X-API-Key": this.authProvider.getApiKey(), "User-Agent": this.getUserAgent() - } + }, }); + if (options?.customAxiosOptions?.interceptors?.request) { + this.axiosInstance.interceptors.request.use(options.customAxiosOptions.interceptors.request.onFulfilled, options.customAxiosOptions.interceptors.request.onRejected); + } if (options?.customAxiosOptions?.interceptors?.response) { this.axiosInstance.interceptors.response.use(options.customAxiosOptions.interceptors.response.onFulfilled, options.customAxiosOptions.interceptors.response.onRejected); } @@ -36,7 +42,8 @@ export class ApiClient { return userAgent; } - public async issueGetRequestForTransactionPages(path: string): Promise { + public async issueGetRequestForTransactionPages(rawPath: string): Promise { + const path = normalizePath(rawPath); const token = this.authProvider.signJwt(path); const res = await this.axiosInstance.get(path, { headers: {"Authorization": `Bearer ${token}`} @@ -50,46 +57,67 @@ export class ApiClient { }; } - public async issueGetRequest(path: string): Promise { + public async issueGetRequest(rawPath: string, queryStringParams?: object, requestOptions?: RequestOptions): Promise { + const pathWithParams = queryStringParams ? `${rawPath}?${queryString.stringify(queryStringParams)}` : rawPath; + const path = normalizePath(pathWithParams); const token = this.authProvider.signJwt(path); - const res = await this.axiosInstance.get(path, { - headers: {"Authorization": `Bearer ${token}`} - }); + const headers: any = {"Authorization": `Bearer ${token}`}; + this.addNcwHeaderIfNeeded(headers, requestOptions); + const res = await this.axiosInstance.get(path, { headers }); return res.data; } - public async issuePostRequest(path: string, body: any, requestOptions?: RequestOptions): Promise { + public async issuePostRequest(rawPath: string, body: any, requestOptions?: RequestOptions): Promise { + const path = normalizePath(rawPath); const token = this.authProvider.signJwt(path, body); const headers: any = {"Authorization": `Bearer ${token}`}; const idempotencyKey = requestOptions?.idempotencyKey; if (idempotencyKey) { headers["Idempotency-Key"] = idempotencyKey; } + this.addNcwHeaderIfNeeded(headers, requestOptions); const response = await this.axiosInstance.post(path, body, {headers}); return response.data; } - public async issuePutRequest(path: string, body: any): Promise { + public async issuePutRequest(rawPath: string, body: any, requestOptions?: RequestOptions): Promise { + const path = normalizePath(rawPath); const token = this.authProvider.signJwt(path, body); - const res = (await this.axiosInstance.put(path, body, { - headers: {"Authorization": `Bearer ${token}`} - })); + const headers: any = { "Authorization": `Bearer ${token}` }; + this.addNcwHeaderIfNeeded(headers, requestOptions); + const res = (await this.axiosInstance.put(path, body, {headers})); return res.data; } - public async issuePatchRequest(path: string, body: any): Promise { + public async issuePatchRequest(rawPath: string, body: any, requestOptions?: RequestOptions): Promise { + const path = normalizePath(rawPath); const token = this.authProvider.signJwt(path, body); - const res = (await this.axiosInstance.patch(path, body, { - headers: {"Authorization": `Bearer ${token}`} - })); + const headers: any = { "Authorization": `Bearer ${token}` }; + this.addNcwHeaderIfNeeded(headers, requestOptions); + const res = (await this.axiosInstance.patch(path, body, {headers})); return res.data; } - public async issueDeleteRequest(path: string): Promise { + public async issueDeleteRequest(rawPath: string, requestOptions?: RequestOptions): Promise { + const path = normalizePath(rawPath); const token = this.authProvider.signJwt(path); - const res = (await this.axiosInstance.delete(path, { - headers: {"Authorization": `Bearer ${token}`} - })); + const headers: any = { "Authorization": `Bearer ${token}` }; + this.addNcwHeaderIfNeeded(headers, requestOptions); + const res = (await this.axiosInstance.delete(path, {headers})); return res.data; } + + private addNcwHeaderIfNeeded(headers: any, requestOptions: RequestOptions) { + if (requestOptions?.ncw?.walletId) { + headers["X-End-User-Wallet-Id"] = requestOptions.ncw.walletId; + } + } +} + +/** + * This function allows backward compatibility with previous version of axios that did not omit "?" for + * urls with no params. This function will make sure we are omitting the "?" before signing it + */ +function normalizePath(path: string) { + return path.replace(/\?$/, ""); } diff --git a/src/common/public_key_info.ts b/src/common/public_key_info.ts new file mode 100644 index 00000000..34bc0d41 --- /dev/null +++ b/src/common/public_key_info.ts @@ -0,0 +1,45 @@ +import { ApiClient } from "../api-client"; +import { PeerType, PublicKeyInfoArgs, PublicKeyInfoByAccountAssetArgs, PublicKeyInfoForVaultAccountArgs, PublicKeyInformation, PublicKeyResponse, RequestOptions } from "../types"; +import queryString from "query-string"; + +export async function getPublicKeyInfoImpl(peerType: PeerType, args: PublicKeyInfoArgs, apiClient: ApiClient, walletId?: string): Promise { + let url: string; + let requestOptions: RequestOptions; + if (peerType === PeerType.VAULT_ACCOUNT) { + url = `/v1/vault/public_key_info`; + } else if (peerType === PeerType.END_USER_WALLET) { + requestOptions = { ncw: { walletId } }; + url = `/v1/ncw/${walletId}/public_key_info`; + } else { + throw new Error(`Unsupported peer type: ${peerType}`); + } + + const query = queryString.stringify({ + algorithm: args.algorithm, + derivationPath: JSON.stringify(args.derivationPath), + compressed: args.compressed, + }); + url += `?${query}`; + + return await apiClient.issueGetRequest(url, undefined, requestOptions); +} + +export async function getPublicKeyInfoByAccountAssetImpl(peerType: PeerType, args: PublicKeyInfoForVaultAccountArgs | PublicKeyInfoByAccountAssetArgs, apiClient: ApiClient, walletId?: string): Promise { + let url: string; + let requestOptions: RequestOptions; + if (peerType === PeerType.VAULT_ACCOUNT) { + url = `/v1/vault/accounts/${(args as PublicKeyInfoForVaultAccountArgs).vaultAccountId}/${args.assetId}/${args.change}/${args.addressIndex}/public_key_info`; + } else if (peerType === PeerType.END_USER_WALLET) { + requestOptions = { ncw: { walletId } }; + url = `/v1/ncw/${walletId}/accounts/${(args as PublicKeyInfoByAccountAssetArgs).accountId}/${args.assetId}/${args.change}/${args.addressIndex}/public_key_info`; + } else { + throw new Error(`Unsupported peer type: ${peerType}`); + } + + const query = queryString.stringify({ + compressed: args.compressed, + }); + url += `?${query}`; + + return await apiClient.issueGetRequest(url, undefined, requestOptions); +} \ No newline at end of file diff --git a/src/fireblocks-sdk.ts b/src/fireblocks-sdk.ts index 026e63ed..138cb701 100644 --- a/src/fireblocks-sdk.ts +++ b/src/fireblocks-sdk.ts @@ -22,6 +22,8 @@ import { InternalWalletAsset, MaxSpendableAmountResponse, MaxBip44IndexUsedResponse, + PaginatedAddressesResponse, + OptionalPaginatedAddressesRequestFilters, NetworkConnectionResponse, OffExchangeEntityResponse, OperationSuccessResponse, @@ -53,6 +55,7 @@ import { TimePeriod, AuditsResponse, NFTOwnershipFilter, + NFTOwnedAssetsFilter, Token, TokenWithBalance, Web3PagedResponse, @@ -61,19 +64,20 @@ import { GetWeb3ConnectionsPayload, PublicKeyResponse, AllocateFundsResponse, - SettleOffExchangeAccountResponse, AddCollateralTransactionRequest, RemoveCollateralTransactionRequest, GetSettlementTransactionsResponse, SettlementRequest, SettlementResponse, GetNFTsFilter, + SettleOffExchangeAccountResponse, PublicKeyInformation, DropTransactionResponse, - TokenLink, - TokenLinkPermissionEntry, - IssueTokenRequest, + GetAssetWalletsFilters, + GetAssetWalletsResponse, + PeerType, NFTOwnershipStatus, + NFTOwnershipStatusUpdatedPayload, NFTOwnedCollectionsFilter, CollectionOwnership, TravelRuleOptions, @@ -84,16 +88,100 @@ import { TravelRuleVasp, TravelRuleVaspFilter, TravelRuleEncryptionOptions, + TravelRuleVaspForVaultRequestResponse, SmartTransfersTicketResponse, SmartTransfersTicketCreatePayload, SmartTransfersTicketsResponse, SmartTransfersTicketsFilters, SmartTransfersTicketTermPayload, SmartTransfersTicketTermFundPayload, + ScreeningPolicyConfiguration, SmartTransfersTicketTermResponse, + ConsoleUser, + ApiUser, + TRole, + UsersGroup, + SmartTransfersUserGroupsResponse, + LeanContractTemplateDto, + ContractTemplateDto, + BatchTask, + BatchJob, + JobCreatedResponse, + ContractUploadRequest, + ContractDeployResponse, + ContractDeployRequest, + ExchangeAccountsPageFilter, + PagedExchangeResponse, + TAP, + WriteCallFunctionDto, + ReadCallFunctionDto, + WriteCallFunctionResponseDto, + ContractAbiResponseDto, + DeployedContractResponseDto, + TransactionReceiptResponseDto, + LeanDeployedContractResponseDto, + ParameterWithValueList, + ScreeningTenantConfiguration, + ScreeningType, + ScreeningConfigurationsResponse, + ScreeningPolicyRuleResponse, + ScreeningProviderConfigurationResponse, + AuditLogsResponse, + TokenLink, + IssueTokenRequest, + TokenLinksCount, + GetTokenLinksFilter, + GetContractTemplatesFilter, + TokenLinkStatus, + SupportedContractTemplateType, + AbiFunction, + SupportedBlockchainsResponse, + GetContractsFilter, + TokenOwnershipSpamUpdatePayload, + ScreeningSupportedAssetResponse, + ScreeningSupportedProviders, + RegisterAssetResponse, + UnspentInputsResponse, + ContractAddressResponseDto, + AssetPriceResponse, + CollectionLink, + CreateCollectionRequest, + CollectionTokenResponseDto, + MintCollectionTokenRequest, + BurnCollectionTokenRequest, + ContractWithABIDto, + RescanTx, + RescanTxResponse, + ListAssetsResponse, + ListAssetsFilters, + ListAssetResponse, + ListBlockchainResponse, + ListBlockchainsFilters, + ListBlockchainsResponse, + PaginatedInternalWalletContainerResponse, + UpdateAssetUserMetadataRequest, } from "./types"; -import { AxiosProxyConfig, AxiosResponse } from "axios"; +import { AxiosProxyConfig, AxiosResponse, InternalAxiosRequestConfig } from "axios"; import { PIIEncryption } from "./pii-client"; +import { NcwApiClient } from "./ncw-api-client"; +import { NcwSdk } from "./ncw-sdk"; +import { StakingApiClient } from "./staking/staking-api-client"; +import { + ChainInfo, + CheckTermsOfServiceResponseDto, + DelegationSummaryDto, + DelegationSummaryDtoByVault, SplitRequestDto, SplitResponse, + StakeRequestDto, + StakeResponse, + StakingChain, + StakingPosition, + StakingProvider, + UnstakeRequestDto, + UnstakeResponse, + WithdrawRequestDto, + WithdrawResponse +} from "./staking"; +import { getPublicKeyInfoByAccountAssetImpl, getPublicKeyInfoImpl } from "./common/public_key_info"; export * from "./types"; @@ -110,16 +198,23 @@ export interface SDKOptions { /** Additional product identifier to be prepended to the User-Agent header */ userAgent?: string; + /** Replace default https agent */ + httpsAgent?: any; + /** * Providing custom axios options including a response interceptor (https://axios-http.com/docs/interceptors) */ customAxiosOptions?: { - interceptors?: { - response?: { - onFulfilled: (value: AxiosResponse) => AxiosResponse | Promise>; - onRejected: (error: any) => any; - }; - } + interceptors?: { + request?: { + onFulfilled: (value: InternalAxiosRequestConfig) => InternalAxiosRequestConfig | Promise>; + onRejected: (error: any) => any; + }; + response?: { + onFulfilled: (value: AxiosResponse) => AxiosResponse | Promise>; + onRejected: (error: any) => any; + }; + } }; /** @@ -128,10 +223,15 @@ export interface SDKOptions { travelRuleOptions?: TravelRuleOptions; } +const DEFAULT_MAX_PAGE_SIZE = 100; + export class FireblocksSDK { private readonly authProvider: IAuthProvider; private readonly apiBaseUrl: string; private readonly apiClient: ApiClient; + private readonly apiNcw: NcwApiClient; + private readonly stakingApiClient: StakingApiClient; + private piiClient: PIIEncryption; /** @@ -154,21 +254,122 @@ export class FireblocksSDK { if (sdkOptions?.travelRuleOptions) { this.piiClient = new PIIEncryption(sdkOptions.travelRuleOptions); } + + this.apiNcw = new NcwApiClient(this.apiClient); + + this.stakingApiClient = new StakingApiClient(this.apiClient); } + /** + * NCW API Namespace + * + * @readonly + * @type {NcwSdk} + */ + public get NCW(): NcwSdk { + return this.apiNcw; + } /** * Get the instance of ApiClient used by the FireblocksSDK */ public getApiClient(): ApiClient { return this.apiClient; } - + /** + * Get all staking chains + */ + public async getStakingChains(): Promise { + return await this.stakingApiClient.getChains(); + } + /** + * Get chain info + */ + public async getStakingChainInfo(chainDescriptor: StakingChain): Promise { + return await this.stakingApiClient.getChainInfo(chainDescriptor); + } + /** + * Get staking positions summary + */ + public async getStakingPositionsSummary(): Promise { + return await this.stakingApiClient.getPositionsSummary(); + } + /** + * Get staking positions summary by vault + */ + public async getStakingPositionsSummaryByVault(): Promise { + return await this.stakingApiClient.getPositionsSummaryByVault(); + } + /** + * Initiate staking stake on a chain + */ + public async executeStakingStake(chainDescriptor: StakingChain, body: StakeRequestDto): Promise { + return await this.stakingApiClient.stake(chainDescriptor, body); + } + /** + * Execute staking unstake on a chain + */ + public async executeStakingUnstake(chainDescriptor: StakingChain, body: UnstakeRequestDto): Promise { + return await this.stakingApiClient.unstake(chainDescriptor, body); + } + /** + * Execute staking withdraw on a chain + */ + public async executeStakingWithdraw(chainDescriptor: StakingChain, body: WithdrawRequestDto): Promise { + return await this.stakingApiClient.withdraw(chainDescriptor, body); + } + /** + * Execute staking claim rewards on a chain + */ + public async executeStakingClaimRewards(chainDescriptor: StakingChain, body: WithdrawRequestDto): Promise { + return await this.stakingApiClient.withdraw(chainDescriptor, body); + } + /** + * Execute staking split on a chain + */ + public async executeStakingSplit(chainDescriptor: StakingChain, body: SplitRequestDto): Promise { + return await this.stakingApiClient.split(chainDescriptor, body); + } + /** + * Get all staking positions, optionally filtered by chain + */ + public async getStakingPositions(chainDescriptor?: StakingChain): Promise { + return await this.stakingApiClient.getPositions(chainDescriptor); + } + /** + * Get a staking position by id + */ + public async getStakingPosition(positionId: string): Promise { + return await this.stakingApiClient.getPosition(positionId); + } + /** + * Get all staking providers + */ + public async getStakingProviders(): Promise { + return await this.stakingApiClient.getProviders(); + } + /** + * Approve staking provider terms of service + */ + public async approveStakingProviderTermsOfService(providerId: string): Promise { + return await this.stakingApiClient.approveProviderTermsOfService(providerId); + } /** * Gets all assets that are currently supported by Fireblocks */ public async getSupportedAssets(): Promise { return await this.apiClient.issueGetRequest("/v1/supported_assets"); } + + /** + * Sets asset price + * @param id The asset ID + * @param currency The currency (according to ISO 4217 currency codes) + * @param price The price in currency + */ + public async setAssetPrice(id: string, currency: string, price: number): Promise { + return await this.apiClient.issuePostRequest(`/v1/assets/prices/${id}`, { currency, price }); + } + /** * Gets a list of vault accounts per page matching the given filter or path * @param pagedVaultAccountsRequestFilters Filters for the first request @@ -176,6 +377,15 @@ export class FireblocksSDK { public async getVaultAccountsWithPageInfo(pagedVaultAccountsRequestFilters: PagedVaultAccountsRequestFilters): Promise { return await this.apiClient.issueGetRequest(`/v1/vault/accounts_paged?${queryString.stringify(pagedVaultAccountsRequestFilters)}`); } + + /** + * Gets a list of asset wallets per page matching the given filter or path + * @param getVaultWalletsFilters Filters for the first request + */ + public async getAssetWallets(getVaultWalletsFilters: GetAssetWalletsFilters): Promise { + return await this.apiClient.issueGetRequest(`/v1/vault/asset_wallets?${queryString.stringify(getVaultWalletsFilters)}`); + } + /** * Gets a single vault account * @param vaultAccountId The vault account ID @@ -217,7 +427,7 @@ export class FireblocksSDK { * @param vaultAccountId The vault account ID * @param assetId The ID of the asset for which to get the utxo list */ - public async getUnspentInputs(vaultAccountId: string, assetId: string): Promise { + public async getUnspentInputs(vaultAccountId: string, assetId: string): Promise { return await this.apiClient.issueGetRequest(`/v1/vault/accounts/${vaultAccountId}/${assetId}/unspent_inputs`); } @@ -252,7 +462,7 @@ export class FireblocksSDK { return await this.apiClient.issuePutRequest( `/v1/vault/accounts/${vaultAccountId}/${assetId}/addresses/${addressId}`, - {description: description || ""}); + { description: description || "" }); } /** @@ -380,6 +590,13 @@ export class FireblocksSDK { return await this.apiClient.issueGetRequest("/v1/exchange_accounts"); } + /** + * Gets all exchange accounts for your tenant + * @param filter Get exchange accounts matching pageFilter params + */ + public async getExchangeAccountsPaged(filter: ExchangeAccountsPageFilter): Promise { + return await this.apiClient.issueGetRequest(`/v1/exchange_accounts/paged?${queryString.stringify(filter)}`); + } /** * Gets a single exchange account by ID @@ -515,7 +732,7 @@ export class FireblocksSDK { } return { - transactions: [], pageDetails: { prevPage: "", nextPage: "" }, + transactions: [], pageDetails: { prevPage: "", nextPage: "" }, }; } @@ -542,6 +759,16 @@ export class FireblocksSDK { return await this.apiClient.issueGetRequest(`/v1/internal_wallets/${walletId}`); } + /** + * Gets a paginated response of assets for a single internal wallet + * @param walletId The internal wallet ID + * @param pageSize Number of assets to return per page (default=50, max=200) + * @param pageCursor Cursor for pagination + */ + public async getInternalWalletAssets(walletId: string, pageSize?: number, pageCursor?: string): Promise { + return await this.apiClient.issueGetRequest(`/v1/internal_wallets/${walletId}/assets`, {pageSize, pageCursor}); + } + /** * Gets a single internal wallet asset * @param walletId The internal wallet ID @@ -662,7 +889,7 @@ export class FireblocksSDK { * @param requestOptions */ public async setAutoFuel(vaultAccountId: string, autoFuel: boolean, requestOptions?: RequestOptions): Promise { - return await this.apiClient.issuePostRequest(`/v1/vault/accounts/${vaultAccountId}/set_auto_fuel`, {autoFuel}, requestOptions); + return await this.apiClient.issuePostRequest(`/v1/vault/accounts/${vaultAccountId}/set_auto_fuel`, { autoFuel }, requestOptions); } /** @@ -688,6 +915,58 @@ export class FireblocksSDK { return await this.apiClient.issuePostRequest(`/v1/vault/accounts/${vaultAccountId}/${assetId}`, {}, requestOptions); } + /** + * Registers new asset + * @param blockchainId Native asset of blockchain + * @param address Asset contract address + * @param symbol Asset symbol + * @param requestOptions + */ + public async registerNewAsset(blockchainId: string, address: string, symbol?: string, requestOptions?: RequestOptions): Promise { + return await this.apiClient.issuePostRequest(`/v1/assets`, { blockchainId, address, symbol }, requestOptions); + } + + /** + * List assets + * @param filters + */ + public async listAssets(filters?: ListAssetsFilters): Promise { + return await this.apiClient.issueGetRequest(`/v1/assets`, filters); + } + + /** + * Get an asset + * @param assetId The ID or legacyId of the asset + */ + public async getAssetById(assetId: string): Promise { + return await this.apiClient.issueGetRequest(`/v1/assets/${assetId}`); + } + + /** + * List blockchains + * @param filters + */ + public async listBlockchains(filters?: ListBlockchainsFilters): Promise { + return await this.apiClient.issueGetRequest(`/v1/blockchains`, filters); + } + + /** + * Get an blockchain + * @param blockchainId The ID or legacyId of the blockchain + */ + public async getBlockchainById(blockchainId: string): Promise { + return await this.apiClient.issueGetRequest(`/v1/blockchains/${blockchainId}`); + } + + /** + * Update the user’s metadata for an asset + * @param assetId The ID or legacyId of the asset + * @param updateAssetUserMetadataRequest Asset user metadata + */ + public async updateAssetUserMetadata(assetId: string, updateAssetUserMetadataRequest: UpdateAssetUserMetadataRequest): Promise { + return await this.apiClient.issuePatchRequest(`/v1/assets/${assetId}`, updateAssetUserMetadataRequest); + } + /** * Retry to create a vault asset for a vault asset that failed * @param vaultAccountId The vault account ID @@ -695,7 +974,7 @@ export class FireblocksSDK { * @param requestOptions */ public async activateVaultAsset(vaultAccountId: string, assetId: string, requestOptions?: RequestOptions): Promise { - return await this.apiClient.issuePostRequest(`/v1/vault/accounts/${vaultAccountId}/${assetId}/activate`, {} , requestOptions); + return await this.apiClient.issuePostRequest(`/v1/vault/accounts/${vaultAccountId}/${assetId}/activate`, {}, requestOptions); } /** @@ -732,7 +1011,7 @@ export class FireblocksSDK { * Creates a new contract wallet * @param name A name for the new contract wallet */ - public async createContractWallet(name: string, requestOptions?: RequestOptions): Promise> { + public async createContractWallet(name: string, requestOptions?: RequestOptions): Promise> { const body = { name, }; @@ -783,7 +1062,7 @@ export class FireblocksSDK { * @param address The wallet address * @param tag (for ripple only) The ripple account tag */ - public async createContractWalletAsset(walletId: string, assetId: string, address: string, tag?: string, requestOptions?: RequestOptions): Promise { + public async createContractWalletAsset(walletId: string, assetId: string, address: string, tag?: string, requestOptions?: RequestOptions): Promise { const path = `/v1/contracts/${walletId}/${assetId}`; const body = { @@ -797,11 +1076,18 @@ export class FireblocksSDK { * Creates a new transaction with the specified options */ public async createTransaction(transactionArguments: TransactionArguments, requestOptions?: RequestOptions, travelRuleEncryptionOptions?: TravelRuleEncryptionOptions): Promise { + const opts = { ...requestOptions }; + if (transactionArguments?.travelRuleMessage) { transactionArguments = await this.piiClient.hybridEncode(transactionArguments, travelRuleEncryptionOptions); } - return await this.apiClient.issuePostRequest("/v1/transactions", transactionArguments, requestOptions); + if (transactionArguments.source?.type === PeerType.END_USER_WALLET && !opts.ncw?.walletId) { + const { walletId } = transactionArguments.source; + opts.ncw = { ...opts.ncw, walletId }; + } + + return await this.apiClient.issuePostRequest("/v1/transactions", transactionArguments, opts); } /** @@ -856,7 +1142,7 @@ export class FireblocksSDK { * Deletes a single contract wallet * @param walletId The contract wallet ID */ - public async deleteContractWallet(walletId: string): Promise { + public async deleteContractWallet(walletId: string): Promise { return await this.apiClient.issueDeleteRequest(`/v1/contracts/${walletId}`); } @@ -876,7 +1162,7 @@ export class FireblocksSDK { * @param requestOptions */ public async setCustomerRefIdForVaultAccount(vaultAccountId: string, customerRefId: string, requestOptions?: RequestOptions): Promise { - return await this.apiClient.issuePostRequest(`/v1/vault/accounts/${vaultAccountId}/set_customer_ref_id`, {customerRefId}, requestOptions); + return await this.apiClient.issuePostRequest(`/v1/vault/accounts/${vaultAccountId}/set_customer_ref_id`, { customerRefId }, requestOptions); } /** @@ -886,7 +1172,7 @@ export class FireblocksSDK { * @param requestOptions */ public async setCustomerRefIdForInternalWallet(walletId: string, customerRefId: string, requestOptions?: RequestOptions): Promise { - return await this.apiClient.issuePostRequest(`/v1/internal_wallets/${walletId}/set_customer_ref_id`, {customerRefId}, requestOptions); + return await this.apiClient.issuePostRequest(`/v1/internal_wallets/${walletId}/set_customer_ref_id`, { customerRefId }, requestOptions); } /** @@ -896,7 +1182,7 @@ export class FireblocksSDK { * @param requestOptions */ public async setCustomerRefIdForExternalWallet(walletId: string, customerRefId: string, requestOptions?: RequestOptions): Promise { - return await this.apiClient.issuePostRequest(`/v1/external_wallets/${walletId}/set_customer_ref_id`, {customerRefId}, requestOptions); + return await this.apiClient.issuePostRequest(`/v1/external_wallets/${walletId}/set_customer_ref_id`, { customerRefId }, requestOptions); } /** @@ -914,7 +1200,7 @@ export class FireblocksSDK { addressId = `${address}:${tag}`; } - return await this.apiClient.issuePostRequest(`/v1/vault/accounts/${vaultAccountId}/${assetId}/addresses/${addressId}/set_customer_ref_id`, {customerRefId}, requestOptions); + return await this.apiClient.issuePostRequest(`/v1/vault/accounts/${vaultAccountId}/${assetId}/addresses/${addressId}/set_customer_ref_id`, { customerRefId }, requestOptions); } /** @@ -924,7 +1210,7 @@ export class FireblocksSDK { * @param requestOptions */ public async setConfirmationThresholdForTxId(txId: string, requiredConfirmationsNumber: number, requestOptions?: RequestOptions): Promise { - return await this.apiClient.issuePostRequest(`/v1/transactions/${txId}/set_confirmation_threshold`, {numOfConfirmations: requiredConfirmationsNumber}, requestOptions); + return await this.apiClient.issuePostRequest(`/v1/transactions/${txId}/set_confirmation_threshold`, { numOfConfirmations: requiredConfirmationsNumber }, requestOptions); } /** @@ -934,7 +1220,7 @@ export class FireblocksSDK { * @param requestOptions */ public async setConfirmationThresholdForTxHash(txHash: string, requiredConfirmationsNumber: number, requestOptions?: RequestOptions): Promise { - return await this.apiClient.issuePostRequest(`/v1/txHash/${txHash}/set_confirmation_threshold`, {numOfConfirmations: requiredConfirmationsNumber}, requestOptions); + return await this.apiClient.issuePostRequest(`/v1/txHash/${txHash}/set_confirmation_threshold`, { numOfConfirmations: requiredConfirmationsNumber }, requestOptions); } /** @@ -942,17 +1228,7 @@ export class FireblocksSDK { * @param args */ public async getPublicKeyInfo(args: PublicKeyInfoArgs): Promise { - let url = `/v1/vault/public_key_info`; - if (args.algorithm) { - url += `?algorithm=${args.algorithm}`; - } - if (args.derivationPath) { - url += `&derivationPath=${JSON.stringify(args.derivationPath)}`; - } - if (args.compressed) { - url += `&compressed=${args.compressed}`; - } - return await this.apiClient.issueGetRequest(url); + return await getPublicKeyInfoImpl(PeerType.VAULT_ACCOUNT, args, this.apiClient); } /** @@ -986,11 +1262,7 @@ export class FireblocksSDK { * @param args */ public async getPublicKeyInfoForVaultAccount(args: PublicKeyInfoForVaultAccountArgs): Promise { - let url = `/v1/vault/accounts/${args.vaultAccountId}/${args.assetId}/${args.change}/${args.addressIndex}/public_key_info`; - if (args.compressed) { - url += `?compressed=${args.compressed}`; - } - return await this.apiClient.issueGetRequest(url); + return await getPublicKeyInfoByAccountAssetImpl(PeerType.VAULT_ACCOUNT, args, this.apiClient); } /** @@ -1016,7 +1288,7 @@ export class FireblocksSDK { url += `/${assetId}`; } - const body = {gasThreshold, gasCap, maxGasPrice}; + const body = { gasThreshold, gasCap, maxGasPrice }; return await this.apiClient.issuePutRequest(url, body); } @@ -1027,7 +1299,7 @@ export class FireblocksSDK { public async dropTransaction(txId: string, feeLevel?: string, requestedFee?: string, requestOptions?: RequestOptions): Promise { const url = `/v1/transactions/${txId}/drop`; - const body = {feeLevel, requestedFee}; + const body = { feeLevel, requestedFee }; return await this.apiClient.issuePostRequest(url, body, requestOptions); } @@ -1054,6 +1326,13 @@ export class FireblocksSDK { return await this.apiClient.issueGetRequest(url); } + /** + * Gets a paginated response of the addresses for a given vault account and asset + */ + public async getPaginatedAddresses(vaultAccountId: string, assetId: string, paginatedAddressesRequestFilters?: OptionalPaginatedAddressesRequestFilters): Promise { + return await this.apiClient.issueGetRequest(`/v1/vault/accounts/${vaultAccountId}/${assetId}/addresses_paginated?${queryString.stringify(paginatedAddressesRequestFilters)}`); + } + /** * Get all vault assets balance overview */ @@ -1111,7 +1390,7 @@ export class FireblocksSDK { * @param resendStatusUpdated If true a webhook will be sent for the status of the transaction * @param requestOptions */ - public async resendTransactionWebhooksById(txId: string, resendCreated?: boolean, resendStatusUpdated?: boolean, requestOptions?: RequestOptions): Promise { + public async resendTransactionWebhooksById(txId: string, resendCreated?: boolean, resendStatusUpdated?: boolean, requestOptions?: RequestOptions): Promise { const body = { resendCreated, resendStatusUpdated }; return await this.apiClient.issuePostRequest(`/v1/webhooks/resend/${txId}`, body, requestOptions); } @@ -1123,6 +1402,124 @@ export class FireblocksSDK { return await this.apiClient.issueGetRequest("/v1/users"); } + /** + * Gets all Console Users for your tenant + */ + public async getConsoleUsers(): Promise<{ users: ConsoleUser[] }> { + return await this.apiClient.issueGetRequest("/v1/management/users"); + } + + /** + * Gets all Api Users for your tenant + */ + public async getApiUsers(): Promise<{ users: ApiUser[] }> { + return await this.apiClient.issueGetRequest("/v1/management/api_users"); + } + + /** + * Create Console User for your tenant + * @param firstName firstName of the user, example: "Johnny". Maximum length: 30 chars. + * @param lastName lastName of the user. Maximum length: 30 chars. + * @param email email of the user, example: "email@example.com" + * @param role role of the user, for example: "ADMIN" + * @param requestOptions + */ + public async createConsoleUser(firstName: string, lastName: string, email: string, role: TRole, requestOptions?: RequestOptions): Promise { + const body = { firstName, lastName, email, role }; + return await this.apiClient.issuePostRequest("/v1/management/users", body, requestOptions); + } + + /** + * Create Api User for your tenant + * @param name name of the api user, example: "Johnny The Api". Maximum length: 30 chars. + * @param role role of the user, for example: "ADMIN" + * @param csrPem generate .csr file and provide its string content here, example: "-----BEGIN CERTIFICATE REQUEST-----aaa-----END CERTIFICATE REQUEST-----" + * You can find more info about csrPem and how to create it here: https://developers.fireblocks.com/docs/quickstart + * @param coSignerSetup your cosigner, for example: "SGX_MACHINE", read more: https://developers.fireblocks.com/docs/quickstart + * @param coSignerSetupIsFirstUser [SGX server enabled only] If you are the first user to be configured on this SGX-enabled Co-Signer server, this has to be true + */ + public async createApiUser(name: string, role: TRole, csrPem: string, coSignerSetup?: string, coSignerSetupIsFirstUser?: boolean, requestOptions?: RequestOptions): Promise { + const body = { name, role, csrPem, coSignerSetup, coSignerSetupIsFirstUser }; + return await this.apiClient.issuePostRequest("/v1/management/api_users", body, requestOptions); + } + + /** + * Re-enroll Mobile Device of a user in your tenant + * @param id userId of the user to reset device + * @param requestOptions + */ + public async resetDeviceRequest(id: string, requestOptions?: RequestOptions): Promise { + return await this.apiClient.issuePostRequest(`/v1/management/users/${id}/reset_device`, {}, requestOptions); + } + + /** + * Get whitelisted addresses of api user in your tenant + * @param id userId of the user + * @param requestOptions + */ + public async getWhitelistedAddresses(id: string): Promise { + return await this.apiClient.issueGetRequest(`/v1/management/api_users/${id}/whitelist_ip_addresses`); + } + + /** + * Get the tenant's OTA (One-Time-Address) configuration + */ + public async getOtaConfiguration(): Promise<{ enabled: boolean }> { + return await this.apiClient.issueGetRequest("/v1/management/ota"); + } + + /** + * Update the tenant's OTA (One-Time-Address) configuration + * @param enable + */ + public async updateOtaConfiguration(enable: boolean): Promise { + const body = { enabled: enable }; + return await this.apiClient.issuePutRequest("/v1/management/ota", body); + } + + /** Gets all Users Groups for your tenant + */ + public async getUserGroups(): Promise { + return await this.apiClient.issueGetRequest("/v1/management/user_groups"); + } + + /** + * Gets a Users Group by ID + * @param id The ID of the User + */ + public async getUserGroup(id: string): Promise { + return await this.apiClient.issueGetRequest(`/v1/management/user_groups/${id}`); + } + + /** + * Creates a new Users Group + * @param name The name of the Users Group + * @param memberIds The members of the Users Group + */ + public async createUserGroup(groupName: string, memberIds?: string[]): Promise { + const body = { groupName, memberIds }; + return await this.apiClient.issuePostRequest("/v1/management/user_groups", body); + } + + /** + * Updates a Users Group + * @param id The ID of the Users Group + * @param name The name of the Users Group + * @param memberIds The members of the Users Group + */ + public async updateUserGroup(id: string, groupName?: string, memberIds?: string[]): Promise { + const body = { groupName, memberIds }; + return await this.apiClient.issuePutRequest(`/v1/management/user_groups/${id}`, body); + } + + /** + * Deletes a Users Group + * @param id The ID of the Users Group + */ + public async deleteUserGroup(id: string): Promise { + return await this.apiClient.issueDeleteRequest(`/v1/management/user_groups/${id}`); + } + /** * Get off exchange accounts */ @@ -1211,7 +1608,7 @@ export class FireblocksSDK { const basePath = `/v1/connections`; switch (type) { - case(Web3ConnectionType.WALLET_CONNECT): { + case (Web3ConnectionType.WALLET_CONNECT): { return `${basePath}/wc`; } default: { @@ -1236,17 +1633,18 @@ export class FireblocksSDK { pageSize, sort, filter, - order - }: GetWeb3ConnectionsPayload = {}): Promise> { + order, + + }: GetWeb3ConnectionsPayload = {}, requestOptions?: RequestOptions): Promise> { const params = new URLSearchParams({ ...(pageCursor && { next: pageCursor }), ...(pageSize && { pageSize: pageSize.toString() }), ...(sort && { sort }), - ...(filter && { filter: stringify(filter, { delimiter: "," })}), + ...(filter && { filter: stringify(filter, { delimiter: "," }) }), ...(order && { order }), }); - return await this.apiClient.issueGetRequest(`/v1/connections?${params.toString()}`); + return await this.apiClient.issueGetRequest(`/v1/connections?${params.toString()}`, undefined, requestOptions); } /** @@ -1281,11 +1679,11 @@ export class FireblocksSDK { * @param sessionId The ID of the session * @param approve Whether you approve the connection or not */ - public async submitWeb3Connection(type: Web3ConnectionType.WALLET_CONNECT, sessionId: string, approve: boolean): Promise; - public async submitWeb3Connection(type: Web3ConnectionType, sessionId: string, approve: boolean): Promise { + public async submitWeb3Connection(type: Web3ConnectionType.WALLET_CONNECT, sessionId: string, approve: boolean, requestOptions?: RequestOptions): Promise; + public async submitWeb3Connection(type: Web3ConnectionType, sessionId: string, approve: boolean, requestOptions?: RequestOptions): Promise { const path = this.getWeb3ConnectionPath(type); - return await this.apiClient.issuePutRequest(`${path}/${sessionId}`, {approve}); + return await this.apiClient.issuePutRequest(`${path}/${sessionId}`, { approve }, requestOptions); } /** @@ -1293,23 +1691,38 @@ export class FireblocksSDK { * @param type The type of the connection * @param sessionId The ID of the session */ - public async removeWeb3Connection(type: Web3ConnectionType.WALLET_CONNECT, sessionId: string): Promise; - public async removeWeb3Connection(type: Web3ConnectionType, sessionId: string): Promise { + public async removeWeb3Connection(type: Web3ConnectionType.WALLET_CONNECT, sessionId: string, requestOptions?: RequestOptions): Promise; + public async removeWeb3Connection(type: Web3ConnectionType, sessionId: string, requestOptions?: RequestOptions): Promise { const path = this.getWeb3ConnectionPath(type); - return await this.apiClient.issueDeleteRequest(`${path}/${sessionId}`); + return await this.apiClient.issueDeleteRequest(`${path}/${sessionId}`, requestOptions); } /** * Gets all audits for selected time period * @param timePeriod + * @param cursor */ public async getAudits(timePeriod?: TimePeriod): Promise { - let url = `/v1/audits`; - if (timePeriod) { - url += `?timePeriod=${timePeriod}`; - } - return await this.apiClient.issueGetRequest(url); + const queryParams = { + timePeriod, + }; + + return await this.apiClient.issueGetRequest(`/v1/audits?${queryString.stringify(queryParams)}`); + } + + /** + * Gets paginated audit logs for selected time period + * @param timePeriod + * @param cursor + */ + public async getPaginatedAuditLogs(timePeriod?: TimePeriod, cursor?: string): Promise { + const queryParams = { + timePeriod, + cursor, + }; + + return await this.apiClient.issueGetRequest(`/v1/management/audit_logs?${queryString.stringify(queryParams)}`); } /** @@ -1321,15 +1734,14 @@ export class FireblocksSDK { } /** - * - * @param filter.pageCursor - * @param filter.pageSize - * @param filter.ids - * @param filter.sort - * @param filter.order - */ - public async getNFTs(filter: GetNFTsFilter): Promise> { - const { pageCursor, pageSize, ids, sort, order } = filter; + * @param {Object} payload + * @param payload.pageCursor + * @param payload.pageSize + * @param payload.ids + * @param payload.sort + * @param payload.order + */ + public async getNFTs({ pageCursor, pageSize, ids, sort, order }: GetNFTsFilter): Promise> { const queryParams = { pageCursor, pageSize, @@ -1354,11 +1766,15 @@ export class FireblocksSDK { * @param filter.order Order value * @param filter.status Status (LISTED, ARCHIVED) * @param filter.search Search filter + * @param filter.ncwAccountIds List of Non-Custodial wallet account IDs + * @param filter.ncwId Non-Custodial wallet id + * @param filter.walletType Wallet type (VAULT_ACCOUNT, END_USER_WALLET) + * @param filter.spam Spam filter (true, false, all) */ public async getOwnedNFTs(filter?: NFTOwnershipFilter): Promise> { let url = "/v1/nfts/ownership/tokens"; if (filter) { - const { blockchainDescriptor, vaultAccountIds, collectionIds, ids, pageCursor, pageSize, sort, order, status, search } = filter; + const { blockchainDescriptor, vaultAccountIds, collectionIds, ids, pageCursor, pageSize, sort, order, status, search, ncwId, ncwAccountIds, walletType, spam } = filter; const requestFilter = { vaultAccountIds: this.getCommaSeparatedList(vaultAccountIds), blockchainDescriptor, @@ -1370,6 +1786,10 @@ export class FireblocksSDK { order, status, search, + ncwId, + ncwAccountIds, + walletType, + spam, }; url += `?${queryString.stringify(requestFilter)}`; } @@ -1378,7 +1798,11 @@ export class FireblocksSDK { /** * + * Get a list of owned NFT collections * @param filter.search Search by value + * @param filter.status Status (LISTED, ARCHIVED) + * @param filter.ncwId Non-Custodial wallet id + * @param filter.walletType Wallet type (VAULT_ACCOUNT, END_USER_WALLET) * @param filter.pageCursor Page cursor * @param filter.pageSize Page size * @param filter.sort Sort by value @@ -1387,14 +1811,52 @@ export class FireblocksSDK { public async listOwnedCollections(filter?: NFTOwnedCollectionsFilter): Promise> { let url = "/v1/nfts/ownership/collections"; if (filter) { - const { search, pageCursor, pageSize, sort, order } = filter; + const { search, status, ncwId, walletType, pageCursor, pageSize, sort, order } = filter; + + const requestFilter = { + search, + status, + ncwId, + walletType, + pageCursor, + pageSize, + sort: this.getCommaSeparatedList(sort), + order, + }; + url += `?${queryString.stringify(requestFilter)}`; + } + + return await this.apiClient.issueGetRequest(url); + } + + /** + * + * Get a list of owned tokens + * @param filter.search Search by value + * @param filter.status Status (LISTED, ARCHIVED) + * @param filter.ncwId Non-Custodial wallet id + * @param filter.walletType Wallet type (VAULT_ACCOUNT, END_USER_WALLET) + * @param filter.pageCursor Page cursor + * @param filter.pageSize Page size + * @param filter.sort Sort by value + * @param filter.order Order by value + * @param filter.spam Spam filter (true, false, all) + */ + public async listOwnedAssets(filter?: NFTOwnedAssetsFilter): Promise> { + let url = "/v1/nfts/ownership/assets"; + if (filter) { + const { search, status, ncwId, walletType, pageCursor, pageSize, sort, order, spam } = filter; const requestFilter = { search, + status, + ncwId, + walletType, pageCursor, pageSize, sort: this.getCommaSeparatedList(sort), order, + spam, }; url += `?${queryString.stringify(requestFilter)}`; } @@ -1420,6 +1882,15 @@ export class FireblocksSDK { return await this.apiClient.issuePutRequest(`/v1/nfts/ownership/tokens/${id}/status`, { status }); } + /** + * + * Updates tokens status for a tenant, in all tenant vaults. + * @param payload List of assets with status for update + */ + public async updateNFTOwnershipsStatus(payload: NFTOwnershipStatusUpdatedPayload[]): Promise { + return await this.apiClient.issuePutRequest(`/v1/nfts/ownership/tokens/status`, payload); + } + /** * * @param vaultAccountId @@ -1432,68 +1903,387 @@ export class FireblocksSDK { } /** - * Get all tokens linked to the tenant - * @param limit - * @param offset + * + * @param payload.assetId NFT asset id + * @param payload.spam Spam status */ - public async getLinkedTokens(limit: number = 100, offset: number = 0): Promise { - const requestFilter = { - limit, - offset - }; - const url = `/v1/tokenization/tokens?${queryString.stringify(requestFilter)}`; - return await this.apiClient.issueGetRequest(url); + public async updateNFTTokenOwnershipSpamStatus(payload: TokenOwnershipSpamUpdatePayload[]): Promise { + return await this.apiClient.issuePutRequest(`/v1/nfts/ownership/tokens/spam`, payload); } + /** + * Get all contract templates + * @param {Object} payload The payload for getting the current tenant's sessions + * @param {ContractInitializationPhase} payload.initializationPhase The contract initialization phase + * @param {ContractTemplateType} payload.type The type of the contract templates you wish to retrieve. May contain more than one type + * @param {number} payload.pageSize The amount of results to return on the next page + * @param {string} payload.pageCursor The cursor for the next page + * + * @returns {LeanContractTemplateDto[]} A paginated array of contract templates + */ + public async getContractTemplates({ + initializationPhase, + type, + pageSize = DEFAULT_MAX_PAGE_SIZE, + pageCursor + }: GetContractTemplatesFilter = {}): Promise> { + return await this.apiClient.issueGetRequest(`/v1/tokenization/templates`, { + initializationPhase, + type, + pageSize, + pageCursor + }); + } /** - * Issue a new token and link it to the tenant - * @param request + * Upload a new contract. This contract would be private and only your tenant can see it + * @param payload + * + * @returns {ContractTemplateDto} */ - public async issueNewToken(request: IssueTokenRequest): Promise { - return await this.apiClient.issuePostRequest(`/v1/tokenization/tokens/`, request); + public async uploadContractTemplate(payload: ContractUploadRequest): Promise { + return await this.apiClient.issuePostRequest(`/v1/tokenization/templates`, payload); } /** - * Get a token linked to the tenant by asset id - * @param assetId + * Get contract template by id + * @param templateId + * + * @returns {ContractTemplateDto} */ - public async getLinkedToken(assetId: string): Promise { - return await this.apiClient.issueGetRequest(`/v1/tokenization/tokens/${assetId}`); + public async getContractTemplate(templateId: string): Promise { + return await this.apiClient.issueGetRequest(`/v1/tokenization/templates/${templateId}`); } /** - * Link a token to the tenant - * @param assetId + * Delete a contract template by id + * @param templateId */ - public async linkToken(assetId: string): Promise { - return await this.apiClient.issuePutRequest(`/v1/tokenization/tokens/${assetId}/link`, { }); + public async deleteContractTemplate(templateId: string): Promise { + return await this.apiClient.issueDeleteRequest(`/v1/tokenization/templates/${templateId}`); } /** - * remove a link to a token from the tenant - * @param assetId + * Get contract template deploy function by id + * @param templateId + * @param withDocs + * + * @returns {AbiFunction} */ - public async unlinkToken(assetId: string): Promise { - return await this.apiClient.issueDeleteRequest(`/v1/tokenization/tokens/${assetId}`); + public async getContractTemplateDeployFunction(templateId: string, withDocs: boolean = false): Promise { + return await this.apiClient.issueGetRequest(`/v1/tokenization/templates/${templateId}/deploy_function?withDocs=${withDocs}`); } /** - * Add permissions to a linked token - * @param assetId - * @param permissions + * Deploy a new contract by contract template id + * @param templateId + * + * @returns {ContractDeployResponse} */ - public async addLinkedTokenPermissions(assetId: string, permissions: TokenLinkPermissionEntry[]): Promise { - return await this.apiClient.issuePutRequest(`/v1/tokenization/tokens/${assetId}/permissions`, { permissions }); + public async deployContract(templateId: string, payload: ContractDeployRequest): Promise { + return await this.apiClient.issuePostRequest(`/v1/tokenization/templates/${templateId}/deploy`, payload); } /** - * Remove permissions from a linked token - * @param assetId - * @param permission + * Get supported blockchains by template id + * @param templateId + * + * @returns {SupportedBlockchainsResponse} */ - public async removeLinkedTokenPermissions(assetId: string, permission: TokenLinkPermissionEntry): Promise { - return await this.apiClient.issueDeleteRequest(`/v1/tokenization/tokens/${assetId}/permissions?permission=${permission.permission}&vaultAccountId=${permission.vaultAccountId}`); + public async getSupportedBlockchains(templateId: string): Promise { + return await this.apiClient.issueGetRequest(`/v1/tokenization/templates/${templateId}/supported_blockchains`); + } + + /** + * Get all contracts by blockchain and template + * @param blockchainId + * @param contractTemplateId + * + * @returns {LeanDeployedContractResponseDto[]} + */ + public async getContractsByFilter({ contractTemplateId, baseAssetId, contractAddress, pageSize = DEFAULT_MAX_PAGE_SIZE, pageCursor }: GetContractsFilter = {}): Promise> { + return await this.apiClient.issueGetRequest(`/v1/tokenization/contracts`, { + contractTemplateId, + baseAssetId, + contractAddress, + pageSize, + pageCursor, + }); + } + + /** + * Get contract ABI function by contractId + * @param contractId + * @param functionSignature + * + * @returns {AbiFunction} + */ + public async getContractAbiFunction(contractId: string, functionSignature: string): Promise { + return await this.apiClient.issueGetRequest(`/v1/contract-service/contract/${contractId}/function`, { + functionSignature + }); + } + + /** + * Get contract's address by blockchain base assetId and the transaction hash + * @param baseAssetId + * @param txHash + * + * @returns {ContractAddressResponseDto} + */ + public async getContractAddress(baseAssetId: string, txHash: string): Promise { + return await this.apiClient.issueGetRequest(`/v1/contract_interactions/base_asset_id/${baseAssetId}/tx_hash/${txHash}`); + } + /** + * Get contract by blockchain base assetId and contract address + * @param baseAssetId + * @param templateId + * + * @returns {DeployedContractResponseDto} + */ + public async getContractByAddress(baseAssetId: string, contractAddress: string): Promise { + return await this.apiClient.issueGetRequest(`/v1/contract_interactions/base_asset_id/${baseAssetId}/contract_address/${contractAddress}`); + } + + /** + * Get contract's ABI by blockchain base assetId and contract address + * @param baseAssetId + * @param contractAddress + * + * @returns {ContractAbiResponseDto} + */ + public async getContractAbi(baseAssetId: string, contractAddress: string): Promise { + return await this.apiClient.issueGetRequest(`/v1/contract_interactions/base_asset_id/${baseAssetId}/contract_address/${contractAddress}/functions`); + } + + /** + * Fetch the ABI. If not found fetch the ABI from the block explorer + * @param baseAssetId + * @param contractAddress + * + * @returns {ContractWithABIDto} + */ + public async fetchOrScrapeABI(baseAssetId: string, contractAddress: string): Promise { + return await this.apiClient.issuePostRequest(`/v1/tokenization/contracts/fetch_abi`, { + baseAssetId, + contractAddress + }); + } + + /** + * Save contract ABI for the tenant + * @param baseAssetId + * @param contractAddress + * @param abi + * @param name + * + * @returns {ContractWithABIDto} + */ + public async saveABI(baseAssetId: string, contractAddress: string, abi: AbiFunction[], name?: string): Promise { + return await this.apiClient.issuePostRequest(`/v1/tokenization/contracts/abi`, { + baseAssetId, + contractAddress, + abi, + name + }); + } + + /** + * Get transaction receipt by blockchain base assetId and transaction hash + * @param baseAssetId + * @param txHash + * + * @returns TransactionReceiptResponseDto + */ + public async getTransactionReceipt(baseAssetId: string, txHash: string): Promise { + return await this.apiClient.issueGetRequest(`/v1/contract_interactions/base_asset_id/${baseAssetId}/tx_hash/${txHash}/receipt`); + } + + /** + * Call contract read function by blockchain base assetId and contract address + * @param baseAssetId + * @param templateId + * + * @returns ParameterWithValueList + */ + public async readContractCallFunction(baseAssetId: string, contractAddress: string, payload: ReadCallFunctionDto): Promise { + return await this.apiClient.issuePostRequest(`/v1/contract_interactions/base_asset_id/${baseAssetId}/contract_address/${contractAddress}/functions/read`, payload); + } + + /** + * Call contract write function by blockchain base assetId and contract address + * @param baseAssetId + * @param templateId + * + * @returns WriteCallFunctionResponseDto + */ + public async writeContractCallFunction(baseAssetId: string, contractAddress: string, payload: WriteCallFunctionDto): Promise { + return await this.apiClient.issuePostRequest(`/v1/contract_interactions/base_asset_id/${baseAssetId}/contract_address/${contractAddress}/functions/write`, payload); + } + + /** + * Creates a new asset and links it as a token. + * + * @param {IssueTokenRequest} payload - The payload containing information for token issuance. + * + * @returns {TokenLink} Response with created token ID + */ + public async issueNewToken(payload: IssueTokenRequest): Promise { + return await this.apiClient.issuePostRequest(`/v1/tokenization/tokens`, payload); + } + + /** + * Retrieves all linked tokens in a paginated format. + * + * @param {Object} payload + * @param {TokenLinkStatus} payload.status - The status of linked tokens (COMPLETED / PENDING). Default is COMPLETED + * @param {number} payload.pageSize - The number of results to return on the next page + * @param {string} payload.pageCursor - The cursor for the next page + * + * @returns {TokenLink[]} A paginated array of linked tokens + */ + public async getLinkedTokens({ status, pageSize = DEFAULT_MAX_PAGE_SIZE, pageCursor }: GetTokenLinksFilter = {}): Promise> { + return await this.apiClient.issueGetRequest(`/v1/tokenization/tokens`, { + status, + pageSize, + pageCursor, + }); + } + + /** + * Get the total count of linked tokens + * @returns TokenLinksCount + */ + public async getLinkedTokensCount(): Promise { + return await this.apiClient.issueGetRequest(`/v1/tokenization/tokens/count`); + } + + /** + * Link a token by refId to the tenant + * @param type + * @param refId + * @param displayName + * + * @returns TokenLink + */ + public async linkToken(type: SupportedContractTemplateType, refId: string, displayName?: string): Promise { + return await this.apiClient.issuePostRequest(`/v1/tokenization/tokens/link`, { type, refId, displayName }); + } + + /** + * Link a token by baseAssetId and contract address to the tenant + * @param type + * @param baseAssetId + * @param contractAddress + * @param displayName + * + * @returns TokenLink + */ + public async linkContractByAddress(type: SupportedContractTemplateType, baseAssetId: string, contractAddress: string, displayName?: string): Promise { + return await this.apiClient.issuePostRequest(`/v1/tokenization/tokens/link`, { type, baseAssetId, contractAddress, displayName }); + } + + /** + * Get a linked token + * @param id + * + * @returns TokenLink + */ + public async getLinkedToken(id: string): Promise { + return await this.apiClient.issueGetRequest(`/v1/tokenization/tokens/${id}`); + } + + /** + * Delete a token link + * @param id + */ + public async unlinkToken(id: string): Promise { + await this.apiClient.issueDeleteRequest(`/v1/tokenization/tokens/${id}`); + } + + /** + * Retrieves all pending linked tokens in a paginated format + * + * @param {Object} payload - The payload for retrieving pending linked tokens + * @param {number} payload.pageSize - The number of results to return on the next page + * @param {string} payload.pageCursor - The cursor for the next page + * + * @returns {TokenLink[]} A paginated array of pending linked tokens + */ + public async getPendingLinkedTokens({ pageSize, pageCursor }: GetTokenLinksFilter = {}): Promise> { + return await this.getLinkedTokens({ status: TokenLinkStatus.PENDING, pageSize, pageCursor }); + } + + /** + * Creates a new collection and links it + * + * @param {CreateCollectionRequest} payload - The payload containing information for collection creation + * + * @returns {CollectionLink} Response with created collection link ID + */ + public async createNewCollection(payload: CreateCollectionRequest): Promise { + return await this.apiClient.issuePostRequest(`/v1/tokenization/collections`, payload); + } + + /** + * Retrieves all linked collections in a paginated format. + * + * @param {Object} payload + * @param {TokenLinkStatus} payload.status - The status of linked collections (COMPLETED / PENDING). Default is COMPLETED + * @param {number} payload.pageSize - The number of results to return on the next page + * @param {string} payload.pageCursor - The cursor for the next page + * + * @returns {CollectionLink[]} A paginated array of linked collections + */ + public async getLinkedCollections({ status, pageSize = DEFAULT_MAX_PAGE_SIZE, pageCursor }: GetTokenLinksFilter = {}): Promise> { + return await this.apiClient.issueGetRequest("/v1/tokenization/collections", { + status, + pageSize, + pageCursor, + }); + } + + /** + * Get a linked collection + * + * @returns CollectionLink + */ + public async getLinkedCollection(id: string): Promise { + return await this.apiClient.issueGetRequest(`/v1/tokenization/collections/${id}`); + } + + /** + * Unlink a collection + */ + public async unlinkCollection(id: string): Promise { + await this.apiClient.issueDeleteRequest(`/v1/tokenization/collections/${id}`); + } + + /** + * Mint collection NFT + * + * @returns WriteCallFunctionResponseDto + */ + public async mintNFT(collectionId: string, payload: MintCollectionTokenRequest): Promise { + return await this.apiClient.issuePostRequest(`/v1/tokenization/collections/${collectionId}/tokens/mint`, payload); + } + + /** + * Burn collection NFT + * + * @returns WriteCallFunctionResponseDto + */ + public async burnNFT(collectionId: string, payload: BurnCollectionTokenRequest): Promise { + return await this.apiClient.issuePostRequest(`/v1/tokenization/collections/${collectionId}/tokens/burn`, payload); + } + + /** + * Get collection token details + * + * @returns CollectionTokenResponseDto + */ + public async getLinkedCollectionTokenDetails(collectionId: string, tokenId: string): Promise { + return await this.apiClient.issueGetRequest(`/v1/tokenization/collections/${collectionId}/tokens/${tokenId}`); } /** @@ -1549,6 +2339,75 @@ export class FireblocksSDK { return await this.apiClient.issuePutRequest(`/v1/screening/travel-rule/vasp/update`, vaspInfo); } + /** + * Get assigned VASP Did for a specific vault. Returns empty string vaspDid value in response if none assigned. + */ + public async getVaspForVault(vaultAccountId: number): Promise { + return await this.apiClient.issueGetRequest(`/v1/screening/travel_rule/vault/${vaultAccountId.toString()}/vasp`); + } + + /** + * Sets the VASP Did for a specific vault. Pass empty string to remove existing one. + */ + public async setVaspForVault(vaultAccountId: number, vaspDid: string): Promise { + return await this.apiClient.issuePostRequest(`/v1/screening/travel_rule/vault/${vaultAccountId.toString()}/vasp`, { + vaspDid + }); + } + + /** + * Get PostScreening Policies for compliance + * @param screeningType The type of screening (e.g., 'travel_rule', 'aml') + */ + public async getPostScreeningPolicy(screeningType: ScreeningType): Promise { + const endpoint = `/v1/screening/${screeningType}/post_screening_policy`; + return await this.apiClient.issueGetRequest(endpoint); + } + + /** + * Get Screening Policies for compliance + * @param screeningType The type of screening (e.g., 'travel_rule', 'aml') + */ + public async getScreeningPolicy(screeningType: ScreeningType): Promise { + const endpoint = `/v1/screening/${screeningType}/screening_policy`; + return await this.apiClient.issueGetRequest(endpoint); + } + + /** + * Get Screening Configuration for compliance + * @param screeningType The type of screening (e.g., 'travel_rule', 'aml') + */ + public async getScreeningConfiguration(screeningType: ScreeningType): Promise { + const endpoint = `/v1/screening/${screeningType}/policy_configuration`; + return await this.apiClient.issueGetRequest(endpoint); + } + + /** + * Update Bypass Screening Configuration for compliance + * @param screeningType The type of screening (e.g., 'travel_rule', 'aml') + * @param screeningPolicyConfiguration The configuration to update + */ + public async updatePolicyConfiguration(screeningType: ScreeningType, screeningPolicyConfiguration: ScreeningPolicyConfiguration): Promise { + const endpoint = `/v1/screening/${screeningType}/policy_configuration`; + return await this.apiClient.issuePutRequest(endpoint, screeningPolicyConfiguration); + } + + /** + * Update Bypass Screening Tenant Configuration for AML/KYT compliance + * @param screeningTenantConfiguration + */ + public async updateTenantScreeningConfiguration(screeningTenantConfiguration: ScreeningTenantConfiguration): Promise { + return await this.apiClient.issuePutRequest(`/v1/screening/config`, screeningTenantConfiguration); + } + + /** + * Get supported assets for screening per provider + * @param provider The provider to get supported assets for + */ + public async getSupportedAssetsForScreening(provider: ScreeningSupportedProviders): Promise { + return await this.apiClient.issueGetRequest(`/v1/screening/supported_assets/${provider}`); + } + /** * Creates Smart Transfers ticket * @param data @@ -1580,7 +2439,7 @@ export class FireblocksSDK { * @param expiresIn */ public setSmartTransferTicketExpiresIn(ticketId: string, expiresIn: number): Promise { - return this.apiClient.issuePutRequest(`/v1/smart-transfers/${ticketId}/expires-in`, {expiresIn}); + return this.apiClient.issuePutRequest(`/v1/smart-transfers/${ticketId}/expires-in`, { expiresIn }); } /** @@ -1589,7 +2448,7 @@ export class FireblocksSDK { * @param externalRefId */ public setSmartTransferTicketExternalId(ticketId: string, externalRefId: string): Promise { - return this.apiClient.issuePutRequest(`/v1/smart-transfers/${ticketId}/external-id`, {externalRefId}); + return this.apiClient.issuePutRequest(`/v1/smart-transfers/${ticketId}/external-id`, { externalRefId }); } /** @@ -1598,7 +2457,7 @@ export class FireblocksSDK { * @param expiresIn */ public submitSmartTransferTicket(ticketId: string, expiresIn: number): Promise { - return this.apiClient.issuePutRequest(`/v1/smart-transfers/${ticketId}/submit`, {expiresIn}); + return this.apiClient.issuePutRequest(`/v1/smart-transfers/${ticketId}/submit`, { expiresIn }); } /** @@ -1665,6 +2524,21 @@ export class FireblocksSDK { return this.apiClient.issuePutRequest(`/v1/smart-transfers/${ticketId}/terms/${termId}/manually-fund`, { txHash }); } + /** + * Set Smart Transfers user group ids. User group ids are used for Smart Transfer notifications + * @param userGroupIds + */ + public setSmartTransferTicketUserGroups(userGroupIds: string[]): Promise { + return this.apiClient.issuePostRequest(`/v1/smart-transfers/settings/user-groups`, { userGroupIds }); + } + + /** + * Get Smart Transfers user group ids. User group ids are used for Smart Transfer notifications + */ + public getSmartTransferTicketUserGroups(): Promise { + return this.apiClient.issueGetRequest(`/v1/smart-transfers/settings/user-groups`); + } + /** * Delete Smart Transfers ticket term * @param ticketId @@ -1674,7 +2548,130 @@ export class FireblocksSDK { return this.apiClient.issueDeleteRequest(`/v1/smart-transfers/${ticketId}/terms/${termId}`); } + /** + * Get active policy (TAP) [BETA] + */ + public async getActivePolicy(): Promise { + return await this.apiClient.issueGetRequest(`/v1/tap/active_policy`); + } + + /** + * Get draft policy (TAP) [BETA] + */ + public async getDraft(): Promise { + return await this.apiClient.issueGetRequest(`/v1/tap/draft`); + } + + /** + * Update draft policy (TAP) [BETA] + * @param rules + */ + public async updateDraft(rules: TAP.PolicyRule[]): Promise { + return await this.apiClient.issuePutRequest(`/v1/tap/draft`, { rules }); + } + + /** + * Publish draft policy (TAP) [BETA] + * @param draftId + */ + public async publishDraft(draftId: string): Promise { + return await this.apiClient.issuePostRequest(`/v1/tap/draft`, { draftId }); + } + + /** + * Publish rules (TAP) [BETA] + * @param rules + */ + public async publishPolicyRules(rules: TAP.PolicyRule[]): Promise { + return await this.apiClient.issuePostRequest(`/v1/tap/publish`, { rules }); + } + private getCommaSeparatedList(items: Array): string | undefined { return items ? items.join(",") : undefined; } + + /** + * Get list of jobs for current tenant + * @param fromTime beggining of time range in Unix Epoch + * @param toTime ending of time range in Unix Epoch + */ + public getJobsForTenant(fromTime: number, toTime: number): Promise { + return this.apiClient.issueGetRequest(`/v1/batch/jobs?fromTime=${fromTime}&toTime=${toTime}`); + } + + /** + * Get job info by job ID + * @param jobId + */ + public getJobById(jobId: string): Promise { + return this.apiClient.issueGetRequest(`/v1/batch/${jobId}`); + } + + /** + * Get tasks belonging to given job + * @param jobId + */ + public getTasksByJobId(jobId: string): Promise { + return this.apiClient.issueGetRequest(`/v1/batch/${jobId}/tasks`); + } + + /** + * Cancel a job by ID + * @param jobId + */ + public cancelJob(jobId: string): Promise { + return this.apiClient.issuePostRequest(`/v1/batch/${jobId}/cancel`, {}); + } + + /** + * Pause a job by ID + * @param jobId + */ + public pauseJob(jobId: string): Promise { + return this.apiClient.issuePostRequest(`/v1/batch/${jobId}/pause`, {}); + } + + /** + * Continue a job by ID + * @param jobId + */ + public continueJob(jobId: string): Promise { + return this.apiClient.issuePostRequest(`/v1/batch/${jobId}/continue`, {}); + } + + /** + * Create multiple vault accounts in one bulk operation + * @param count number of vault accounts + * @param assetId optional asset id to create in each new account + * @param requestOptions + */ + public createVaultAccountsBulk(count: number, assetId: string, requestOptions?: RequestOptions): Promise { + const body = { + count, + assetId + }; + return this.apiClient.issuePostRequest(`/v1/vault/accounts/bulk`, body, requestOptions); + } + + /** + * Creates a new asset within a list of existing vault accounts + * @param assetId The asset to add + * @param vaultAccountIdFrom The first of the account ID range + * @param vaultAccountIdTo The last of the account ID range + * @param requestOptions + */ + public createVaultAssetsBulk(assetId: string, vaultAccountIdFrom: string, vaultAccountIdTo: string, requestOptions?: RequestOptions): Promise { + const body = { + assetId, vaultAccountIdFrom, vaultAccountIdTo + }; + return this.apiClient.issuePostRequest(`/v1/vault/assets/bulk`, body, requestOptions); + } + + /** + * Rescan transactions base on assetId and txHash + * @param rescanTxs An array of RescanTx + */ + public rescanTransactionsBeta(rescanTxs: RescanTx[]): Promise { + return this.apiClient.issuePostRequest(`/v1/transactions/rescan`, rescanTxs); + } } diff --git a/src/ncw-api-client.ts b/src/ncw-api-client.ts new file mode 100644 index 00000000..2d70fbc2 --- /dev/null +++ b/src/ncw-api-client.ts @@ -0,0 +1,195 @@ +import { ApiClient } from "./api-client"; +import { + AssetResponse, + Web3PagedResponse, + NCW, + UnspentInputsResponse, + SigningAlgorithm, + PublicKeyInfoArgs, + PublicKeyInformation, + PublicKeyResponse, + PublicKeyInfoByAccountAssetArgs, + PeerType, +} from "./types"; +import { NcwSdk } from "./ncw-sdk"; +import { getPublicKeyInfoByAccountAssetImpl, getPublicKeyInfoImpl } from "./common/public_key_info"; + +export class NcwApiClient implements NcwSdk { + private readonly NCW_BASE_PATH = "/v1/ncw/wallets"; + + constructor(private readonly apiClient: ApiClient) { } + + public async getSupportedAssets({ pageCursor, pageSize, onlyBaseAssets }: NCW.GetSupportedAssetsPayload): Promise> { + const params = new URLSearchParams({ + ...(pageCursor && { pageCursor }), + ...(pageSize && { pageSize: pageSize.toString() }), + ...(onlyBaseAssets !== undefined && { onlyBaseAssets: String(onlyBaseAssets) }), + }); + + return await this.apiClient.issueGetRequest(`${this.NCW_BASE_PATH}/supported_assets?${params.toString()}`); + } + + public async createWallet(): Promise<{ walletId: string; enabled: boolean; }> { + return await this.apiClient.issuePostRequest( + `${this.NCW_BASE_PATH}`, + {}); + } + + public async getWallet(walletId: string): Promise<{ walletId: string; enabled: boolean; }> { + return await this.apiClient.issueGetRequest( + `${this.NCW_BASE_PATH}/${walletId}`); + } + + public async getLatestBackup(walletId: string): Promise { + return await this.apiClient.issueGetRequest( + `${this.NCW_BASE_PATH}/${walletId}/backup/latest`); + } + + public async enableWallet(walletId: string, enabled: boolean): Promise { + return await this.apiClient.issuePutRequest( + `${this.NCW_BASE_PATH}/${walletId}/enable`, + { enabled }); + } + + public async getWalletDevice(walletId: string, deviceId: string): Promise { + return await this.apiClient.issueGetRequest( + `${this.NCW_BASE_PATH}/${walletId}/devices/${deviceId}`); + } + + public async getWalletDevices(walletId: string): Promise { + return await this.apiClient.issueGetRequest( + `${this.NCW_BASE_PATH}/${walletId}/devices/`); + } + + public async enableWalletDevice(walletId: string, deviceId: string, enabled: boolean): Promise { + return await this.apiClient.issuePutRequest( + `${this.NCW_BASE_PATH}/${walletId}/devices/${deviceId}/enable`, + { enabled }); + } + + public async invokeWalletRpc(walletId: string, deviceId: string, payload: string): Promise<{ result: string; } | { error: { message: string; code?: number; }; }> { + return await this.apiClient.issuePostRequest( + `${this.NCW_BASE_PATH}/${walletId}/devices/${deviceId}/invoke`, + { payload }); + } + + public async createWalletAccount(walletId: string): Promise<{ + walletId: string; + accountId: number; + }> { + return await this.apiClient.issuePostRequest( + `${this.NCW_BASE_PATH}/${walletId}/accounts`, + {}); + } + + public async getWallets({ pageCursor, pageSize, sort, order }: NCW.GetWalletsPayload = {}): Promise> { + const params = new URLSearchParams({ + ...(pageCursor && { pageCursor }), + ...(pageSize && { pageSize: pageSize.toString() }), + ...(sort && { sort }), + ...(order && { order }), + }); + + return await this.apiClient.issueGetRequest(`${this.NCW_BASE_PATH}?${params.toString()}`); + } + + public async getWalletAccounts(walletId: string, { pageCursor, pageSize, sort, order }: NCW.GetWalletsPayload = {}): Promise> { + const params = new URLSearchParams({ + ...(pageCursor && { pageCursor }), + ...(pageSize && { pageSize: pageSize.toString() }), + ...(sort && { sort }), + ...(order && { order }), + }); + + return await this.apiClient.issueGetRequest( + `${this.NCW_BASE_PATH}/${walletId}/accounts?${params.toString()}`); + } + + public async getWalletAccount(walletId: string, accountId: number): Promise<{ + walletId: string; + accountId: number; + }> { + return await this.apiClient.issueGetRequest( + `${this.NCW_BASE_PATH}/${walletId}/accounts/${accountId}`); + } + + public async getWalletAssets(walletId: string, accountId: number, { pageCursor, pageSize, sort, order }: NCW.GetWalletAssetsPayload = {}): Promise> { + const params = new URLSearchParams({ + ...(pageCursor && { pageCursor }), + ...(pageSize && { pageSize: pageSize.toString() }), + ...(sort && { sort }), + ...(order && { order }), + }); + + return await this.apiClient.issueGetRequest( + `${this.NCW_BASE_PATH}/${walletId}/accounts/${accountId}/assets?${params.toString()}`); + } + + public async getWalletAsset(walletId: string, accountId: number, assetId: string): Promise { + return await this.apiClient.issueGetRequest( + `${this.NCW_BASE_PATH}/${walletId}/accounts/${accountId}/assets/${assetId}`); + } + + public async activateWalletAsset(walletId: string, accountId: number, assetId: string): Promise { + return await this.apiClient.issuePostRequest( + `${this.NCW_BASE_PATH}/${walletId}/accounts/${accountId}/assets/${assetId}`, {}); + } + + public async getWalletAssetAddresses(walletId: string, accountId: number, assetId: string, { pageCursor, pageSize, sort, order }: NCW.GetWalletAddressesPayload = {}): Promise> { + const params = new URLSearchParams({ + ...(pageCursor && { pageCursor }), + ...(pageSize && { pageSize: pageSize.toString() }), + ...(sort && { sort }), + ...(order && { order }), + }); + + return await this.apiClient.issueGetRequest( + `${this.NCW_BASE_PATH}/${walletId}/accounts/${accountId}/assets/${assetId}/addresses?${params.toString()}`); + } + + public async getWalletAssetBalance(walletId: string, accountId: number, assetId: string): Promise { + return await this.apiClient.issueGetRequest( + `${this.NCW_BASE_PATH}/${walletId}/accounts/${accountId}/assets/${assetId}/balance`); + } + + public async refreshWalletAssetBalance(walletId: string, accountId: number, assetId: string): Promise { + return await this.apiClient.issuePutRequest( + `${this.NCW_BASE_PATH}/${walletId}/accounts/${accountId}/assets/${assetId}/balance`, + {}); + } + + public async getWalletSetupStatus(walletId: string): Promise { + return await this.apiClient.issueGetRequest( + `${this.NCW_BASE_PATH}/${walletId}/setup_status`); + } + + public async getDeviceSetupStatus(walletId: string, deviceId: string): Promise { + return await this.apiClient.issueGetRequest( + `${this.NCW_BASE_PATH}/${walletId}/devices/${deviceId}/setup_status`); + } + + public async setWalletRequiredAlgorithms(walletId: string, algorithms: SigningAlgorithm[]): Promise { + return await this.apiClient.issuePatchRequest( + `${this.NCW_BASE_PATH}/${walletId}/required_algorithms`, + { algorithms }); + } + + public async getUnspentInputs(walletId: string, accountId: number, assetId: string): Promise { + return await this.apiClient.issueGetRequest(`/v1/ncw/${walletId}/accounts/${accountId}/${assetId}/unspent_inputs`); + } + + public async getPublicKeyInfo(walletId: string, args: PublicKeyInfoArgs): Promise { + return await getPublicKeyInfoImpl(PeerType.END_USER_WALLET, args, this.apiClient, walletId); + } + + public async getPublicKeyInfoByAccountAsset(walletId: string, args: PublicKeyInfoByAccountAssetArgs): Promise { + return await getPublicKeyInfoByAccountAssetImpl(PeerType.END_USER_WALLET, args, this.apiClient, walletId); + } + + public async deleteSigningAlgorithm(walletId: string, algorithm: SigningAlgorithm): Promise { + return await this.apiClient.issueDeleteRequest(`${this.NCW_BASE_PATH}/${walletId}/remove_signing_algorithm/${algorithm}`); + } +} diff --git a/src/ncw-sdk.ts b/src/ncw-sdk.ts new file mode 100644 index 00000000..21a11536 --- /dev/null +++ b/src/ncw-sdk.ts @@ -0,0 +1,244 @@ +import { + AssetResponse, Web3PagedResponse, NCW, UnspentInputsResponse, + SigningAlgorithm, + PublicKeyInfoArgs, + PublicKeyInformation, + PublicKeyResponse, + PublicKeyInfoByAccountAssetArgs, +} from "./types"; + +export interface NcwSdk { + /** + * Get NCW supported assets + */ + getSupportedAssets({ pageCursor, pageSize, onlyBaseAssets }: NCW.GetSupportedAssetsPayload): Promise>; + + /** + * Create a new NCW wallet + */ + createWallet(): Promise<{ walletId: string; enabled: boolean; }>; + + /** + * Get a NCW wallet + * + * @param {string} walletId + */ + getWallet(walletId: string): Promise<{ walletId: string; enabled: boolean; }>; + + + /** + * Get NCW wallet's latest backup + * + * @param {string} walletId + */ + getLatestBackup(walletId: string): Promise; + + /** + * Enable a NCW wallet + * + * @param {string} walletId + * @param {boolean} enabled + */ + enableWallet(walletId: string, enabled: boolean): Promise; + + + /** + * Get NCW wallet's device + * + * @param {string} walletId + * @param {string} deviceId + * @return {*} {Promise} + */ + getWalletDevice(walletId: string, deviceId: string): Promise; + + /** + * Get NCW wallet's devices + * + * @param {string} walletId + * @return {*} {Promise} + */ + getWalletDevices(walletId: string): Promise; + + /** + * Set NCW wallet device's enabled state + * + * @param {string} walletId + * @param {string} deviceId + * @param {boolean} enabled + * @return {*} {Promise} + */ + enableWalletDevice(walletId: string, deviceId: string, enabled: boolean): Promise; + + /** + * Invoke NCW wallet RPC call + * + * @param {string} walletId + * @param {string} deviceId + * @param {string} payload + * @return {*} {(Promise<{ result: string } | { error: { message: string, code?: number } }>)} + */ + invokeWalletRpc(walletId: string, deviceId: string, payload: string): Promise<{ result: string; } | { error: { message: string; code?: number; }; }>; + + /** + * Create a new NCW wallet account + * + * @param {string} walletId + */ + createWalletAccount(walletId: string): Promise<{ + walletId: string; + accountId: number; + }>; + + /** + * Get NCW wallets + * + * @param {GetWalletsPayload} { pageCursor, pageSize, sort, order } + * @return {*} {Promise>} + */ + getWallets({ pageCursor, pageSize, sort, order }: NCW.GetWalletsPayload): Promise>; + + /** + * Get NCW accounts + * + * @param {string} walletId + * @param {GetWalletsPayload} [{ pageCursor, pageSize, sort, order }] + */ + getWalletAccounts(walletId: string, { pageCursor, pageSize, sort, order }?: NCW.GetWalletsPayload): Promise>; + + /** + * Get a NCW account + * + * @param {string} walletId + * @param {number} accountId + */ + getWalletAccount(walletId: string, accountId: number): Promise<{ + walletId: string; + accountId: number; + }>; + + /** + * Get NCW assets + * + * @param {string} walletId + * @param {number} accountId + * @param {GetWalletAssetsPayload} [{ pageCursor, pageSize, sort, order }] + * @return {*} {Promise>} + */ + getWalletAssets(walletId: string, accountId: number, { pageCursor, pageSize, sort, order }?: NCW.GetWalletAssetsPayload): Promise>; + + /** + * Get a NCW asset + * + * @param {string} walletId + * @param {number} accountId + * @param {string} assetId + * @return {*} {Promise} + */ + getWalletAsset(walletId: string, accountId: number, assetId: string): Promise; + + /** + * Activate a NCW asset + * + * @param {string} walletId + * @param {number} accountId + * @param {string} assetId + * @return {*} {Promise} + */ + activateWalletAsset(walletId: string, accountId: number, assetId: string): Promise; + + /** + * Get a NCW asset addresses + * + * @param {string} walletId + * @param {number} accountId + * @param {string} assetId + * @param {GetWalletAddressesPayload} { pageCursor, pageSize, sort, order } + * @return {*} {Promise>} + */ + getWalletAssetAddresses(walletId: string, accountId: number, assetId: string, { pageCursor, pageSize, sort, order }?: NCW.GetWalletAddressesPayload): Promise>; + + /** + * Get a NCW asset balance + * + * @param {string} walletId + * @param {number} accountId + * @param {string} assetId + * @return {*} {Promise} + */ + getWalletAssetBalance(walletId: string, accountId: number, assetId: string): Promise; + + /** + * refresh a NCW asset balance + * + * @param {string} walletId + * @param {number} accountId + * @param {string} assetId + * @return {*} {Promise} + */ + refreshWalletAssetBalance(walletId: string, accountId: number, assetId: string): Promise; + + /** + * get NCW wallet setup status + * + * @param {string} walletId + * @return {*} {Promise} + */ + getWalletSetupStatus(walletId: string): Promise; + + /** + * get NCW device setup status + * + * @param {string} walletId + * @param {string} deviceId + * @return {*} {Promise} + */ + getDeviceSetupStatus(walletId: string, deviceId: string): Promise; + + /** + * Gets utxo list for an asset + * + * @param {string} walletId + * @param {string} accountId + * @param {string} assetId + * @return {*} {Promise} + */ + getUnspentInputs(walletId: string, accountId: number, assetId: string): Promise; + + /** + * set required algorithms for a wallet + * + * @param {string} walletId + * @param {SigningAlgorithm[]} algorithms + * @return {*} {Promise} + */ + setWalletRequiredAlgorithms(walletId: string, algorithms: SigningAlgorithm[]): Promise; + + /** + * Get the public key information + * @param {string} walletId + * @param {PublicKeyInfoArgs} args + * @return {*} {Promise} + */ + getPublicKeyInfo(walletId: string, args: PublicKeyInfoArgs): Promise; + + /** + * Get the public key information for an NCW account + * @param {string} walletId + * @param {PublicKeyInfoByAccountAssetArgs} args + * @return {*} {Promise} + */ + getPublicKeyInfoByAccountAsset(walletId: string, args: PublicKeyInfoByAccountAssetArgs): Promise; + + /** + * delete signing algorithm for a wallet + * + * @param {string} walletId + * @param {SigningAlgorithm} algorithm + * @return {*} {Promise} + */ + deleteSigningAlgorithm(walletId: string, algorithm: SigningAlgorithm): Promise; + +} diff --git a/src/staking/index.ts b/src/staking/index.ts new file mode 100644 index 00000000..9743a35a --- /dev/null +++ b/src/staking/index.ts @@ -0,0 +1,3 @@ +export * from "./staking-api-client"; +export * from "./staking-sdk"; +export * from "./types"; \ No newline at end of file diff --git a/src/staking/staking-api-client.ts b/src/staking/staking-api-client.ts new file mode 100644 index 00000000..bc64628e --- /dev/null +++ b/src/staking/staking-api-client.ts @@ -0,0 +1,86 @@ +import { + ChainInfo, + CheckTermsOfServiceResponseDto, ClaimRewardsRequestDto, ClaimRewardsResponse, + DelegationSummaryDto, + DelegationSummaryDtoByVault, SplitRequestDto, SplitResponse, + StakeRequestDto, StakeResponse, + StakingChain, + StakingPosition, StakingProvider, + UnstakeRequestDto, UnstakeResponse, WithdrawRequestDto, WithdrawResponse, +} from "./types"; +import { StakingSDK } from "./staking-sdk"; +import { ApiClient } from "../api-client"; + +const STAKING_BASE_PATH = "/v1/staking"; + +export class StakingApiClient implements StakingSDK { + constructor(private readonly apiClient: ApiClient) {} + public async getChains(): Promise { + return await this.apiClient.issueGetRequest(`${STAKING_BASE_PATH}/chains`); + } + public async getChainInfo(chainDescriptor: StakingChain): Promise { + return await this.apiClient.issueGetRequest(`${STAKING_BASE_PATH}/chains/${chainDescriptor}/chainInfo`); + } + public async getPositionsSummary(): Promise { + return await this.apiClient.issueGetRequest(`${STAKING_BASE_PATH}/positions/summary`); + } + public async getPositionsSummaryByVault(): Promise { + return await this.apiClient.issueGetRequest(`${STAKING_BASE_PATH}/positions/summary/vaults`); + } + public async stake( + chainDescriptor: StakingChain, + body: StakeRequestDto, + ): Promise { + return await this.apiClient.issuePostRequest( + `${STAKING_BASE_PATH}/chains/${chainDescriptor}/stake`, + body, + ); + } + public async unstake( + chainDescriptor: StakingChain, + body: UnstakeRequestDto, + ): Promise { + return await this.apiClient.issuePostRequest( + `${STAKING_BASE_PATH}/chains/${chainDescriptor}/unstake`, + body, + ); + } + public async withdraw( + chainDescriptor: StakingChain, + body: WithdrawRequestDto, + ): Promise { + return await this.apiClient.issuePostRequest( + `${STAKING_BASE_PATH}/chains/${chainDescriptor}/withdraw`, + body, + ); + } + public async claimRewards( + chainDescriptor: StakingChain, + body: ClaimRewardsRequestDto, + ): Promise { + return await this.apiClient.issuePostRequest( + `${STAKING_BASE_PATH}/chains/${chainDescriptor}/claimRewards`, + body, + ); + } + public async split(chainDescriptor: StakingChain, body: SplitRequestDto): Promise { + return await this.apiClient.issuePostRequest( + `${STAKING_BASE_PATH}/chains/${chainDescriptor}/split`, + body, + ); + } + public async getPositions(chainDescriptor?: StakingChain): Promise { + const url = `${STAKING_BASE_PATH}/positions${chainDescriptor ? `?chainDescriptor=${chainDescriptor}` : ""}`; + return await this.apiClient.issueGetRequest(url); + } + public async getPosition(positionId: string): Promise { + return await this.apiClient.issueGetRequest(`${STAKING_BASE_PATH}/positions/${positionId}`); + } + public async getProviders(): Promise { + return await this.apiClient.issueGetRequest(`${STAKING_BASE_PATH}/providers`); + } + public async approveProviderTermsOfService(providerId: string): Promise { + return await this.apiClient.issuePostRequest(`${STAKING_BASE_PATH}/providers/${providerId}/approveTermsOfService`, {}); + } +} + diff --git a/src/staking/staking-sdk.ts b/src/staking/staking-sdk.ts new file mode 100644 index 00000000..44b9db65 --- /dev/null +++ b/src/staking/staking-sdk.ts @@ -0,0 +1,81 @@ +import { + ChainInfo, + CheckTermsOfServiceResponseDto, ClaimRewardsRequestDto, ClaimRewardsResponse, + DelegationSummaryDto, + DelegationSummaryDtoByVault, SplitRequestDto, SplitResponse, + StakeRequestDto, + StakeResponse, + StakingChain, + StakingPosition, + StakingProvider, + UnstakeRequestDto, + UnstakeResponse, + WithdrawRequestDto, + WithdrawResponse, +} from "./types"; + +export interface StakingSDK { + /** + * Get all staking chains + */ + getChains(): Promise; + + /** + * Get chain info + */ + getChainInfo(chainDescriptor: StakingChain): Promise; + + /** + * Get staking positions summary + */ + getPositionsSummary(): Promise; + + /** + * Get staking positions summary by vault + */ + getPositionsSummaryByVault(): Promise; + + /** + * Initiate staking stake on a chain + */ + stake(chainDescriptor: StakingChain, body: StakeRequestDto): Promise; + + /** + * Execute staking unstake on a chain + */ + unstake(chainDescriptor: StakingChain, body: UnstakeRequestDto): Promise; + + /** + * Execute staking withdraw on a chain + */ + withdraw(chainDescriptor: StakingChain, body: WithdrawRequestDto): Promise; + + /** + * Execute staking claim rewards on a chain + */ + claimRewards(chainDescriptor: StakingChain, body: ClaimRewardsRequestDto): Promise; + + /** + * Execute staking split on a chain + */ + split(chainDescriptor: StakingChain, body: SplitRequestDto): Promise; + + /** + * Get all staking positions, optionally filtered by chain + */ + getPositions(chainDescriptor?: StakingChain): Promise; + /** + * Get a staking position by id + */ + getPosition(positionId?: string): Promise; + + /** + * Get all staking providers + */ + getProviders(): Promise; + + /** + * Approve staking provider terms of service + */ + approveProviderTermsOfService(providerId: string): Promise; +} diff --git a/src/staking/types.ts b/src/staking/types.ts new file mode 100644 index 00000000..abb77427 --- /dev/null +++ b/src/staking/types.ts @@ -0,0 +1,367 @@ +export enum PositionStatus { + error = "error", + creating = "creating", + failed = "failed", + pending = "pending", + canceled = "canceled", + activating = "activating", + active = "active", + deactivating = "deactivating", + deactivated = "deactivated", + withdrawing = "withdrawing", + withdrawn = "withdrawn", +} + +interface ISolanaBlockchainData { + /** + * The stake account address matching the stakeAccountId + */ + stakeAccountAddress?: string; +} + +// eslint-disable-next-line @typescript-eslint/no-empty-interface +interface IEthereumBlockchainData {} + +export type TBlockchainPositionInfo = ISolanaBlockchainData | IEthereumBlockchainData; + +interface RelatedTransactionDto { + /** + * The transaction ID + */ + txId: string; + + /** + * Is the transaction completed or not + */ + completed: boolean; +} + +export interface StakingPosition { + /** + * The unique identifier of the staking position + */ + id: string; + + /** + * The unique identifier of the staking provider + */ + providerId: string; + + /** + * The source vault account to stake from. + */ + vaultAccountId: string; + + /** + * The destination validator address name. + */ + validatorName: string; + /** + * The destination validator provider name. + */ + providerName: string; + + /** + * The blockchain descriptor to use. + */ + chainDescriptor: string; + + /** + * Amount of tokens to stake. + */ + amount: string; + + /** + * The amount staked in the position, measured in the blockchain descriptor unit. + */ + rewardsAmount: string; + + /** + * When was the request made (ISO Date). + */ + dateCreated: string; + + /** + * The current status. + */ + status: PositionStatus; + + /** + * An array of transaction objects related to this position. + * Each object includes a 'txId' representing the transaction ID + * and a 'isSuccessful' boolean indicating if the transaction was successful. + */ + relatedTransactions: RelatedTransactionDto[]; + + /** + * Indicates whether there is an ongoing action for this position (true if ongoing, false if not). + */ + inProgress: boolean; + + /** + * The transaction ID of the ongoing request + */ + inProgressTxId?: string; + + /** + * Additional fields per blockchain - can be empty or missing if not initialized or no additional info exists. + * The type depends on the chainDescriptor value. + * For Solana (SOL), stake account address. + * For Ethereum (ETH), an empty object is returned as no specific data is available. + */ + blockchainPositionInfo: TBlockchainPositionInfo; + + /** + * The destination address of the staking transaction. + */ + validatorAddress: string; + + /** + * An array of available actions that can be performed. for example, actions like "unstake" or "withdraw". + */ + availableActions: string[]; +} + +export interface ValidatorDto { + /** + * The protocol identifier (e.g. "ETH"/"SOL") of the validator + */ + chainDescriptor: string; + /** + * The service fee as a percentage out of the earned rewards + */ + feePercent: number; +} +export interface StakingProvider { + /** + * The ID of the provider + */ + id: string; + /** + * Name of the provider + */ + providerName: string; + /** + * An array of objects that includes chain descriptors and the corresponding fee percentages for validators supported by the provider + */ + validators: ValidatorDto[]; + /** + * URL to the validator's icon + */ + iconUrl: string; + /** + * URL to the terms of service + */ + termsOfServiceUrl: string; + /** + * Indicates whether the terms of service are approved" + */ + isTermsOfServiceApproved: boolean; +} + +/** + * Staking actions + */ + +/** + * Staking chain descriptors + */ +export enum StakingChain { + SOLANA = "SOL", + SOLANA_TESTNET = "SOL_TEST", + ETHEREUM = "ETH", + GOERLI = "ETH_TEST3", + MATIC = "MATIC", +} + +/** + * Check terms of service response + */ +export interface CheckTermsOfServiceResponseDto {} + +export interface ChainInfo { + chainId: string; + currentEpoch: number; + nextEpoch: number; + epochElapsed: number; + epochDuration: number; + additionalInfo: { [key: string]: any }; +} + +export interface AmountAndChainDescriptor { + chainDescriptor: string; + amount: string; +} + +export interface DelegationSummaryDto { + /** + * An array of objects containing chain descriptors and associated amounts, representing active positions. + */ + active: AmountAndChainDescriptor[]; + + /** + * An array of objects containing chain descriptors and associated amounts, representing inactive positions. + */ + inactive: AmountAndChainDescriptor[]; + + /** + * An array of objects containing chain descriptors and associated amounts, representing rewards positions. + */ + rewardsAmount: AmountAndChainDescriptor[]; + + /** + * An array of objects with chain descriptors and total staked amounts, + * representing the combined staked totals of active and inactive positions. + */ + totalStaked: AmountAndChainDescriptor[]; +} + +export class DelegationSummaryDtoByVault { + [vaultAccountId: string]: DelegationSummaryDto; +} + +export type StakeResponse = { + id: string; +}; + +export type UnstakeResponse = {}; + +export type WithdrawResponse = {}; + +export type ClaimRewardsResponse = {}; + +export type SplitResponse = { + id: string; +}; + +export interface StakeRequestDto { + /** + * The source vault account to stake from + */ + vaultAccountId: string; + + /** + * The ID of the provider + */ + providerId: string; + + /** + * Amount of tokens to stake + */ + stakeAmount: string; + + /** + * The note to associate with the stake transactions + */ + txNote?: string; + + /** + * Represents the fee for a transaction, which can be specified as a percentage value. Only one of fee/feeLevel is required + */ + fee?: string; + + /** + * Represents the fee level for a transaction, which can be set as slow, medium, or fast. Only one of fee/feeLevel is required + */ + feeLevel?: string; +} + +export interface UnstakeRequestDto { + /** + * id of position to unstake + */ + id: string; + + /** + * The number of tokens to unstake. + * This optional field is applicable only for liquid staking and allows for a partial unstake of the position. + * If not provided, the entire position will be unstaked by default. + */ + amount?: string; + + /** + * Represents the fee for a transaction, which can be specified as a percentage value. Only one of fee/feeLevel is required + */ + fee?: string; + + /** + * Represents the fee level for a transaction, which can be set as slow, medium, or fast. Only one of fee/feeLevel is required + */ + feeLevel?: string; + + /** + * The note to associate with the transactions + */ + txNote?: string; +} + +export interface WithdrawRequestDto { + /** + * id of position to withdraw + */ + id: string; + + /** + * Represents the fee for a transaction, which can be specified as a percentage value. Only one of fee/feeLevel is required + */ + fee?: string; + + /** + * Represents the fee level for a transaction, which can be set as slow, medium, or fast. Only one of fee/feeLevel is required + */ + feeLevel?: string; + + /** + * The note to associate with the transactions + */ + txNote?: string; +} + +export interface ClaimRewardsRequestDto { + /** + * id of position to withdraw rewards from + */ + id: string; + + /** + * Represents the fee for a transaction, which can be specified as a percentage value. Only one of fee/feeLevel is required + */ + fee?: string; + + /** + * Represents the fee level for a transaction, which can be set as slow, medium, or fast. Only one of fee/feeLevel is required + */ + feeLevel?: string; + + /** + * The note to associate with the transactions + */ + txNote?: string; +} + +export interface SplitRequestDto { + /** + * id of position to split + */ + id: string; + + /** + * Amount of tokens to split + */ + amount: string; + + /** + * Represents the fee for a transaction, which can be specified as a percentage value. Only one of fee/feeLevel is required + */ + fee?: string; + + /** + * Represents the fee level for a transaction, which can be set as slow, medium, or fast. Only one of fee/feeLevel is required + */ + feeLevel?: string; + + /** + * The note to associate with the transactions + */ + txNote?: string; +} \ No newline at end of file diff --git a/src/types.ts b/src/types.ts index 0f1c1e3e..47917bef 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,11 +1,15 @@ import { AxiosResponseHeaders } from "axios"; +export interface Paging { + next: string; +} + export interface Web3PagedResponse { data: T[]; paging?: Paging; } -export type APIResponseHeaders = AxiosResponseHeaders & {"x-request-id"?: string}; +export type APIResponseHeaders = AxiosResponseHeaders & { "x-request-id"?: string }; export interface VaultAccountResponse { id: string; @@ -61,6 +65,189 @@ export interface UnfreezeTransactionResponse { success: boolean; } +export interface RegisterAssetResponse { + legacyId: string; + assetClass: AssetClass; + onchain: OnchainAsset; + metadata: AssetMetadata; +} + +export enum AssetDetailsClass { + NATIVE = "NATIVE", + FT = "FT", + FIAT = "FIAT", + NFT = "NFT", + SFT = "SFT", +} + +export enum AssetClass { + NATIVE = "NATIVE", + FT = "FT", + NFT = "NFT", + SFT = "SFT", +} + +export interface OnchainAsset { + symbol: string; + name: string; + address?: string; + decimals: number; + standard: string; +} + +export interface AssetOnchain { + symbol: string; + name: string; + address?: string; + decimals: number; + standards?: string[]; +} + +export interface AssetMetadata { + scope: AssetScope; + deprecated: boolean; +} + +export interface AssetMediaAttributes { + monochrome?: boolean; +} + +export interface AssetMedia { + url: string; + type: string; + attributes?: AssetMediaAttributes; +} + +export interface AssetNote { + text: string; + userId: string; + userName: string; + updatedAt: string; +} + +export interface AssetDetailsMetadata { + scope: AssetDetailsScope; + verified: boolean; + deprecated: boolean; + deprecationReferralId?: string; + website?: string; + media?: AssetMedia[]; + note?: AssetNote; + features?: AssetFeature[]; +} + +export enum AssetScope { + GLOBAL = "Global", + LOCAL = "Local", +} + +export enum AssetDetailsScope { + GLOBAL = "GLOBAL", + LOCAL = "LOCAL", +} + +export enum AssetFeature { + STABLECOIN = "STABLECOIN", +} + +export interface ListAssetResponse { + id: string; + legacyId: string; + blockchainId?: string; + displayName: string; + displaySymbol: string; + assetClass: AssetDetailsClass; + onchain?: AssetOnchain; + metadata: AssetDetailsMetadata; +} + +export interface ListAssetsResponse { + next: string | null; + data: ListAssetResponse[]; +} + +export interface ListAssetsFilters { + blockchainId?: string; + assetClass?: AssetDetailsClass; + symbol?: string; + scope?: AssetDetailsScope; + deprecated?: boolean; + ids?: string[]; + pageCursor?: string; + pageSize?: number; +} + +interface AssetNoteRequest { + text: string | null; +} + +interface AssetMetadataRequest { + note: AssetNoteRequest; +} + +export interface UpdateAssetUserMetadataRequest { + metadata: AssetMetadataRequest; +} + +export enum BlockchainSigningAlgo { + ECDSA_SECP256K1 = "ECDSA_SECP256K1", + EDDSA_ED25519 = "EDDSA_ED25519", +} + +export interface BlockchainOnchain { + protocol: string; + chainId?: string; + test: boolean; + signingAlgo: BlockchainSigningAlgo; +} + +export class BlockchainMedia { + url: string; + type: string; +} + +export class BlockchainExplorer { + base: string; + address?: string; + tx?: string; + token?: string; +} + +export enum BlockchainScope { + GLOBAL = "GLOBAL", + LOCAL = "LOCAL", +} + +export interface BlockchainMetadata { + scope: BlockchainScope; + deprecated: boolean; + media?: BlockchainMedia[]; + explorer?: BlockchainExplorer; +} + +export interface ListBlockchainResponse { + id: string; + legacyId: string; + displayName: string; + nativeAssetId: string; + onchain: BlockchainOnchain; + metadata: BlockchainMetadata; +} + +export interface ListBlockchainsResponse { + next: string | null; + data: ListBlockchainResponse[]; +} + +export interface ListBlockchainsFilters { + protocol?: string; + deprecated?: boolean; + test?: boolean; + ids?: string[]; + pageCursor?: string; + pageSize?: number; +} + export interface VaultAssetResponse { id: string; address: string; @@ -85,6 +272,12 @@ export interface WalletContainerResponse { customerRefId?: string; } +export interface PaginatedInternalWalletContainerResponse { + total: number; + data: WalletContainerResponse; + next: string | null; +} + export interface ExternalWalletAsset { id: string; status: string; @@ -135,6 +328,7 @@ export interface EstimatedTransactionFee { export interface TransferPeerPath { type?: PeerType; id?: string; + walletId?: string; virtualId?: string; virtualType?: VirtualType; address?: string; @@ -143,6 +337,7 @@ export interface TransferPeerPath { export interface DestinationTransferPeerPath { type: PeerType; id?: string; + walletId?: string; virtualId?: string; virtualType?: VirtualType; oneTimeAddress?: IOneTimeAddress; @@ -199,6 +394,7 @@ export interface TransactionArgumentsFeePayerInfo { feePayerAccountId: string; } +// example export interface TransactionArguments { assetId?: string; source?: TransferPeerPath; @@ -209,6 +405,7 @@ export interface TransactionArguments { feeLevel?: FeeLevel; failOnLowFee?: boolean; maxFee?: string; + maxTotalFee?: string; priorityFee?: number | string; gasPrice?: number | string; gasLimit?: number | string; @@ -228,8 +425,13 @@ export interface TransactionArguments { } export type OwnershipProof = { - type: string; - proof: string; + type?: string; + proof?: string; + attestation?: string; + address?: string; + wallet_provider?: string; + url?: string; + confirmed?: boolean; }; export enum TravelRuleAddressTypeCode { @@ -301,8 +503,19 @@ export interface TravelRule { beneficiaryRef?: string; originatorVASPdid: string; travelRuleBehavior?: boolean; - beneficiaryVASPdid: string; + beneficiaryVASPdid?: string; beneficiaryVASPname?: string; + originatorVASPname?: string; + beneficiaryVASPwebsite?: string; + encryptedMessage?: string; + protocol?: string; + skipBeneficiaryDataValidation?: boolean; + travelRuleBehaviorRef?: string; + originatorProof?: OwnershipProof; + beneficiaryProof?: OwnershipProof; + beneficiaryDid?: string; + originatorDid?: string; + isNonCustodial?: boolean; originator: TROriginator; beneficiary: TRBeneficiary; pii?: PII; @@ -500,6 +713,132 @@ export interface TravelRuleVaspFilter { order?: string; } +export interface TravelRuleVaspForVaultRequestResponse { + vaspDid: string; +} + +export interface ScreeningPolicyConfiguration { + bypassScreeningDuringServiceOutages?: boolean; + inboundTransactionDelay?: number; + outboundTransactionDelay?: number; +} + +export interface ScreeningTenantConfiguration { + disableBypass: boolean; + disableUnfreeze: boolean; +} + +export enum ScreeningAction { + screen = "SCREEN", + pass = "PASS", + freeze = "FREEZE" +} + +export interface ScreeningPolicyRuleResponse { + sourceType?: string; + sourceSubType?: string; + destType?: string; + destSubType?: string; + destAddress?: string; + sourceId?: string; + destId?: string; + asset?: string; + baseAsset?: string; + amount?: number; + amountUSD?: number; + networkProtocol?: string; + operation?: string; + action: ScreeningAction; +} + +export interface ScreeningProviderConfigurationResponse { + direction?: TransactionDirection; + status?: ScreeningTransactionStatus; + amountUSD?: number; + amount?: number; + asset?: string; + action: ScreeningVerdict; +} + +export enum PolicyApprovalStatus { + live = "live", + processing = "processing" +} + +export enum TransactionDirection { + inbound = "INBOUND", + outbound = "OUTBOUND" +} + +export enum ScreeningTransactionStatus { + completed = "COMPLETED", + pending = "PENDING", + rejected = "REJECTED", + failed = "FAILED", + canceled = "CANCELED", + blockingTimeExpired = "BLOCKING_TIME_EXPIRED", +} + +export enum ScreeningVerdict { + accept = "ACCEPT", + reject = "REJECT", + alert = "ALERT", + wait = "WAIT", + freeze = "FREEZE", + cancel = "CANCEL" +} + +export interface ScreeningConfigurationsResponse { + bypassScreeningDuringServiceOutages: boolean; + inboundTransactionDelay: number; + outboundTransactionDelay: number; +} + +export interface ScreeningPolicyResponse { + tenantId?: string; + policy: ScreeningPolicyRuleResponse; + policyStatus?: PolicyApprovalStatus; + isDefault: boolean; + createDate?: Date; + lastUpdate: Date; +} + +export interface ScreeningPolicyRuleResponse { + sourceType?: string; + sourceSubType?: string; + destType?: string; + destSubType?: string; + destAddress?: string; + sourceId?: string; + destId?: string; + asset?: string; + baseAsset?: string; + amount?: number; + amountUSD?: number; + networkProtocol?: string; + operation?: string; + action: ScreeningAction; +} + +export type ScreeningType = "travel_rule" | "aml"; + +export interface ScreeningSupportedAssetResponse { + id: string; + name: string; + type: string; + contractAddress: string; + nativeAsset: string; + decimals?: number; + blockchain: string; +} + +export enum ScreeningSupportedProviders { + CHAINALYSIS = "CHAINALYSIS", + ELLIPTIC = "ELLIPTIC", + CHAINALYSIS_V2 = "CHAINALYSIS_V2", + ELLIPTIC_HOLISTIC = "ELLIPTIC_HOLISTIC", +} + export enum Web3ConnectionFeeLevel { HIGH = "HIGH", MEDIUM = "MEDIUM", @@ -520,6 +859,16 @@ export interface ExchangeResponse { status: string; } +export interface PagedExchangeResponse { + exchanges: ExchangeResponse[]; + paging?: { + before?: string; + after?: string; + }; + prevUrl?: string; + nextUrl?: string; +} + export interface ConvertExchangeAssetResponse { status: boolean; } @@ -596,6 +945,7 @@ export interface TransactionResponse { index?: number; rewardInfo?: RewardInfo; feePayerInfo?: FeePayerInfo; + errorDescription?: string; } export interface AmountInfo { @@ -634,6 +984,7 @@ export interface TransferPeerPathResponse { subType?: string; virtualType?: VirtualType; virtualId?: string; + walletId?: string; } export interface AuthorizationInfo { @@ -759,7 +1110,10 @@ export interface TransactionFilter { sourceType?: PeerType; destType?: PeerType; sourceId?: string; + sourceWalletId?: string; + destWalletId?: string; destId?: string; + sort?: "ASC" | "DESC"; } export interface NFTOwnershipFilter { @@ -773,16 +1127,40 @@ export interface NFTOwnershipFilter { order?: OrderValues; status?: NFTOwnershipStatus; search?: string; + ncwId?: string; + ncwAccountIds?: string[]; + walletType?: NFTOwnershipWalletType; + spam?: NFTSpamTokenOwnership; } export interface NFTOwnedCollectionsFilter { search?: string; + status?: NFTOwnershipStatus; + ncwId?: string; + walletType?: NFTOwnershipWalletType; pageCursor?: string; pageSize?: number; sort?: GetOwnedCollectionsSortValues[]; order?: OrderValues; } +export interface NFTOwnedAssetsFilter { + search?: string; + status?: NFTOwnershipStatus; + ncwId?: string; + walletType?: NFTOwnershipWalletType; + pageCursor?: string; + pageSize?: number; + sort?: GetOwnedAssetsSortValues[]; + order?: OrderValues; + spam?: NFTSpamTokenOwnership; +} + +export interface TokenOwnershipSpamUpdatePayload { + assetId: string; + spam: boolean; +} + export interface GetNFTsFilter { ids: string[]; pageCursor?: string; @@ -791,19 +1169,28 @@ export interface GetNFTsFilter { order?: OrderValues; } -class MediaEntity { +interface NFTCollection { + id: string; + name?: string; + symbol?: string; +} + +interface MediaEntity { url: string; contentType: string; } -interface NFTCollection { - id: string; - name: string; - symbol: string; +enum NFTSpamSourceEnum { + OWNER = "OWNER", + SYSTEM = "SYSTEM", } -export interface Paging { - next: string; +interface NFTSpamTokenResponse { + result: boolean; +} + +interface NFTSpamOwnershipResponse extends NFTSpamTokenResponse { + source: NFTSpamSourceEnum; } export interface Token { @@ -811,21 +1198,25 @@ export interface Token { tokenId: string; standard: string; blockchainDescriptor: string; - description: string; - name: string; - media: MediaEntity[]; + description?: string; + name?: string; + media?: MediaEntity[]; metadataURI?: string; cachedMetadataURI?: string; collection?: NFTCollection; + spam?: NFTSpamTokenResponse; } -export interface TokenWithBalance extends Token { +export interface BaseTokenWithBalance extends Token { balance: string; - vaultAccountId: string; ownershipStartTime: number; ownershipLastUpdateTime: number; + spam?: NFTSpamOwnershipResponse; + status: NFTOwnershipStatus; } +export type TokenWithBalance = (WorkspaceWalletIdentifier | NonCustodialWalletIdentifier) & BaseTokenWithBalance; + export interface CollectionOwnership extends NFTCollection { standard?: string; blockchainDescriptor: string; @@ -843,6 +1234,13 @@ export interface TransactionPageFilter { destType?: PeerType; sourceId?: string; destId?: string; + sort?: "ASC" | "DESC"; +} + +export interface ExchangeAccountsPageFilter { + limit: number; + before?: string; + after?: string; } export enum TransactionOrder { @@ -883,12 +1281,14 @@ export enum PeerType { EXCHANGE_ACCOUNT = "EXCHANGE_ACCOUNT", INTERNAL_WALLET = "INTERNAL_WALLET", EXTERNAL_WALLET = "EXTERNAL_WALLET", + CONTRACT = "CONTRACT", UNKNOWN = "UNKNOWN", NETWORK_CONNECTION = "NETWORK_CONNECTION", FIAT_ACCOUNT = "FIAT_ACCOUNT", COMPOUND = "COMPOUND", ONE_TIME_ADDRESS = "ONE_TIME_ADDRESS", - OEC_PARTNER = "OEC_PARTNER" + OEC_PARTNER = "OEC_PARTNER", + END_USER_WALLET = "END_USER_WALLET", } export enum VirtualType { @@ -997,14 +1397,21 @@ export interface PublicKeyInfoArgs { compressed?: boolean; } -export interface PublicKeyInfoForVaultAccountArgs { +export interface BasePublicKeyInfoByAccountAssetArgs { assetId: string; - vaultAccountId: number; change: number; addressIndex: number; compressed?: boolean; } +export interface PublicKeyInfoByAccountAssetArgs extends BasePublicKeyInfoByAccountAssetArgs { + accountId: number; +} + +export interface PublicKeyInfoForVaultAccountArgs extends BasePublicKeyInfoByAccountAssetArgs { + vaultAccountId: number; +} + export interface GasStationInfo { balance: { [asset: string]: string }; configuration: { @@ -1040,6 +1447,33 @@ export interface MaxBip44IndexUsedResponse { maxBip44AddressIndexUsed?: number; maxBip44ChangeAddressIndexUsed?: number; } +export interface AddressResponse { + assetId: string; + address: string; + description?: string; + tag: string; + type?: number; + customerRefId?: number; + addressFormat?: string; + legacyAddress?: string; + enterpriseAddress?: string; + bip44AddressIndex?: string; + userDefined: boolean; +} + +export interface PaginatedAddressesResponse { + addresses: AddressResponse[]; + paging?: { + before?: string; + after?: string; + }; +} + +export interface OptionalPaginatedAddressesRequestFilters { + limit?: number; // for default and max limit values please see: https://docs.fireblocks.com/api/swagger-ui/#/ + before?: string; + after?: string; +} export interface VaultAccountsFilter { namePrefix?: string; @@ -1059,6 +1493,15 @@ export interface PagedVaultAccountsRequestFilters { after?: string; } +export interface GetAssetWalletsFilters { + assetId?: string; + totalAmountLargerThan?: number; + orderBy?: "ASC" | "DESC"; + limit?: number; + before?: string; + after?: string; +} + export interface PagedVaultAccountsResponse { accounts: VaultAccountResponse[]; paging?: { @@ -1069,13 +1512,38 @@ export interface PagedVaultAccountsResponse { nextUrl?: string; } +export interface AssetWalletsResponse { + vaultId: string; + assetId: string; + available: string; + total: string; + pending: string; + staked: string; + frozen: string; + lockedAmount: string; + blockHeight: string; + blockHash: string; + creationTime: string; +} + +export interface GetAssetWalletsResponse { + assetWallets: AssetWalletsResponse[]; + paging: { + after?: string; + before?: string; + }; +} + export interface VaultBalancesFilter { accountNamePrefix?: string; accountNameSuffix?: string; } export interface RequestOptions { - idempotencyKey: string; + idempotencyKey?: string; + ncw?: { + walletId?: string; + }; } export interface ValidateAddressResponse { @@ -1093,6 +1561,19 @@ export interface AssetTypeResponse { decimals?: number; } +export interface AssetPriceResponse { + legacyId: string; + lastUpdateAt: number; + currency: string; + price: number; + source: AssetPriceSource; +} + +enum AssetPriceSource { + PUBLIC = "PUBLIC", + PRIVATE = "PRIVATE" +} + export interface User { id: string; firstName: string; @@ -1102,6 +1583,42 @@ export interface User { role: string; } + +export type TRole = + | "ADMIN" + | "SIGNER" + | "EDITOR" + | "APPROVER" + | "VIEWER" + | "NON_SIGNING_ADMIN" + | "AUDITOR" + | "NCW_ADMIN" + | "NCW_SIGNER"; + +interface BaseUser { + id: string; + enabled: boolean; + role: TRole; + status: string; +} +export interface ConsoleUser extends BaseUser { + firstName: string; + lastName: string; + email: string; + userType: "CONSOLE"; +} + +export interface ApiUser extends BaseUser { + name: string; + userType: "API"; +} +export interface UsersGroup { + id: string; + name: string; + membersIds: string[]; + status: string; +} + export interface ResendWebhooksResponse { webhooksCount: number; } @@ -1201,16 +1718,27 @@ export interface FeePayerConfiguration { feePayerAccountId: string; } -export interface CreateWeb3ConnectionPayload { - vaultAccountId: number; +export interface BaseWeb3ConnectionPayload { feeLevel: Web3ConnectionFeeLevel; } +export interface WorkspaceWalletIdentifier { + vaultAccountId: number; +} + +export interface NonCustodialWalletIdentifier { + ncwId: string; + ncwAccountId: number; +} -export interface CreateWalletConnectPayload extends CreateWeb3ConnectionPayload { +export interface WalletConnectConnectionPayload { uri: string; - chainIds: string[]; + chainIds?: string[]; } +export type CreateWeb3ConnectionPayload = (WorkspaceWalletIdentifier | NonCustodialWalletIdentifier) & BaseWeb3ConnectionPayload; + +export type CreateWalletConnectPayload = CreateWeb3ConnectionPayload & WalletConnectConnectionPayload; + export interface GetWeb3ConnectionsPayload { pageCursor?: string; pageSize?: number; @@ -1221,33 +1749,29 @@ export interface GetWeb3ConnectionsPayload { export interface CreateWeb3ConnectionResponse { id: string; - sessionMetadata: { - appIcon?: string, - appId?: string, - appName?: string, - appUrl?: string, - appDescription?: string - }; + sessionMetadata: SessionMetadata; } export interface SessionMetadata { + appUrl: string; appIcon?: string; - appId?: string; appName?: string; - appUrl?: string; appDescription?: string; - } +} export interface Session { id: string; - vaultAccountId: number; - chainIds?: string[]; + vaultAccountId?: number; + ncwId?: string; + ncwAccountId?: number; + chainIds: string[]; feeLevel: Web3ConnectionFeeLevel; creationDate: string; connectionType: Web3ConnectionType; - connectionMethod?: Web3ConnectionMethod; - sessionMetadata?: SessionMetadata; - } + connectionMethod: Web3ConnectionMethod; + sessionMetadata: SessionMetadata; +} + export enum TimePeriod { DAY = "DAY", WEEK = "WEEK" @@ -1325,6 +1849,10 @@ export interface AuditsResponse { total: number; } +export interface AuditLogsResponse extends AuditsResponse { + cursor: string | null; +} + export interface ISystemMessageInfo { type: string; message: string; @@ -1347,6 +1875,10 @@ export enum GetOwnedCollectionsSortValues { "name" = "name", } +export enum GetOwnedAssetsSortValues { + "name" = "name", +} + export enum OrderValues { "ASC" = "ASC", "DESC" = "DESC", @@ -1357,19 +1889,197 @@ export enum NFTOwnershipStatus { "ARCHIVED" = "ARCHIVED", } -export enum TokenLinkPermission { - MINT = "MINT", - BURN = "BURN", +export interface NFTOwnershipStatusUpdatedPayload { + assetId: string; + status: NFTOwnershipStatus; +} + +export enum NFTOwnershipWalletType { + "VAULT_ACCOUNT" = "VAULT_ACCOUNT", + "END_USER_WALLET" = "END_USER_WALLET", } -export interface TokenLinkPermissionEntry { - permission: TokenLinkPermission; +export enum ContractTemplateType { + FUNGIBLE_TOKEN = "FUNGIBLE_TOKEN", + NON_FUNGIBLE_TOKEN = "NON_FUNGIBLE_TOKEN", + NON_TOKEN = "NON_TOKEN", + UUPS_PROXY = "UUPS_PROXY", +} + +export type SupportedContractTemplateType = ContractTemplateType.FUNGIBLE_TOKEN | ContractTemplateType.NON_FUNGIBLE_TOKEN; + +export enum ContractInitializationPhase { + ON_DEPLOYMENT = "ON_DEPLOYMENT", + POST_DEPLOYMENT = "POST_DEPLOYMENT", +} + +export enum InputFieldMetadataTypes { + EncodedFunctionCallFieldType = "encodedFunctionCall", + DeployedContractAddressFieldType = "deployedContractAddress", + SupportedAssetAddressFieldType = "supportedAssetAddress", +} + +export interface EncodedFunctionCallFieldMetadata { + templateId: string; + functionSignature: string; +} + +export interface DeployedContractAddressFieldMetadata { + templateId: string; +} + +export interface FieldMetadata { + type: string | InputFieldMetadataTypes; + info: EncodedFunctionCallFieldMetadata | DeployedContractAddressFieldMetadata; +} + +export interface InputFieldsMetadata { + [contractMethod: string]: Record; +} + +export enum NFTSpamTokenOwnership { + "true" = "true", + "false" = "false", + "all" = "all", +} + +export interface ContractUploadRequest { + name: string; + description: string; + longDescription: string; + bytecode: string; + sourcecode: string; + type: ContractTemplateType; + implementationContractId?: string; + initializationPhase: ContractInitializationPhase; + compilerOutputMetadata?: object; + inputFieldsMetadata?: InputFieldsMetadata; + docs?: ContractDoc; + abi?: AbiFunction[]; + attributes?: Record; +} + +export interface AbiFunction { + name?: string; + stateMutability?: string; + type: "function" | "constructor" | "fallback" | "receive" | string; + inputs?: Parameter[]; + outputs?: Parameter[]; + description?: string; + returns?: Record; +} + +export interface TxLogDto { + address: string; + topics: string[]; + data: string; + blockNumber: number; + transactionHash: string; + transactionIndex: number; + blockHash: string; + logIndex: number; + removed: boolean; +} + +export interface TransactionReceiptResponseDto { + blockHash: string; + blockNumber: number; + contractAddress?: string; + cumulativeGasUsed: number; + effectiveGasPrice: number; + from: string; + gasUsed: number; + logs: TxLogDto[]; + logsBloom: string; + status: number; + to?: string; + transactionHash: string; + transactionIndex: number; + type: string; +} + +interface Parameter { + name: string; + description?: string; + internalType: string; + type: string; + components?: Parameter[]; +} +interface ContractDoc { + details?: string; + events?: string; + kind: "dev" | "user" | string; + methods: Record; + version: string | number; +} + +interface FunctionDoc { + details?: string; + params?: Record; + returns?: Record; +} +interface VendorDto { + id: string; + name: string; + attributes: Record; +} + +export interface ContractDeployRequest { + assetId: string; vaultAccountId: string; + deployFunctionParams?: object[]; + fee?: string; + feeLevel?: FeeLevel; + useGasless?: boolean; +} + +export interface SupportedBlockchain { + baseAssetId: string; + contractAddress: string; +} + +export interface SupportedBlockchainsResponse { + supportsAllBlockchains: boolean; + supportedBlockchains?: Array; +} + +export interface ContractDeployResponse { + txId: string; +} + +export interface LeanContractTemplateDto { + id: string; + name: string; + description: string; + attributes?: Record; + isPublic: boolean; + owner?: string; + vendor?: VendorDto; +} + +export interface ContractTemplateDto { + id: string; + name: string; + description: string; + longDescription: string; + abi: AbiFunction[]; + attributes?: Record; + docs?: ContractDoc; + owner?: string; + vendor?: VendorDto | null; + isPublic: boolean; + canDeploy: boolean; + type: ContractTemplateType; + implementationContractId?: string; + initializationPhase: ContractInitializationPhase; + compilerOutputMetadata?: object; } export interface LinkedTokenMetadata { assetId: string; name?: string; + symbol?: string; + networkProtocol?: string; totalSupply?: string; holdersCount?: number; type?: string; @@ -1377,21 +2087,246 @@ export interface LinkedTokenMetadata { issuerAddress?: string; testnet?: boolean; blockchain?: string; + decimals?: number; + vaultAccountId?: string; +} + +export interface LinkedContractMetadataDto { + id: string; + blockchainId: string; + baseAssetId: string; + contractAddress: string; + contractTemplateId: string; + vaultAccountId?: string; } + +export interface LinkedCollectionMetadataDto { + fbCollectionId: string; + name?: string; + symbol?: string; + standard?: string; + blockchainDescriptor: string; + contractAddress?: string; +} + +export enum TokenLinkStatus { + PENDING = "PENDING", + COMPLETED = "COMPLETED", +} + export interface TokenLink { id: string; - assetId: string; - assetMetadata?: LinkedTokenMetadata; - permissions: TokenLinkPermissionEntry[]; + type?: ContractTemplateType; + refId?: string; + status: TokenLinkStatus; + tokenMetadata?: LinkedTokenMetadata | LinkedCollectionMetadataDto | LinkedContractMetadataDto; + displayName?: string; +} + +export enum CollectionType { + NON_FUNGIBLE_TOKEN = "NON_FUNGIBLE_TOKEN", + SEMI_FUNGIBLE_TOKEN = "SEMI_FUNGIBLE_TOKEN", +} + +export interface CollectionLink { + id: string; + type: CollectionType; + status: TokenLinkStatus; + displayName?: string; + collectionMetadata?: LinkedCollectionMetadataDto; +} + +export interface CollectionTokenResponseDto { + tokenId: string; + metadataURI: string; + totalSupply: string; +} + +export interface GetTokenLinksFilter { + status?: TokenLinkStatus; + pageSize?: number; + pageCursor?: string; +} + +export interface GetContractTemplatesFilter { + initializationPhase?: ContractInitializationPhase; + type?: ContractTemplateType; + pageSize?: number; + pageCursor?: string; +} + +export interface GetContractsFilter { + contractTemplateId?: string; + baseAssetId?: string; + contractAddress?: string; + pageSize?: number; + pageCursor?: string; +} + +export interface TokenLinksCount { + count: number; +} + +export interface LeanDeployedContractResponseDto { + id: string; + baseAssetId: string; + contractAddress: string; + contractTemplateId: string; +} + +export interface DeployedContractResponseDto extends LeanDeployedContractResponseDto { + id: string; + vaultAccountId?: string; +} +export interface ContractAddressResponseDto { + + contractAddress: string; +} +type ContractAbi = AbiFunction[]; + +export interface ContractAbiResponseDto { + abi: ContractAbi; + implementationAbi?: ContractAbi; +} + +export interface ContractWithABIDto { + address: string; + baseAssetId: string; + name: string; + abi: ContractAbi; + isProxy?: boolean; + implementation?: string; + isPublic: boolean; +} + +export interface WriteCallFunctionResponseDto { + txId: string; +} + +export interface CreateCollectionRequest { + baseAssetId: string; + vaultAccountId: string; + type: CollectionType; + name: string; + symbol: string; + adminAddress: string; + displayName?: string; +} + +export interface TokenMetadataAttributesDto { + trait_type: string; + value: string; + display_type?: string; +} + +export interface TokenMetadataDto { + name: string; + description: string; + image?: string; + animation_url?: string; + external_url?: string; + attributes?: TokenMetadataAttributesDto[]; +} + +export interface MintCollectionTokenRequest { + to: string; + tokenId: string; + vaultAccountId: string; + amount?: string; + metadataURI?: string; + metadata?: TokenMetadataDto; +} + +export interface BurnCollectionTokenRequest { + tokenId: string; + vaultAccountId: string; + amount?: string; } export interface IssueTokenRequest { + assetId?: string; + blockchainId?: string; + vaultAccountId: string; + createParams: CreateTokenParams; + displayName?: string; + fee?: string; + feeLevel?: FeeLevel; + useGasless?: boolean; +} + +export interface JobCreatedResponse { + jobId: string; +} + +export enum BatchStatus { + CREATED = "CREATED", + IN_PROGRESS = "INPROGRESS", + DONE = "DONE", + ERROR = "ERROR", + CANCELED = "CANCELED", + PAUSED = "PAUSED" +} + +export class BatchJob { + id: string; + tenantId: string; + type: string; + userId: string; + created: number; + updated?: number; + state: BatchJob; + data: string; +} + +export class BatchTask { + id: string; + jobId: string; + type: string; + tenantId: string; + created: number; + updated?: number; + state: BatchStatus; + data?: string; + result?: string; +} + +type CreateTokenParams = EVMTokenCreateParamsDto | StellarRippleCreateParamsDto; + +interface StellarRippleCreateParamsDto { symbol: string; name: string; - blockchainId: string; - ethContractAddress?: string; - issuerAddress?: string; - decimals: number; + issuerAddress: string; +} + +interface ParameterWithValue { + internalType: string; + name: string; + type: string; + description?: string; + value: any; + functionValue?: Pick; +} +export type ParameterWithValueList = ParameterWithValue[] | ParameterWithValueList[]; + + +interface EVMTokenCreateParamsDto { + contractId: string; + deployFunctionParams?: Array; +} + +export interface ReadCallFunctionDto { + abiFunction: AbiFunction; +} + +export interface WriteCallFunctionDto { + vaultAccountId: string; + abiFunction: AbiFunction; + amount?: string; + feeLevel?: FeeLevel; + fee?: string; + note?: string; + externalTxId?: string; + useGasless?: boolean; } export enum SmartTransfersTicketDirection { @@ -1439,6 +2374,7 @@ export interface SmartTransfersTicketTerm { id: string; asset: string; amount: string; + amountUsd?: string; fromNetworkId: string; fromNetworkIdName?: string; toNetworkId: string; @@ -1497,6 +2433,14 @@ export interface SmartTransfersTicketsFilters { type?: string; } +export interface SmartTransfersUserGroupsResponse { + data: SmartTransfersUserGroups; +} + +export interface SmartTransfersUserGroups { + userGroupIds: string[]; +} + export interface SmartTransfersTicketTermFundPayload { asset: string; amount: string; @@ -1505,4 +2449,332 @@ export interface SmartTransfersTicketTermFundPayload { srcType: string; fee?: string; feeLevel?: FeeLevel; -} \ No newline at end of file +} + +export interface UnspentInputsResponse { + input: { + txHash: string; + index: number; + }; + address: string; + amount: string; + confirmations: number; + status: string; +} + +export interface RescanTx { + assetId: string; + txHash: string; +} + +export interface RescanTxResponse { + txHashes: string[]; + baseAsset: string; + networkProtocol: string; +} + +export namespace NCW { + export const WalletIdHeader = "X-End-User-Wallet-Id"; + + export interface WalletInfo { + walletId: string; + enabled: boolean; + } + + export class LatestBackupKey { + deviceId: string; + publicKey: string; + keyId: string; + algorithm: string; + } + + export class LatestBackupResponse { + passphraseId: string; + createdAt: number; + keys: Array; + } + + export interface GetWalletsPayload { + pageCursor?: string; + pageSize?: number; + sort?: string; + order?: "ASC" | "DESC"; + } + + export interface GetSupportedAssetsPayload { + pageCursor?: string; + pageSize?: number; + onlyBaseAssets?: boolean; + } + + export interface GetWalletAccountsPayload { + pageCursor?: string; + pageSize?: number; + sort?: string; + order?: "ASC" | "DESC"; + } + + export interface GetWalletAssetsPayload { + pageCursor?: string; + pageSize?: number; + sort?: string; + order?: "ASC" | "DESC"; + } + + export interface GetWalletAddressesPayload { + pageCursor?: string; + pageSize?: number; + sort?: string; + order?: "ASC" | "DESC"; + } + + export interface WalletAssetResponse { + id: string; + symbol: string; + name: string; + decimals: number; + networkProtocol: string; + testnet: boolean; + hasFee: boolean; + type: string; + baseAsset: string; + ethNetwork?: string; + ethContractAddress?: string; + issuerAddress?: string; + blockchainSymbol?: string; + deprecated?: boolean; + coinType: number; + blockchain: string; + blockchainDisplayName?: string; + blockchainId?: string; + algorithm?: SigningAlgorithm; + } + + export interface WalletAssetAddress { + accountName: string; + accountId: string; + asset: string; + address: string; + addressType: string; + addressDescription?: string; + tag?: string; + addressIndex?: number; + legacyAddress?: string; + } + + export interface Device { + deviceId: string; + enabled: boolean; + physicalDeviceId: string; + } + + export enum SetupStatus { + COMPLETE = "COMPLETE", + INCOMPLETE = "INCOMPLETE", + } + + export class KeySetup { + status: SetupStatus; + algorithmName: SigningAlgorithm; + confirmed: boolean; + backedUp: boolean; + } + + export class DeviceKeySetupResponse { + status: SetupStatus; + deviceId: string; + setupStatus: Array; + } + + export class WalletSetupStatusResponse { + status: SetupStatus; + requiredAlgorithms: Array; + deviceSetupStatus: Array; + } + +} + +export namespace TAP { + type PolicyTransactionType = + | "*" + | "CONTRACT_CALL" + | "RAW" + | "TRANSFER" + | "APPROVE" + | "MINT" + | "BURN" + | "SUPPLY" + | "REDEEM" + | "STAKE" + | "TYPED_MESSAGE"; + + type PolicySrcOrDestType = + | "EXCHANGE" + | "UNMANAGED" + | "VAULT" + | "NETWORK_CONNECTION" + | "COMPOUND" + | "FIAT_ACCOUNT" + | "ONE_TIME_ADDRESS" + | "*"; + + type PolicyType = "TRANSFER"; + + type PolicyAction = "ALLOW" | "BLOCK" | "2-TIER"; + + type PolicyDestAddressType = "*" | "WHITELISTED" | "ONE_TIME"; + + type PolicyAmountScope = "SINGLE_TX" | "TIMEFRAME"; + + type PolicySrcOrDestSubType = "*" | "EXTERNAL" | "INTERNAL" | "CONTRACT" | "EXCHANGETEST"; + + type PolicySrcOrDestId = string; + + type AuthorizationGroup = { + users?: Array; + usersGroups?: Array; + th: number; + }; + + interface PolicyAuthorizationGroups { + logic: "AND" | "OR"; + allowOperatorAsAuthorizer?: boolean; + groups: Array; + } + + export interface PolicyRule { + operator?: string; + operators?: { + wildcard?: "*"; + users?: Array; + usersGroups?: Array; + services?: Array; + }; + transactionType?: PolicyTransactionType; + operatorServices?: Array; + designatedSigner?: string; + designatedSigners?: { + users?: Array; + usersGroups?: Array; + }; + type: PolicyType; + action: PolicyAction; + asset: string; + srcType?: PolicySrcOrDestType; + srcSubType?: PolicySrcOrDestSubType; + srcId?: PolicySrcOrDestId; + src?: { + ids?: Array<[PolicySrcOrDestId, PolicySrcOrDestType?, PolicySrcOrDestSubType?]>; + }; + dstType?: PolicySrcOrDestType; + dstSubType?: PolicySrcOrDestSubType; + dstId?: PolicySrcOrDestId; + dst?: { + ids?: Array<[PolicySrcOrDestId, PolicySrcOrDestType?, PolicySrcOrDestSubType?]>; + }; + dstAddressType?: PolicyDestAddressType; + amountCurrency: string; + amountScope: PolicyAmountScope; + amount: number | string; + periodSec: number; + authorizers?: Array; + authorizersCount?: number; + authorizationGroups?: PolicyAuthorizationGroups; + amountAggregation?: { + operators: string; + srcTransferPeers: string; + dstTransferPeers: string; + }; + rawMessageSigning?: { + derivationPath: { + path: Array; + }; + algorithm: string; + }; + applyForApprove?: boolean; + applyForTypedMessage?: boolean; + externalDescriptor?: string; + } + + interface Metadata { + editedBy?: string; + editedAt?: number; + publishedBy?: string; + publishedAt?: number; + } + + enum PolicyStatus { + SUCCESS = "SUCCESS", + UNVALIDATED = "UNVALIDATED", + INVALID_CONFIGURATION = "INVALID_CONFIGURATION", + PENDING = "PENDING", + PENDING_CONSOLE_APPROVAL = "PENDING_CONSOLE_APPROVAL", + AWAITING_QUORUM = "AWAITING_QUORUM", + UNHANDLED_ERROR = "UNHANDLED_ERROR", + } + + type PolicyBaseErrorField = + | "operator" + | "operators" + | "authorizationGroups" + | "designatedSigner" + | "designatedSigners" + | "contractMethods" + | "amountAggregation" + | "src" + | "dst" + | ""; + + interface PolicyRuleError { + errorMessage: string; + errorCodeName: string; + errorField: PolicyBaseErrorField; + errorCode: number; + } + + interface PolicyRuleCheckResult { + index: number; + status: "ok" | "failure"; + errors: Array; + } + + interface PolicyCheckResult { + errors: number; + results: PolicyRuleCheckResult[]; + } + + interface PolicyResponse { + status?: string; + rules?: Array; + metadata?: Metadata; + } + + interface ValidationResponse { + status?: PolicyStatus; + checkResult?: PolicyCheckResult; + } + + interface DraftResponse { + draftId: string; + status?: PolicyStatus; + rules?: Array; + metadata?: Metadata; + } + + export interface DraftReviewAndValidationResponse { + draftResponse: DraftResponse; + validation: ValidationResponse; + } + + export interface PolicyAndValidationResponse { + policy: PolicyResponse; + validation: ValidationResponse; + } + + export interface PublishResult { + status?: PolicyStatus; + rules?: Array; + checkResult?: PolicyCheckResult; + metadata?: Metadata; + } +}