-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(core): allow manual token minting
- Loading branch information
1 parent
f52d9a4
commit 8e07d82
Showing
9 changed files
with
237 additions
and
23 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
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,17 +1,27 @@ | ||
export type InsufficientAssets = { [key: string]: bigint }; | ||
import { some } from "@fleet-sdk/common"; | ||
import { SelectionTarget } from "../builder/selector/boxSelector"; | ||
|
||
export class InsufficientInputs extends Error { | ||
readonly unreached: InsufficientAssets; | ||
readonly unreached: SelectionTarget; | ||
|
||
constructor(unreached: InsufficientAssets) { | ||
super( | ||
`Insufficient inputs:${Object.keys(unreached) | ||
.map((key) => { | ||
return `\n > ${key}: ${unreached[key].toString()}`; | ||
}) | ||
.join()}` | ||
); | ||
constructor(unreached: SelectionTarget) { | ||
const strings = []; | ||
if (unreached.nanoErgs) { | ||
strings.push(buildString("nanoErgs", unreached.nanoErgs)); | ||
} | ||
|
||
if (some(unreached.tokens)) { | ||
for (const token of unreached.tokens) { | ||
strings.push(buildString(token.tokenId, token.amount)); | ||
} | ||
} | ||
|
||
super(`Insufficient inputs:${strings.join()}`); | ||
|
||
this.unreached = unreached; | ||
} | ||
} | ||
|
||
function buildString(tokenId: string, amount?: bigint): string { | ||
return `\n > ${tokenId}: ${amount?.toString()}`; | ||
} |
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,5 @@ | ||
export class NonStandardizedMinting extends Error { | ||
constructor(message: string) { | ||
super(message); | ||
} | ||
} |
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