Skip to content

Commit

Permalink
Rebuild artifact
Browse files Browse the repository at this point in the history
  • Loading branch information
infrmtcs committed Oct 18, 2024
1 parent 299652e commit 913ebc7
Show file tree
Hide file tree
Showing 399 changed files with 226,002 additions and 0 deletions.
4 changes: 4 additions & 0 deletions dist/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
src/
test_runner.js
yarn.lock
pnpm-lock.yaml
21 changes: 21 additions & 0 deletions dist/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 Alessandro Konrad

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
157 changes: 157 additions & 0 deletions dist/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
<p align="center">
<img width="100px" src="./logo/lucid.svg" align="center"/>
<h1 align="center">Lucid</h1>
<p align="center">Lucid is a library, which allows you to create Cardano transactions and off-chain code for your Plutus contracts in JavaScript, Deno and Node.js.</p>

<p align="center">
<img src="https://img.shields.io/github/commit-activity/m/berry-pool/lucid?style=for-the-badge" />
<a href="https://www.npmjs.com/package/lucid-cardano">
<img src="https://img.shields.io/npm/v/lucid-cardano?style=for-the-badge" />
</a>
<a href="https://doc.deno.land/https://deno.land/x/lucid/mod.ts">
<img src="https://img.shields.io/readthedocs/cardano-lucid?style=for-the-badge" />
</a>
<a href="https://www.npmjs.com/package/lucid-cardano">
<img src="https://img.shields.io/npm/dw/lucid-cardano?style=for-the-badge" />
</a>
<img src="https://img.shields.io/npm/l/lucid-cardano?style=for-the-badge" />
<a href="https://twitter.com/spacebudzNFT">
<img src="https://img.shields.io/twitter/follow/spacebudzNFT?style=for-the-badge&logo=twitter" />
</a>
</p>

</p>

### Get started

#### NPM

```
npm install lucid-cardano
```

#### Deno 🦕

For JavaScript and TypeScript

```js
import { Lucid } from "https://deno.land/x/[email protected]/mod.ts";
```

#### Web

```html
<script type="module">
import { Lucid } from "https://unpkg.com/[email protected]/web/mod.js"
// ...
</script>
```

###

### Build from source

Build NPM and Web target

```
deno task build
```

Outputs a `dist` folder

### Examples

