Skip to content

butaneprotocol/translucent-compat

Repository files navigation

Translucent-compat

Translucent was a fork of the Lucid library. It is **deprecated** in favour of blaze

Get started

Bun

Development happens in bun. We use bun build:wasm, bun test. If you want to contribute to translucent, please do so with bun. Translucent can be used from any other js runtime.

NPM

npm install translucent-cardano

Vite packaging

Use polyfills to make translucent run in the browser.

(these polyfills are preliminary and we should package translucent for the browser)

resolve: {
		alias: {
			'node-fetch': 'node-fetch-polyfill',
			'sha256': 'tiny-sha256',
			'@sinclair/typebox': '@sinclair/typebox',
			'@dcspark/cardano-multiplatform-lib-nodejs': '@dcspark/cardano-multiplatform-lib-browser',
			'uplc-node': 'translucent/uplc/pkg-web',
			'@emurgo/cardano-message-signing-nodejs': '@emurgo/cardano-message-signing-browser',
		}
	},
optimizeDeps: {
		exclude: ['translucent', 'typebox'],
    ...
	},

Deno

... how to use translucent in deno ...

Basic usage

import { Maestro, Translucent } from "translucent-cardano";

const translucent = await Translucent.new(
  new Maestro({
    network: "Mainnet",
    apiKey: "<apikey>",
    turboSubmit: true,
  }),
  "Mainnet",
);

// Assumes you are in a browser environment
const api = await window.cardano.nami.enable();
translucent.selectWallet(api);

const tx = await translucent
  .newTx()
  .payToAddress("addr...", { lovelace: 5000000n })
  .complete();

const signedTx = await tx.sign().complete();

const txHash = await signedTx.submit();

console.log(txHash);

Join us on Discord!