Monerium connects your web3 wallet to any euro bank account with your personal IBAN.
All incoming euro payments are automatically minted as EURe tokens to your wallet.
Sending EURe to traditional bank accounts is just as easy.
With a single signature from your wallet, your EURe is burned and sent as Euros to any bank account.
We recommend starting in the Developer Portal. There, you will learn more about client_id's and ways of authenticating.
Initialize and authenticate using Client Credentials
Client Credentials is used when there's no need for user interaction, and the system-to-system interaction requires authentication.
import { MoneriumClient } from'@monerium/sdk';
// Initialize the client with credentialsconst monerium = newMoneriumClient({
environment: 'sandbox',
clientId: 'your_client_credentials_uuid', // replace with your client IDclientSecret: 'your_client_secret', // replace with your client secret
});
await monerium.getAccess();
// Retrieve authentication data after successful authentication.await monerium.getAuthContext();
// Access tokens are now available for use.const { access_token, refresh_token } = monerium.bearerProfileasBearerProfile;
Initialize and authenticate using Authorization Code Flow with PKCE
Authorization Code Flow with PKCE is used for apps where direct user interaction is involved, and the application is running on an environment where the confidentiality of a secret cannot be safely maintained. It allows the application to authorize users without handling their passwords and mitigates the additional risk involved in this sort of delegation.
First, you have to navigate the user to the Monerium authentication flow. This can be done by generating a URL and redirecting the user to it. After the user has authenticated, Monerium will redirect back to your specified URI with a code. You can then finalize the authentication process by exchanging the code for access and refresh tokens.
// Get all profiles for the authenticated user.constauthCtx: AuthContext = await monerium.getAuthContext();
// Fetching all accounts for a specific profileconst { id: profileId, accounts }: Profile = await monerium.getProfile(
authCtx.profiles[0].id
);
// Fetching all balances for a specific profileconstbalances: Balances = await monerium.getBalances(profileId);
It's important to understand when interacting with a blockchain, the user needs to provide a signature in their wallet.
This signature is used to verify that the user is the owner of the wallet address.
import { constants } from'@monerium/sdk';
import { walletClient } from'...'// See Viem documentationconst { LINK_MESSAGE } = constants; // "I hereby declare that I am the address owner."// Send a signature request to the wallet.const signature = await walletClient.signMessage({
message: LINK_MESSAGE,
})
// Link a new address to Monerium and create accounts for ethereum and gnosis.await monerium.linkAddress(profileId, {
address: '0xUserAddress72413Fa92980B889A1eCE84dD', // user wallet addressmessage: LINK_MESSAGE
signature,
accounts: [
{"currency":"eur","chain":"ethereum"},
{"currency":"eur","chain":"gnosis"}
],
} asLinkAddress);
// Get orders for a specific profileconstorders: Order[] = await monerium.getOrders(profileId);
// Place a redeem orderimport { placeOrderMessage } from'@monerium/sdk';
import { walletClient } from'...'; // See Viem documentationconst amount = '100'; // replace with the amount in EURconst iban = 'EE12341234123412341234'; // replace with requested IBAN// First you have to form the message that will be signed by the userconst message = placeOrderMessage(amount, 'eur', iban);
// The message should look like this, with the current date and time in RFC3339 format:// Send EUR 100 to EE12341234123412341234 at Thu, 29 Dec 2022 14:58:29Z// Send a signature request to the wallet.const signature = await walletClient.signMessage({
message: message,
});
// Place the orderconst order = await monerium.placeOrder({
amount,
signature,
currency: 'eur',
address: '0xUserAddress72413Fa92980B889A1eCE84dD', // user wallet addresscounterpart: {
identifier: {
standard: 'iban', // PaymentStandard.iban,
iban,
},
details: {
firstName: 'User',
lastName: 'Userson',
county: 'IS',
},
},
message,
memo: 'Powered by Monerium SDK',
chain: 'ethereum',
network: 'sepolia',
// supportingDocumentId, see below
});
When placing orders with payouts above 15,000 EUR, a supporting document is required. The document must be uploaded to Monerium before the order can be placed. Supporting documents can be an invoice or an agreement.
// Upload a supporting documentconstsupportingDocumentId: SupportingDoc =
awaituploadSupportingDocument(document);
We are using commitlint to enforce that developers format the commit messages according to the Conventional Commits guidelines.
We are using PNPM as a package manager.
Development mode
pnpm dev
While in development mode, TypeScript declaration maps (.d.ts.map) are generated. TypeScript declaration maps are mainly used to quickly jump to type definitions in the context of a monorepo.
When changes are merged to the main branch that follows the conventional commits standard, release-please workflow creates a pull request, preparing for the next release. If kept open, the following commits will also be added to the PR. Merging that PR will create a new release, a workflow will publish it on NPM and tag it on Github.
FAQs
Common questions developers have regarding the SDK.
Essential tools to interact with the Monerium API, an electronic money issuer.
The npm package @monerium/sdk receives a total of 210 weekly downloads. As such, @monerium/sdk popularity was classified as not popular.
We found that @monerium/sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.It has 0 open source maintainers collaborating on the project.
Package last updated on 16 Aug 2024
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."