- [Basic examples](./src/examples/)
- [Next.js Blockfrost Proxy API Example](https://github.com/GGAlanSmithee/cardano-lucid-blockfrost-proxy-example)

### Basic usage

```js
// import { Blockfrost, Lucid } from "https://deno.land/x/[email protected]/mod.ts"; Deno
import { Blockfrost, Lucid } from "lucid-cardano"; // NPM

const lucid = await Lucid.new(
new Blockfrost("https://cardano-preview.blockfrost.io/api/v0", "<projectId>"),
"Preview",
);

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

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

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

const txHash = await signedTx.submit();

console.log(txHash);
```

### Test

```
deno task test
```

### Build Core

This library is built on top of a customized version of the serialization-lib
(cardano-multiplatform-lib) and on top of the message-signing library, which are
written in Rust.

```
deno task build:core
```

### Test Core

```
deno task test:core
```

### Docs

[View docs](https://doc.deno.land/https://deno.land/x/lucid/mod.ts) 📖

You can generate documentation with:

```
deno doc
```

### Compatibility

Lucid is an ES Module, so to run it in the browser any bundler which allows for
top level await and WebAssembly is recommended. If you use Webpack 5 enable in
the `webpack.config.js`:

```
experiments: {
asyncWebAssembly: true,
topLevelAwait: true,
layers: true // optional, with some bundlers/frameworks it doesn't work without
}
```

To run the library in Node.js you need to set `{"type" : "module"}` in your
project's `package.json`. Otherwise you will get import issues.

### Contributing

Contributions and PRs are welcome!\
The [contribution instructions](./CONTRIBUTING.md).

Join us on [Discord](https://discord.gg/82MWs63Tdm)!

### Use Lucid with React

[use-cardano](https://use-cardano.alangaming.com/) a React context, hook and set
of components built on top of Lucid.

### Use Lucid with Next.js

[Cardano Starter Kit](https://cardano-starter-kit.alangaming.com/) a Next.js
starter kit for building Cardano dApps.
11 changes: 11 additions & 0 deletions dist/esm/_dnt.polyfills.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
declare global {
interface Object {
/**
* Determines whether an object has a property with the specified name.
* @param o An object.
* @param v A property name.
*/
hasOwn(o: object, v: PropertyKey): boolean;
}
}
export {};
15 changes: 15 additions & 0 deletions dist/esm/_dnt.polyfills.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// https://github.com/tc39/proposal-accessible-object-hasownproperty/blob/main/polyfill.js
if (!Object.hasOwn) {
Object.defineProperty(Object, "hasOwn", {
value: function (object, property) {
if (object == null) {
throw new TypeError("Cannot convert undefined or null to object");
}
return Object.prototype.hasOwnProperty.call(Object(object), property);
},
configurable: true,
enumerable: false,
writable: true,
});
}
export {};
44 changes: 44 additions & 0 deletions dist/esm/deps/deno.land/[email protected]/encoding/hex.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/**
* ErrInvalidByte takes an invalid byte and returns an Error.
* @param byte
*/
export declare function errInvalidByte(byte: number): Error;
/** ErrLength returns an error about odd string length. */
export declare function errLength(): Error;
/**
* EncodedLen returns the length of an encoding of n source bytes. Specifically,
* it returns n * 2.
* @param n
*/
export declare function encodedLen(n: number): number;
/**
* Encode encodes `src` into `encodedLen(src.length)` bytes.
* @param src
*/
export declare function encode(src: Uint8Array): Uint8Array;
/**
* EncodeToString returns the hexadecimal encoding of `src`.
* @param src
*/
export declare function encodeToString(src: Uint8Array): string;
/**
* Decode decodes `src` into `decodedLen(src.length)` bytes
* If the input is malformed an error will be thrown
* the error.
* @param src
*/
export declare function decode(src: Uint8Array): Uint8Array;
/**
* DecodedLen returns the length of decoding `x` source bytes.
* Specifically, it returns `x / 2`.
* @param x
*/
export declare function decodedLen(x: number): number;
/**
* DecodeString returns the bytes represented by the hexadecimal string `s`.
* DecodeString expects that src contains only hexadecimal characters and that
* src has even length.
* If the input is malformed, DecodeString will throw an error.
* @param s the `string` to decode to `Uint8Array`
*/
export declare function decodeString(s: string): Uint8Array;
99 changes: 99 additions & 0 deletions dist/esm/deps/deno.land/[email protected]/encoding/hex.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
// Ported from Go
// https://github.com/golang/go/blob/go1.12.5/src/encoding/hex/hex.go
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
const hexTable = new TextEncoder().encode("0123456789abcdef");
/**
* ErrInvalidByte takes an invalid byte and returns an Error.
* @param byte
*/
export function errInvalidByte(byte) {
return new Error("encoding/hex: invalid byte: " +
new TextDecoder().decode(new Uint8Array([byte])));
}
/** ErrLength returns an error about odd string length. */
export function errLength() {
return new Error("encoding/hex: odd length hex string");
}
// fromHexChar converts a hex character into its value.
function fromHexChar(byte) {
// '0' <= byte && byte <= '9'
if (48 <= byte && byte <= 57)
return byte - 48;
// 'a' <= byte && byte <= 'f'
if (97 <= byte && byte <= 102)
return byte - 97 + 10;
// 'A' <= byte && byte <= 'F'
if (65 <= byte && byte <= 70)
return byte - 65 + 10;
throw errInvalidByte(byte);
}
/**
* EncodedLen returns the length of an encoding of n source bytes. Specifically,
* it returns n * 2.
* @param n
*/
export function encodedLen(n) {
return n * 2;
}
/**
* Encode encodes `src` into `encodedLen(src.length)` bytes.
* @param src
*/
export function encode(src) {
const dst = new Uint8Array(encodedLen(src.length));
for (let i = 0; i < dst.length; i++) {
const v = src[i];
dst[i * 2] = hexTable[v >> 4];
dst[i * 2 + 1] = hexTable[v & 0x0f];
}
return dst;
}
/**
* EncodeToString returns the hexadecimal encoding of `src`.
* @param src
*/
export function encodeToString(src) {
return new TextDecoder().decode(encode(src));
}
/**
* Decode decodes `src` into `decodedLen(src.length)` bytes
* If the input is malformed an error will be thrown
* the error.
* @param src
*/
export function decode(src) {
const dst = new Uint8Array(decodedLen(src.length));
for (let i = 0; i < dst.length; i++) {
const a = fromHexChar(src[i * 2]);
const b = fromHexChar(src[i * 2 + 1]);
dst[i] = (a << 4) | b;
}
if (src.length % 2 == 1) {
// Check for invalid char before reporting bad length,
// since the invalid char (if present) is an earlier problem.
fromHexChar(src[dst.length * 2]);
throw errLength();
}
return dst;
}
/**
* DecodedLen returns the length of decoding `x` source bytes.
* Specifically, it returns `x / 2`.
* @param x
*/
export function decodedLen(x) {
return x >>> 1;
}
/**
* DecodeString returns the bytes represented by the hexadecimal string `s`.
* DecodeString expects that src contains only hexadecimal characters and that
* src has even length.
* If the input is malformed, DecodeString will throw an error.
* @param s the `string` to decode to `Uint8Array`
*/
export function decodeString(s) {
return decode(new TextEncoder().encode(s));
}
17 changes: 17 additions & 0 deletions dist/esm/deps/deno.land/[email protected]/bytes/equals.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/** Check whether binary arrays are equal to each other using 8-bit comparisons.
* @private
* @param a first array to check equality
* @param b second array to check equality
*/
export declare function equalsNaive(a: Uint8Array, b: Uint8Array): boolean;
/** Check whether binary arrays are equal to each other using 32-bit comparisons.
* @private
* @param a first array to check equality
* @param b second array to check equality
*/
export declare function equals32Bit(a: Uint8Array, b: Uint8Array): boolean;
/** Check whether binary arrays are equal to each other.
* @param a first array to check equality
* @param b second array to check equality
*/
export declare function equals(a: Uint8Array, b: Uint8Array): boolean;
Loading

0 comments on commit 913ebc7

Please sign in to comment.