To unlock the most out of your Crossmark, you can elect to directly install our SDK which is typesafe and backwards-compatible with older versions of the wallet.
To install our sdk package, run one of the following commands,
npm install @crossmarkio/sdk
Great! Now anytime you need to use Crossmark, just import us at to top of your code!
import sdk from '@crossmarkio/sdk';
If you are not building a project with package support, you can inject our package directly into the HTML.
<script type="module" src="https://unpkg.com/@crossmarkio/sdk"></script>
See here (opens in a new tab) for an implementation our CDN written in plain, vanillaJS.
For the quickest and most light-weight intergration, you can access the Crossmark SDK directly in the window object.
Crossmark utilizes the window objects for easier integration with the platform. When a user installs the Crossmark browser extension on their device, every new page will automatically have the Crossmark SDK within the root window object. In other words, if Crossmark is installed, you as the developer will have full-access to the Crossmark SDK without the need to install any third-party packages.
const sdk = window.xrpl.crossmark; const detect = window.xrpl.isCrossmark;
Now that the sdk in instantiated from the window root, you can use just like the npm package.
Crossmark wallet also injects some other useful utilities. If crossmark is installed, developers will have access to a lightweight version of xrpl.js (opens in a new tab).
Try accessing it and using in place of a package manager
const xrpl = window.xrpl.js;
Also, developer will have access to xDir (opens in a new tab). A simple directory of networks available the xrp ledger, or protocol compatible.
const xdir = window.xrpl.xdir;