{"id":19319669,"url":"https://github.com/blockcoders/nestjs-matic","last_synced_at":"2026-05-18T07:12:25.402Z","repository":{"id":47182496,"uuid":"358369396","full_name":"blockcoders/nestjs-matic","owner":"blockcoders","description":"Matic PoS and Plasma utilities for NestJS based on matic.js","archived":false,"fork":false,"pushed_at":"2022-03-24T14:05:37.000Z","size":648,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-09-21T21:52:08.009Z","etag":null,"topics":["blockchain","matic","maticjs","nest","nestjs","polygon","polygonjs"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/blockcoders.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-04-15T19:24:26.000Z","updated_at":"2022-03-24T14:05:41.000Z","dependencies_parsed_at":"2022-08-20T16:10:07.666Z","dependency_job_id":null,"html_url":"https://github.com/blockcoders/nestjs-matic","commit_stats":null,"previous_names":["jarcodallo/nestjs-matic"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/blockcoders/nestjs-matic","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blockcoders%2Fnestjs-matic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blockcoders%2Fnestjs-matic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blockcoders%2Fnestjs-matic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blockcoders%2Fnestjs-matic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/blockcoders","download_url":"https://codeload.github.com/blockcoders/nestjs-matic/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blockcoders%2Fnestjs-matic/sbom","scorecard":{"id":243711,"data":{"date":"2025-08-11","repo":{"name":"github.com/blockcoders/nestjs-matic","commit":"6908f6916018948a783d07ee77b2e4dff85f1b29"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.5,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":3,"reason":"Found 7/22 approved changesets -- score normalized to 3","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 10 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"60 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-cj7v-w2c7-cp7c","Warn: Project is vulnerable to: GHSA-4jpv-8r57-pv7j","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-fwr7-v2mv-hh25","Warn: Project is vulnerable to: GHSA-cph5-m8f7-6c5x","Warn: Project is vulnerable to: GHSA-wf5p-g6vw-rhxx","Warn: Project is vulnerable to: GHSA-jr5f-v2jv-69x6","Warn: Project is vulnerable to: GHSA-xq7p-g2vc-g82p","Warn: Project is vulnerable to: GHSA-qwcr-r2fm-qrc7","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-x9w5-v3q2-3rhw","Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x","Warn: Project is vulnerable to: GHSA-h452-7996-h45h","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq","Warn: Project is vulnerable to: GHSA-wm7h-9275-46v2","Warn: Project is vulnerable to: GHSA-434g-2637-qmqr","Warn: Project is vulnerable to: GHSA-49q7-c7j4-3p7m","Warn: Project is vulnerable to: GHSA-977x-g7h5-7qgw","Warn: Project is vulnerable to: GHSA-f7q4-pwc6-w24p","Warn: Project is vulnerable to: GHSA-fc9h-whq2-v747","Warn: Project is vulnerable to: GHSA-vjh7-7g9h-fjfh","Warn: Project is vulnerable to: GHSA-4gmj-3p3h-gm8h","Warn: Project is vulnerable to: GHSA-rv95-896h-c2vc","Warn: Project is vulnerable to: GHSA-qw6h-vgh9-j6wx","Warn: Project is vulnerable to: GHSA-3fjj-p79j-c9hh","Warn: Project is vulnerable to: GHSA-74fj-2j2h-c42q","Warn: Project is vulnerable to: GHSA-pw2r-vq6v-hr8c","Warn: Project is vulnerable to: GHSA-jchw-25xp-jwwc","Warn: Project is vulnerable to: GHSA-cxjh-pqwp-8mfp","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-pfrx-2q88-qq97","Warn: Project is vulnerable to: GHSA-rc47-6667-2j5j","Warn: Project is vulnerable to: GHSA-896r-f27r-55mw","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-44fp-w29j-9vj5","Warn: Project is vulnerable to: GHSA-r683-j2x4-v87g","Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j","Warn: Project is vulnerable to: GHSA-rhx6-c78j-4q9w","Warn: Project is vulnerable to: GHSA-h7cp-r72f-jxh6","Warn: Project is vulnerable to: GHSA-v62p-rq8g-8h59","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-584q-6j8j-r5pm","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-m6fv-jmcg-4jfg","Warn: Project is vulnerable to: GHSA-cm22-4g7w-348p","Warn: Project is vulnerable to: GHSA-wpg7-2c88-r8xv","Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-27v7-qhfv-rqq8","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-17T07:07:33.479Z","repository_id":47182496,"created_at":"2025-08-17T07:07:33.479Z","updated_at":"2025-08-17T07:07:33.479Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33168910,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-18T05:43:36.989Z","status":"ssl_error","status_checked_at":"2026-05-18T05:43:19.133Z","response_time":71,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blockchain","matic","maticjs","nest","nestjs","polygon","polygonjs"],"created_at":"2024-11-10T01:24:46.353Z","updated_at":"2026-05-18T07:12:25.364Z","avatar_url":"https://github.com/blockcoders.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NestJS-Matic\n\n[![npm](https://img.shields.io/npm/v/nestjs-matic)](https://www.npmjs.com/package/nestjs-matic)\n[![CircleCI](https://circleci.com/gh/blockcoders/nestjs-matic/tree/main.svg?style=svg)](https://circleci.com/gh/blockcoders/nestjs-matic/tree/main)\n[![Coverage Status](https://coveralls.io/repos/github/blockcoders/nestjs-matic/badge.svg?branch=main)](https://coveralls.io/github/blockcoders/nestjs-matic?branch=main)\n[![vulnerabilities](https://img.shields.io/snyk/vulnerabilities/npm/nestjs-matic)](https://snyk.io/test/github/blockcoders/nestjs-matic)\n[![supported platforms](https://img.shields.io/badge/platforms-Express%20%26%20Fastify-green)](https://img.shields.io/badge/platforms-Express%20%26%20Fastify-green)\n\nMatic PoS and Plasma utilities for NestJS based on [matic.js](https://github.com/maticnetwork/matic.js/)\n\n## Install\n\n```sh\nnpm i nestjs-matic\n```\n\n## Register module\n\n### Configuration params\n\n`nestjs-matic` can be configured with this options:\n\n```ts\ninterface MaticModuleOptions {\n  /**\n   * Optional parameter for connection, must be a MaticNetworks enum.\n   * Take 'mainnet' or 'testnet' as possible values.\n   * If no network is provided, mainnnet is used.\n   * @see {@link https://maticnetwork.github.io/matic.js/docs/plasma/initialize#options}\n   */\n  network?: MaticNetworks;\n\n  /**\n   * Optional parameter for version, must be a MaticVersions enum.\n   * Take 'v1' or 'mumbai' as possible values.\n   * If no version is provided, v1 is used.\n   * @see {@link https://maticnetwork.github.io/matic.js/docs/plasma/initialize#options}\n   */\n  version?: MaticVersions;\n\n  /**\n   * Optional parameter for maticProvider, can be a web3-core provider.\n   * If no maticProvider is provided, empty object is used\n   * The maticProvider may also be a URL to connect to,\n   * such as https://rpc-mumbai.matic.today\n   * @see {@link https://github.com/ChainSafe/web3.js/blob/1.x/packages/web3-core/types/index.d.ts#L436}\n   */\n  maticProvider?: web3-core.provider;\n\n  /**\n   * Required parameter for parentProvider, can be a web3-core provider.\n   * @see {@link https://github.com/ChainSafe/web3.js/blob/1.x/packages/web3-core/types/index.d.ts#L436}\n   */\n  parentProvider: web3-core.provider;\n\n  /**\n   * Optional parameter for parentDefaultOptions, must be a Matic\n   * SendOptions type.\n   * If no parentDefaultOptions is provided, empty object is used.\n   * @see {@link https://github.com/maticnetwork/matic.js/blob/master/src/types/Common.ts#L3}\n   */\n  parentDefaultOptions?: SendOptions;\n\n  /**\n   * Optional parameter for maticDefaultOptions, must be a Matic\n   * SendOptions type.\n   * If no parentDefaultOptions is provided, empty object is used.\n   * @see {@link https://github.com/maticnetwork/matic.js/blob/master/src/types/Common.ts#L3}\n   */\n  maticDefaultOptions?: SendOptions;\n\n  /**\n   * Optional parameter for maticClient, must be a string.\n   * Take 'Plasma' or 'PoS' as possible values.\n   * If no maticClient is provided, 'PoS\" is used.\n   */\n  maticClient?: MaticClients;\n}\n```\n\n### Synchronous configuration\n\nUse `MaticModule.forRoot` method with [Options interface](#configuration-params):\n\n```ts\nimport { MaticModule } from 'nestjs-matic';\nimport { MaticClients, MaticNetworks, MaticVersions } from 'nestjs-matic/dist/matic.interface';\n\n@Module({\n  imports: [\n    MaticModule.forRoot({\n      network: MaticNetworks.Testnet,\n      version: MaticVersions.Mumbai\n      maticProvider: 'https://rpc-mumbai.matic.today',\n      parentProvider: 'https://rpc.goerli.mudit.blog',\n      parentDefaultOptions: {\n        from: '0x9aCd457193F4788Ef7989c88dA89DF7b2754670c',\n      },\n      maticDefaultOptions: {\n        from: '0x54aff400858Dcac39797a81894D9920f16972D1D',\n      },\n      maticClient: MaticClients.PoS\n    })\n  ],\n  ...\n})\nclass MyModule {}\n```\n\n### Asynchronous configuration\n\nWith `MaticModule.forRootAsync` allows you, for example, inject `ConfigService` to use it in Nest `useFactory` method.\n\n`useFactory` should return object with [Options interface](#configuration-params).\n\n```ts\nimport { MaticModule } from 'nestjs-matic';\nimport { MaticClients, MaticNetworks, MaticVersions } from 'nestjs-matic/dist/matic.interface';\n\n@Injectable()\nclass ConfigService {\n  public readonly network = MaticNetworks.Testnet;\n  public readonly version = MaticVersions.Mumbai;\n  public readonly maticProvider = 'https://rpc-mumbai.matic.today';\n  public readonly parentProvider = 'https://rpc.goerli.mudit.blog';\n  public readonly maticDefaultOptions = { from '0x....' };;\n}\n\n@Module({\n  providers: [ConfigService],\n  exports: [ConfigService]\n})\nclass ConfigModule {}\n\n@Module({\n  imports: [\n    MaticModule.forRootAsync({\n      imports: [ConfigModule],\n      inject: [ConfigService],\n      useFactory: async (config: ConfigService) =\u003e {\n        await somePromise();\n\n        return {\n          network: config.network,\n          version: config.version,\n          maticProvider: config.maticProvider,\n          parentProvider: config.parentProvider,\n          maticDefaultOptions: config.maticDefaultOptions,\n          parentDefaultOptions: config.maticDefaultOptions,\n          maticClient: MaticClients.PoS,\n        };\n      },\n    }),\n  ],\n  ...\n})\nclass TestModule {}\n```\n\nOr you can just pass `ConfigService` to `providers`, if you don't have any `ConfigModule`:\n\n```ts\nimport {\n  MaticModule,\n  MaticNetworks,\n  MaticVersions,\n} from 'nestjs-matic';\n\n@Injectable()\nclass ConfigService {\n  public readonly network = MaticNetworks.Testnet;\n  public readonly version = MaticVersions.Mumbai;\n  public readonly maticProvider = 'https://rpc-mumbai.matic.today';\n  public readonly parentProvider = 'https://rpc.goerli.mudit.blog';\n  public readonly maticDefaultOptions = { from '0x....' };\n}\n\n@Module({\n  imports: [\n    MaticModule.forRootAsync({\n      providers: [ConfigService],\n      inject: [ConfigService],\n      useFactory: (config: ConfigService) =\u003e {\n        return {\n          network: config.network,\n          version: config.version,\n          maticProvider: config.maticProvider,\n          parentProvider: config.parentProvider,\n          maticDefaultOptions: config.maticDefaultOptions,\n          parentDefaultOptions: config.maticDefaultOptions,\n          maticClient: MaticClients.PoS,\n        };\n      }\n    })\n  ],\n  controllers: [TestController]\n})\nclass MyModule {}\n```\n\n## MaticClients\n\n-  `MaticPlasmaClient` implements standard [PlasmaClient](https://maticnetwork.github.io/matic.js/docs/plasma/initialize).\n-  `MaticPOSClient` implements standard [POSClient](https://maticnetwork.github.io/matic.js/docs/pos/initialize).\n\nIf you are familiar with it, you are ready to go.\n\n```ts\nimport { InjectMaticProvider, MaticPOSClient } from 'nestjs-matic';\n\n@Injectable()\nexport class TestService {\n  constructor(\n    @InjectMaticProvider()\n    private readonly maticClient: MaticPOSClient,\n  ) {}\n  async someMethod(): Promise\u003c{ nftBalance: string }\u003e {\n    const nftBalance: number = await this.maticClient.balanceOfERC721('0x....', '0x....')\n\n    return { nftBalance: nftBalance.toString() };\n  }\n}\n```\n\n## Testing a class that uses @InjectMaticProvider\n\nThis package exposes a `getMaticToken()` function that returns a prepared injection token based on the provided context.\nUsing this token, you can easily provide a mock implementation of the [SDKClient](https://github.com/maticnetwork/matic.js/blob/master/src/common/SDKClient.ts) using any of the standard custom provider techniques, including useClass, useValue, and useFactory.\n\n```ts\nconst module: TestingModule = await Test.createTestingModule({\n  providers: [\n    MyService,\n    {\n      provide: getMaticToken(),\n      useValue: mockProvider,\n    },\n  ],\n}).compile();\n```\n\n## Change Log\n\nSee [Changelog](CHANGELOG.md) for more information.\n\n## Contributing\n\nContributions welcome! See [Contributing](CONTRIBUTING.md).\n\n## Collaborators\n\n* [__Jose Ramirez__](https://github.com/0xslipk)\n* [__Ana Riera__](https://github.com/AnnRiera)\n\n## License\n\nLicensed under the Apache 2.0 - see the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblockcoders%2Fnestjs-matic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblockcoders%2Fnestjs-matic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblockcoders%2Fnestjs-matic/lists"}