Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
EzePze committed May 5, 2024
2 parents d0b3d97 + 64227ef commit 13025b4
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 66 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@

This api is experimental!

#### Installation

```
npm i @blaze-cardano/sdk
```

#### Basic Usage

```ts
Expand Down
93 changes: 35 additions & 58 deletions examples/send_lovelace.ts
Original file line number Diff line number Diff line change
@@ -1,58 +1,35 @@
/**
* In this example we:
* - prepare the provider, wallet, blaze,
* - build a transaction paying out 50 ada to Micah's Wallet
* - sign & submit that transaction
* ```ts
* import { HotWallet } from '@blaze-cardano/wallet/hot'
* import {
* Ed25519PrivateNormalKeyHex,
* addressFromBech32,
* } from '@blaze-cardano/core'
* import { Maestro } from '@blaze-cardano/query'
* import { Blaze } from '../packages/blaze'
*
* let pkhHex = "... the public key hex ...";
*
* ```
* $butane wallet can collect donations for us
* ```ts
* const micahWallet = addressFromBech32(
* "addr1qye93uefq8r6ezk0kzq443u9zht7ylu5nelvw8eracd200ylzvhpxn9c4g2fyxe5rlmn6z5qmm3dtjqfjn2vvy58l88szlpjw4",
* );
* const provider = new Maestro({
* network: "mainnet",
* apiKey: "...your maestro api key...",
* });
* ```
* Prepare Wallet
* ```ts
* const wallet = new HotWallet(Ed25519PrivateNormalKeyHex(pkhHex), 0, provider);
* console.log("Your blaze address: ", wallet.address.toBech32());
* ```
* Prepare Blaze
* ```ts
* const blaze = new Blaze(
* provider,
* new HotWallet(Ed25519PrivateNormalKeyHex(pkhHex), 0, provider),
* );
* ```
* Use the awesome transaction builder
* ```ts
* const tx = await (await blaze.newTransaction())
* .payLovelace(micahWallet, 5n * 1_000_000n)
* .complete();
* ```
* Attach signatures (scuffed as fuck)
* ```ts
* const signed = await wallet.signTransaction(tx);
* let ws = tx.witnessSet();
* ws.setVkeys(signed.vkeys()!);
* tx.setWitnessSet(ws);
* ```
* ```ts
* Post transaction to the chain
* console.log(await blaze.provider.postTransactionToChain(tx));
* ```
*/
export function send_lovelace() {}
// In this example we:
// - prepare the provider, wallet, blaze,
// - build a transaction paying out 50 ada to Micah's Wallet
// - sign & submit that transaction
import { HotWallet, Core, Blaze, Maestro } from '@blaze-cardano/sdk'
let pkhHex = '... the public key hex ...'
// $butane wallet can collect donations for us
const micahWallet = Core.addressFromBech32(
'addr1qye93uefq8r6ezk0kzq443u9zht7ylu5nelvw8eracd200ylzvhpxn9c4g2fyxe5rlmn6z5qmm3dtjqfjn2vvy58l88szlpjw4',
)
const provider = new Maestro({
network: 'mainnet',
apiKey: '...your maestro api key...',
})
const wallet = new HotWallet(
Core.Ed25519PrivateNormalKeyHex(pkhHex),
0,
provider,
)
console.log('Your blaze address: ', wallet.address.toBech32())
const blaze = new Blaze(
provider,
new HotWallet(Core.Ed25519PrivateNormalKeyHex(pkhHex), 0, provider),
)
//Use the awesome transaction builder
const tx = await(await blaze.newTransaction())
.payLovelace(micahWallet, 5n * 1_000_000n)
.complete()
// Attach signatures (scuffed as fuck)
const signed = await wallet.signTransaction(tx)
let ws = tx.witnessSet()
ws.setVkeys(signed.vkeys()!)
tx.setWitnessSet(ws)
// Post transaction to the chain
console.log(await blaze.provider.postTransactionToChain(tx))
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"lint": "turbo run lint",
"test": "turbo run test",
"clean": "turbo run clean",
"docs": "typedoc \"packages/*\" && mkdir docs/logo && cp logo/blaze.svg docs/logo/blaze.svg",
"docs": "typedoc --skipErrorChecking && mkdir docs/logo && cp logo/blaze.svg docs/logo/blaze.svg",
"fmt": "prettier -w .",
"changeset": "changeset",
"release": "turbo run build && changeset publish"
Expand Down
14 changes: 7 additions & 7 deletions typedoc.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"entryPoints": [
// Blaze
"packages/blaze/index.ts",
"packages/blaze-blueprint/index.ts",
"packages/blaze-core/index.ts",
"packages/blaze-emulator/index.ts",
"packages/blaze-query/index.ts",
"packages/blaze-tx/index.ts",
"packages/blaze-wallet/index.ts"
"packages/blaze-sdk/src/index.ts",
"packages/blaze-blueprint/src/index.ts",
"packages/blaze-core/src/index.ts",
"packages/blaze-emulator/src/index.ts",
"packages/blaze-query/src/index.ts",
"packages/blaze-tx/src/index.ts",
"packages/blaze-wallet/src/index.ts"
],
"out": "docs",
"includeVersion": true,
Expand Down

0 comments on commit 13025b4

Please sign in to comment.