@transak/transak-sdk
Advanced tools
Comparing version 1.4.1 to 2.0.0-rc.0
{ | ||
"name": "@transak/transak-sdk", | ||
"version": "1.4.1", | ||
"description": "Transak SDK that allows you to easily integrate the fiat on/ramp", | ||
"main": "dist/sdk.js", | ||
"version": "2.0.0-rc.0", | ||
"description": "Transak SDK that allows you to easily integrate fiat on/off ramp", | ||
"type": "module", | ||
"types": "lib/index.d.ts", | ||
"main": "lib/index.cjs", | ||
"exports": { | ||
".": { | ||
"import": { | ||
"types": "./lib/index.d.ts", | ||
"default": "./lib/index.js" | ||
}, | ||
"require": { | ||
"types": "./lib/index.d.cts", | ||
"default": "./lib/index.cjs" | ||
} | ||
} | ||
}, | ||
"files": [ | ||
"lib/**/*" | ||
], | ||
"engines": { | ||
"node": ">=16.0.0" | ||
}, | ||
"scripts": { | ||
"eslint": "eslint . --ext .js,.jsx,.ts,.tsx", | ||
"eslint": "eslint . --ext .ts", | ||
"eslint:fix": "yarn eslint --fix", | ||
"build": "browserify ./src/index.js -o ./dist/sdk.js -p esmify -s TransakSDK" | ||
"build": "tsc && tsup", | ||
"prepack": "yarn run build" | ||
}, | ||
"author": "Transak", | ||
"license": "ISC", | ||
"repository": { | ||
"url": "https://github.com/Transak/transak-sdk" | ||
}, | ||
"engines": { | ||
"node": ">=10.0.0" | ||
}, | ||
"author": "Transak", | ||
"license": "ISC", | ||
"keywords": [ | ||
"crypto", | ||
"cryptocurrency", | ||
"fiat", | ||
"on", | ||
"off", | ||
"ramp" | ||
], | ||
"dependencies": { | ||
"@types/events": "^3.0.1", | ||
"events": "^3.3.0", | ||
"pako": "^2.1.0", | ||
"query-string": "^8.1.0" | ||
}, | ||
"devDependencies": { | ||
"@typescript-eslint/eslint-plugin": "^6.7.0", | ||
"@typescript-eslint/parser": "^6.7.0", | ||
"browserify": "^17.0.0", | ||
"eslint": "^8.49.0", | ||
"@types/pako": "^2.0.1", | ||
"@typescript-eslint/eslint-plugin": "^6.7.4", | ||
"@typescript-eslint/parser": "^6.7.4", | ||
"eslint": "^8.50.0", | ||
"eslint-config-airbnb-base": "^15.0.0", | ||
@@ -44,19 +56,18 @@ "eslint-config-airbnb-typescript": "^17.1.0", | ||
"eslint-plugin-promise": "^6.1.1", | ||
"eslint-plugin-testing-library": "^6.0.1", | ||
"eslint-plugin-vitest": "^0.3.1", | ||
"esmify": "^2.1.1", | ||
"typescript": "^5.2.2" | ||
"eslint-plugin-testing-library": "^6.0.2", | ||
"eslint-plugin-vitest": "^0.3.2", | ||
"prettier": "^3.0.3", | ||
"tsup": "^7.2.0", | ||
"typescript": "^5.2.2", | ||
"vitest": "^0.34.6" | ||
}, | ||
"browserslist": { | ||
"production": [ | ||
">0.2%", | ||
"not dead", | ||
"not op_mini all" | ||
], | ||
"development": [ | ||
"last 1 chrome version", | ||
"last 1 firefox version", | ||
"last 1 safari version" | ||
] | ||
} | ||
"keywords": [ | ||
"crypto", | ||
"cryptocurrency", | ||
"fiat", | ||
"on", | ||
"off", | ||
"ramp" | ||
], | ||
"packageManager": "yarn@3.6.3" | ||
} |
# Transak SDK | ||
A JavaScript library for decentralised applications to onboard their global user base with fiat currency. | ||
A library for decentralised applications to onboard their global user base with fiat currency. | ||
@@ -17,18 +17,18 @@ ## Installation | ||
Refer here for the full list of [customisation options](https://docs.transak.com/docs/query-parameters) | ||
```ts | ||
import { TransakConfig, Transak } from '@transak/transak-sdk'; | ||
```js | ||
import transakSDK from '@transak/transak-sdk'; | ||
let transak = new transakSDK({ | ||
const transakConfig: TransakConfig = { | ||
apiKey: '<your-api-key>', // (Required) | ||
environment: '<environment: STAGING/PRODUCTION>', // (Required) | ||
environment: Transak.ENVIRONMENTS.STAGING/Transak.ENVIRONMENTS.PRODUCTION, // (Required) | ||
// ..... | ||
// For the full list of customisation options check the link above | ||
}); | ||
// For the full list of customisation options check the link below | ||
}; | ||
let transak = new Transak(transakConfig); | ||
transak.init(); | ||
// To get all the events | ||
transak.on(transak.ALL_EVENTS, (data) => { | ||
Transak.on('*', (data) => { | ||
console.log(data); | ||
@@ -38,9 +38,21 @@ }); | ||
// This will trigger when the user closed the widget | ||
transak.on(transak.EVENTS.TRANSAK_WIDGET_CLOSE, (orderData) => { | ||
transak.close(); | ||
Transak.on(Transak.EVENTS.TRANSAK_WIDGET_CLOSE, () => { | ||
console.log('Transak SDK closed!'); | ||
}); | ||
// This will trigger when the user marks payment is made | ||
transak.on(transak.EVENTS.TRANSAK_ORDER_SUCCESSFUL, (orderData) => { | ||
/* | ||
* This will trigger when the user has confirmed the order | ||
* This doesn't guarantee that payment has completed in all scenarios | ||
* If you want to close/navigate away, use the TRANSAK_ORDER_SUCCESSFUL event | ||
*/ | ||
Transak.on(Transak.EVENTS.TRANSAK_ORDER_CREATED, (orderData) => { | ||
console.log(orderData); | ||
}); | ||
/* | ||
* This will trigger when the user marks payment is made | ||
* You can close/navigate away at this event | ||
*/ | ||
Transak.on(Transak.EVENTS.TRANSAK_ORDER_SUCCESSFUL, (orderData) => { | ||
console.log(orderData); | ||
transak.close(); | ||
@@ -50,2 +62,8 @@ }); | ||
For in-depth instructions on integrating Transak, view [our complete documentation.](https://docs.transak.com) | ||
Refer here for the full list of [customisation options](https://docs.transak.com/docs/query-parameters) | ||
For in-depth instructions on integrating Transak, view [our complete documentation.](https://docs.transak.com/docs/integration-options) | ||
## Migration Guide for v2 | ||
[This guide](https://github.com/Transak/transak-sdk/wiki/Migration-Guide-for-v2) will help you to upgrade to v2 successfully! |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
67
1
Yes
51516
4
18
8
265
3
1
+ Added@types/events@^3.0.1
+ Addedpako@^2.1.0
+ Added@types/events@3.0.3(transitive)
+ Addedpako@2.1.0(transitive)