-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Sofia Bobbiesi <sofia-bobbiesi@users.noreply.github.com>
- Loading branch information
1 parent
7ab8c2a
commit 591d3d9
Showing
13 changed files
with
98 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { fromText } from "https://deno.land/x/lucid@0.10.7/mod.ts"; | ||
import { AssetClassT } from "./types.ts"; | ||
|
||
const admin_token: AssetClassT = { | ||
policy: "f8ab3db3bc88f892d843e6d82ae78cee28c4eb073a6774390b880c7d", | ||
name: fromText("admin"), | ||
}; | ||
const ship_mint_lovelace_fee = 3_000_000n; | ||
const max_asteria_mining = 50n; | ||
const max_moving_distance = 20n; | ||
const max_ship_fuel = 100n; | ||
const fuel_per_step = 1n; | ||
const initial_fuel = 30n; | ||
const min_asteria_distance = 10n; | ||
|
||
export { | ||
admin_token, | ||
ship_mint_lovelace_fee, | ||
max_asteria_mining, | ||
max_moving_distance, | ||
max_ship_fuel, | ||
fuel_per_step, | ||
initial_fuel, | ||
min_asteria_distance, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,9 @@ | ||
import { fromText } from "https://deno.land/x/lucid@0.10.7/mod.ts"; | ||
import { AssetClassT } from "../types.ts"; | ||
import { admin_token } from "../constants.ts"; | ||
import { createPellet } from "../transactions/create-pellet.ts"; | ||
|
||
const admin_token: AssetClassT = { | ||
policy: "0298aa99f95e2fe0a0132a6bb794261fb7e7b0d988215da2f2de2005", | ||
name: fromText("tokenA"), | ||
}; | ||
const fuel = 40n; | ||
const pos_x = 7n; | ||
const pos_y = -10n; | ||
|
||
const txHash = await createPellet(admin_token, fuel, pos_x, pos_y); | ||
|
||
console.log(txHash); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,6 @@ | ||
import { fromText } from "https://deno.land/x/lucid@0.10.7/mod.ts"; | ||
import { spendRefUTxOs } from "../../transactions/deploy/spend-refs.ts"; | ||
import { AssetClassT } from "../../types.ts"; | ||
|
||
const admin_token: AssetClassT = { | ||
policy: "0298aa99f95e2fe0a0132a6bb794261fb7e7b0d988215da2f2de2005", | ||
name: fromText("tokenA"), | ||
}; | ||
import { admin_token } from "../../constants.ts"; | ||
|
||
const txHash = await spendRefUTxOs(admin_token); | ||
|
||
console.log(txHash); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { lucidBase } from "../utils.ts"; | ||
import { | ||
toUnit, | ||
fromText, | ||
Assets, | ||
} from "https://deno.land/x/lucid@0.10.7/mod.ts"; | ||
|
||
const lucid = await lucidBase(); | ||
const seed = Deno.env.get("SEED"); | ||
if (!seed) { | ||
throw Error("Unable to read wallet's seed from env"); | ||
} | ||
lucid.selectWalletFromSeed(seed); | ||
const address = await lucid.wallet.address(); | ||
|
||
const { paymentCredential } = lucid.utils.getAddressDetails(address); | ||
|
||
const beforeSlot = lucid.currentSlot() + 60; | ||
const mintingPolicy = lucid.utils.nativeScriptFromJson({ | ||
type: "all", | ||
scripts: [ | ||
{ type: "sig", keyHash: paymentCredential?.hash }, | ||
{ | ||
type: "before", | ||
slot: beforeSlot, | ||
}, | ||
], | ||
}); | ||
|
||
const policyId = lucid.utils.mintingPolicyToId(mintingPolicy); | ||
|
||
const policyUnit = toUnit(policyId, fromText("admin")); | ||
const policyAsset: Assets = { [policyUnit]: 10000n }; | ||
|
||
const tx = await lucid | ||
.newTx() | ||
.mintAssets(policyAsset) | ||
.attachMintingPolicy(mintingPolicy) | ||
.payToAddress(address, policyAsset) | ||
.validTo(lucid.utils.slotToUnixTime(beforeSlot)) | ||
.complete(); | ||
|
||
const signedTx = await lucid.fromTx(tx.toString()).sign().complete(); | ||
const txid = await signedTx.submit(); | ||
const cExplorerTxURL = "https://preview.cexplorer.io/tx/"; | ||
console.log(`${cExplorerTxURL}${txid}`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters