Installation
Adding Mailchain to your application is easy. Mailchain's SDK makes interacting with the Mailchain protocol simple. Using the SDK you will be able to send, receive (coming soon... for now you can view replies in https://app.mailchain.com) and register addresses (coming soon).
To add Mailchain's SDK to your application install via your package manager of choice.
- npm
- yarn
npm install @mailchain/sdk
yarn add @mailchain/sdk
Browser support​
As Mailchain SDK is to be run primary by Node applications, it requires some polyfills to be used in the browser. Depending on your setup, you may need to polyfill Buffer, crypto and stream.
- Webpack 5
- Vite
yarn add crypto-browserify stream-browserify
npm install crypto-browserify stream-browserify
// webpack.config.js
const webpack = require('webpack');
module.exports = {
// ...
resolve: {
fallback: {
crypto: require.resolve('crypto-browserify'),
stream: require.resolve('stream-browserify'),
},
},
plugins: [
// ...
new webpack.ProvidePlugin({
Buffer: ['buffer', 'Buffer'],
}),
],
};
yarn add -D vite-plugin-node-polyfills
npm install --save-dev vite-plugin-node-polyfills
module.exports = defineConfig({
// ...
plugins: [
// ...
nodePolyfills({
include: ['buffer', 'crypto', 'stream'],
}),
],
});