{"id":51220937,"url":"https://github.com/tetherto/wdk-protocol-fiat-moonpay","last_synced_at":"2026-06-28T07:03:05.174Z","repository":{"id":365238949,"uuid":"1103203464","full_name":"tetherto/wdk-protocol-fiat-moonpay","owner":"tetherto","description":null,"archived":false,"fork":false,"pushed_at":"2026-06-16T12:32:29.000Z","size":400,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-16T14:22:48.275Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/tetherto.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-24T15:05:53.000Z","updated_at":"2026-06-16T12:32:26.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/tetherto/wdk-protocol-fiat-moonpay","commit_stats":null,"previous_names":["tetherto/wdk-protocol-fiat-moonpay"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/tetherto/wdk-protocol-fiat-moonpay","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tetherto%2Fwdk-protocol-fiat-moonpay","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tetherto%2Fwdk-protocol-fiat-moonpay/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tetherto%2Fwdk-protocol-fiat-moonpay/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tetherto%2Fwdk-protocol-fiat-moonpay/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tetherto","download_url":"https://codeload.github.com/tetherto/wdk-protocol-fiat-moonpay/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tetherto%2Fwdk-protocol-fiat-moonpay/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34880191,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-28T02:00:05.809Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2026-06-28T07:03:04.222Z","updated_at":"2026-06-28T07:03:05.157Z","avatar_url":"https://github.com/tetherto.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @tetherto/wdk-protocol-fiat-moonpay\n\nNote: This package is in beta. Please test in a dev setup first.\n\nA simple way to integrate MoonPay widget for on-ramp and off-ramp services. You can generate signed or unsigned URLs for the MoonPay widget, get quotes for buying and selling crypto, and read protocol-related data. This package can be used in both frontend and backend environments.\n\n## 🔍 About WDK\n\nThis is part of WDK (Wallet Development Kit). WDK helps you build safe, non‑custody wallets. Read more at https://docs.wallet.tether.io.\n\n## 🌟 Features\n\n- Generate signed or unsigned widget URL to buy Crypto (On-ramp)\n- Generate signed or unsigned widget URL to sell Crypto (Off-ramp)\n- Get quotes (buy and sell)\n- Get supported currencies, countries\n- Get buy/sell transaction details\n\n## ⬇️ Installation\n\n```bash\nnpm install @tetherto/wdk-protocol-fiat-moonpay\n```\n\n## 🚀 Quick Start\n\n### Basic Usage\n\n```javascript\nimport MoonPayProtocol from '@tetherto/wdk-protocol-fiat-moonpay'\n\nconst signUrl = async (urlForSignature) =\u003e {\n  const response = await fetch('https://your-backend.example.com/moonpay/sign-url', {\n    method: 'POST',\n    headers: {\n      'Content-Type': 'application/json'\n    },\n    body: JSON.stringify({ urlForSignature })\n  })\n\n  if (!response.ok) {\n    throw new Error(`Failed to sign MoonPay URL: ${response.status} ${response.statusText}`)\n  }\n\n  const { signedUrl } = await response.json()\n\n  return signedUrl\n}\n\n// Initialize protocol\nconst moonpay = new MoonPayProtocol(undefined, {\n  apiKey: 'YOUR_PUBLISHABLE_API_KEY',\n  signUrl,\n  environment: 'sandbox'\n})\n\n// Get a buy quote\nconst buyQuote = await moonpay.quoteBuy({\n  fiatCurrency: 'usd',\n  cryptoAsset: 'eth',\n  fiatAmount: 100\n})\n\n// Generate a buy widget URL\nconst { buyUrl } = await moonpay.buy({\n  fiatCurrency: 'usd',\n  cryptoAsset: 'eth',\n  fiatAmount: 100,\n  recipient: '0xabc'\n})\n\nconsole.log('Buy URL:', buyUrl)\n\n// Get a sell quote\nconst sellQuote = await moonpay.quoteSell({\n  fiatCurrency: 'usd',\n  cryptoAsset: 'eth',\n  cryptoAmount: 100\n})\n\n// Generate a sell widget URL\nconst { sellUrl } = await moonpay.sell({\n  fiatCurrency: 'usd',\n  cryptoAsset: 'eth',\n  cryptoAmount: 100,\n  refundAddress: '0xabc'\n})\n```\n\n## 📚 API Reference\n\n### MoonPayProtocol\n\nMain class for MoonPay integration.\n\n#### Constructor\n\n```javascript\nnew MoonPayProtocol(account, config)\n```\n\nParameters:\n- `account` (IWalletAccount | IWalletAccountReadOnly | undefined): The wallet account to use to interact with the protocol\n- `config` (object): The protocol config\n  - `apiKey` (string): Your publishable Moonpay API key.\n  - `signUrl` (function, optional): Callback used to sign buy/sell URLs via a trusted provider (e.g., a backend service). If not provided, the protocol returns unsigned URLs.\n  - `cacheTime` (number, optional): The duration in milliseconds to cache supported currencies.\n  - `environment` (\"production\" | \"sandbox\", optional): The environment to use for MoonPay endpoints and widget URLs. Defaults to \"production\". Use \"production\" for live transactions and \"sandbox\" for testing with non-real funds.\n\n### Methods\n\n| Method | Description | Returns |\n|--------|-------------|---------|\n| `buy(options)` | Generates a widget URL to purchase crypto | `Promise\u003cBuyResult\u003e` |\n| `sell(options)` | Generates a widget URL to sell crypto | `Promise\u003cSellResult\u003e` |\n| `quoteBuy(options)` | Gets a quote for a crypto asset purchase | `Promise\u003cMoonPayBuyQuote\u003e` |\n| `quoteSell(options)` | Gets a quote for a crypto asset sale | `Promise\u003cMoonPaySellQuote\u003e` |\n| `getTransactionDetail(txId, direction)` | Retrieves the details of a transaction | `Promise\u003cMoonPayTransactionDetail\u003e` |\n| `getSupportedCryptoAssets()` | Retrieves a list of supported crypto assets | `Promise\u003cMoonPaySupportedCryptoAsset[]\u003e` |\n| `getSupportedFiatCurrencies()` | Retrieves a list of supported fiat currencies | `Promise\u003cMoonPaySupportedFiatCurrency[]\u003e` |\n| `getSupportedCountries()` | Retrieves a list of supported countries | `Promise\u003cMoonPaySupportedCountry[]\u003e` |\n\n#### `buy(options)`\nGenerates a widget URL to purchase crypto.\n\nOptions:\n- `fiatCurrency` (string): The fiat currency code (e.g., 'usd').\n- `cryptoAsset` (string): The crypto asset code (e.g., 'eth').\n- `fiatAmount` (number, optional): The amount in fiat currency.\n- `cryptoAmount` (number, optional): The amount in crypto asset.\n- `recipient` (string, optional): The wallet address to receive funds. If not provided, uses the account address.\n- `config` (object, optional): Additional MoonPay widget parameters.\n\n#### `sell(options)`\nGenerates a widget URL to sell crypto.\n\nOptions:\n- `fiatCurrency` (string): The fiat currency code (e.g., 'usd').\n- `cryptoAsset` (string): The crypto asset code (e.g., 'eth').\n- `fiatAmount` (number, optional): The amount in fiat currency.\n- `cryptoAmount` (number, optional): The amount in crypto asset.\n- `refundAddress` (string, optional): The wallet address for refunds. If not provided, uses the account address.\n- `config` (object, optional): Additional MoonPay widget parameters.\n\n#### `quoteBuy(options)`\nGets a quote for a crypto asset purchase.\n\nOptions:\n- `fiatCurrency` (string): The fiat currency code.\n- `cryptoAsset` (string): The crypto asset code.\n- `fiatAmount` (number, optional): The amount in fiat currency.\n- `cryptoAmount` (number, optional): The amount in crypto asset.\n- `config` (object, optional): Additional MoonPay quote parameters.\n\n#### `quoteSell(options)`\nGets a quote for a crypto asset sale.\n\nOptions:\n- `fiatCurrency` (string): The fiat currency code.\n- `cryptoAsset` (string): The crypto asset code.\n- `cryptoAmount` (number): The amount in crypto asset (Required).\n- `config` (object, optional): Additional MoonPay quote parameters.\n\n#### `getTransactionDetail(txId, direction)`\nRetrieves the details of a transaction.\n\nParameters:\n- `txId` (string): The transaction ID.\n- `direction` ('buy' | 'sell'): The direction of the transaction. Defaults to 'buy'.\n\n#### `getSupportedCryptoAssets()`\nRetrieves a list of supported crypto assets.\n\n#### `getSupportedFiatCurrencies()`\nRetrieves a list of supported fiat currencies.\n\n#### `getSupportedCountries()`\nRetrieves a list of supported countries.\n\n## 📝 Notes\n\n- Works with networks and currencies supported by MoonPay.\n- Check MoonPay documentation for the full list of widget parameters, supported cryptocurrencies and regions.\n- The package provides the baseline for MoonPay integration. To fully utilize the power of MoonPay widget, take a look at [MoonPay documentation](https://dev.moonpay.com/docs/ramps-sdk-buy-params) for the full list of parameters.\n- The `apiKey` can be retrieved through [MoonPay dashboard](https://dashboard.moonpay.com/).\n- It is highly recommended to test the entire buy/sell flow in the `sandbox` environment. Read more [here](https://dev.moonpay.com/docs/faq-sandbox-testing).\n\n## 🔒 Security Considerations\n\n- Keep your `secretKey` safe on your backend. Expose a backend signing API to clients, and have `signUrl` call that API to retrieve the signed MoonPay URL.\n\n## 🛠️ Development\n\n### Building\n\n```bash\n# Install dependencies\nnpm install\n\n# Build TypeScript definitions\nnpm run build:types\n\n# Lint code\nnpm run lint\n\n# Fix linting issues\nnpm run lint:fix\n```\n\n### Testing\n\n```bash\n# Run tests\nnpm test\n\n# Run tests with coverage\nnpm run test:coverage\n```\n\n## 📜 License\n\nThis project is licensed under the Apache License 2.0 - see the LICENSE file for details.\n\n## 🤝 Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## 🆘 Support\n\nFor support, please open an issue on the GitHub repository.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftetherto%2Fwdk-protocol-fiat-moonpay","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftetherto%2Fwdk-protocol-fiat-moonpay","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftetherto%2Fwdk-protocol-fiat-moonpay/lists"}