-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
reading pellet params from csv. (#58)
* reading pellet params from csv. * removed asteria tx ref assuming unique UTxO. * added pellets tx indexing. * removed unused parsing option. * fixed type annotation.
- Loading branch information
1 parent
ae41bcb
commit ed03123
Showing
8 changed files
with
35 additions
and
64 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 |
---|---|---|
@@ -1,24 +1,20 @@ | ||
import { admin_token } from "../../constants.ts"; | ||
import { createPellets } from "../../transactions/admin/create-pellets.ts"; | ||
import { printTxURL } from "../../utils.ts"; | ||
import { parse } from "jsr:@std/csv"; | ||
|
||
const params = [ | ||
{ | ||
fuel: 90n, | ||
pos_x: 12n, | ||
pos_y: -50n, | ||
}, | ||
{ | ||
fuel: 40n, | ||
pos_x: -7n, | ||
pos_y: 3n, | ||
}, | ||
{ | ||
fuel: 25n, | ||
pos_x: 20n, | ||
pos_y: 19n, | ||
}, | ||
]; | ||
const text = await Deno.readTextFile("tests/admin/pellets.csv"); | ||
const data = parse(text, { | ||
skipFirstRow: true, | ||
columns: ["fuel", "pos_x", "pos_y"], | ||
}); | ||
const params: { fuel: bigint; pos_x: bigint; pos_y: bigint }[] = data.map( | ||
(p) => ({ | ||
fuel: BigInt(p.fuel), | ||
pos_x: BigInt(p.pos_x), | ||
pos_y: BigInt(p.pos_y), | ||
}) | ||
); | ||
|
||
const txHash = await createPellets(admin_token, params); | ||
printTxURL(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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
fuel,x,y | ||
90,12,-35 | ||
40,-8,3 | ||
25,20,16 | ||
36,-4,-17 | ||
68,19,-10 |
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