@silvana-one/abi 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/nft/build.ts CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  NftMintTransactionParams,
8
8
  getCurrentZekoSlot,
9
9
  } from "@silvana-one/api";
10
- import { blockchain } from "../types.js";
10
+ import { CanonicalBlockchain } from "@silvana-one/api";
11
11
  import { fetchMinaAccount } from "../fetch.js";
12
12
  import {
13
13
  Collection,
@@ -48,7 +48,7 @@ import {
48
48
  export type NftAdminType = "standard" | "advanced" | "unknown";
49
49
 
50
50
  export async function buildNftCollectionLaunchTransaction(params: {
51
- chain: blockchain;
51
+ chain: CanonicalBlockchain;
52
52
  args:
53
53
  | LaunchNftCollectionStandardAdminParams
54
54
  | LaunchNftCollectionAdvancedAdminParams;
@@ -71,9 +71,9 @@ export async function buildNftCollectionLaunchTransaction(params: {
71
71
  }> {
72
72
  const { chain, args } = params;
73
73
  const ACCOUNT_CREATION_FEE: bigint =
74
- chain === "zeko" ? 100_000_000n : 1_000_000_000n;
74
+ chain === "zeko:testnet" ? 100_000_000n : 1_000_000_000n;
75
75
  const {
76
- url = chain === "mainnet"
76
+ url = chain === "mina:mainnet"
77
77
  ? "https://minanft.io"
78
78
  : `https://${chain}.minanft.io`,
79
79
  symbol = "NFT",
@@ -123,7 +123,7 @@ export async function buildNftCollectionLaunchTransaction(params: {
123
123
  const collectionContract =
124
124
  adminType === "advanced" ? AdvancedCollection : Collection;
125
125
  const vk =
126
- tokenVerificationKeys[chain === "mainnet" ? "mainnet" : "devnet"].vk;
126
+ tokenVerificationKeys[chain === "mina:mainnet" ? "mainnet" : "devnet"].vk;
127
127
  if (
128
128
  !vk ||
129
129
  !vk.Collection ||
@@ -208,13 +208,13 @@ export async function buildNftCollectionLaunchTransaction(params: {
208
208
  if (metadataRoot === undefined) throw new Error("metadataRoot is required");
209
209
 
210
210
  const slot =
211
- chain === "local"
211
+ chain === "mina:local"
212
212
  ? Mina.currentSlot()
213
- : chain === "zeko"
214
- ? UInt32.from((await getCurrentZekoSlot("zeko")) ?? 2_000_000)
213
+ : chain === "zeko:testnet"
214
+ ? UInt32.from((await getCurrentZekoSlot("zeko:testnet")) ?? 2_000_000)
215
215
  : (await fetchLastBlock()).globalSlotSinceGenesis;
216
216
  const expiry = slot.add(UInt32.from(100));
217
- if (chain === "zeko") {
217
+ if (chain === "zeko:testnet") {
218
218
  console.log("zeko slot", slot.toBigint());
219
219
  console.log("zeko expiry", expiry.toBigint());
220
220
  }
@@ -326,7 +326,7 @@ export async function buildNftCollectionLaunchTransaction(params: {
326
326
  }
327
327
 
328
328
  export async function buildNftTransaction(params: {
329
- chain: blockchain;
329
+ chain: CanonicalBlockchain;
330
330
  args: Exclude<
331
331
  NftTransactionParams,
332
332
  | LaunchNftCollectionStandardAdminParams
@@ -357,7 +357,7 @@ export async function buildNftTransaction(params: {
357
357
  }> {
358
358
  const { chain, args } = params;
359
359
  const ACCOUNT_CREATION_FEE: bigint =
360
- chain === "zeko" ? 100_000_000n : 1_000_000_000n;
360
+ chain === "zeko:testnet" ? 100_000_000n : 1_000_000_000n;
361
361
  const { nonce, txType } = args;
362
362
  if (nonce === undefined) throw new Error("Nonce is required");
363
363
  if (typeof nonce !== "number") throw new Error("Nonce must be a number");
@@ -626,7 +626,7 @@ export async function buildNftTransaction(params: {
626
626
  // ? new FungibleTokenBidContract(bidAddress)
627
627
  // : undefined;
628
628
  const vk =
629
- tokenVerificationKeys[chain === "mainnet" ? "mainnet" : "devnet"].vk;
629
+ tokenVerificationKeys[chain === "mina:mainnet" ? "mainnet" : "devnet"].vk;
630
630
  if (
631
631
  !vk ||
632
632
  !vk.Collection ||
@@ -884,7 +884,7 @@ export async function buildNftTransaction(params: {
884
884
  }
885
885
 
886
886
  export async function buildNftMintTransaction(params: {
887
- chain: blockchain;
887
+ chain: CanonicalBlockchain;
888
888
  args: NftMintTransactionParams;
889
889
  developerAddress?: string;
890
890
  provingKey?: string;
@@ -905,7 +905,7 @@ export async function buildNftMintTransaction(params: {
905
905
  }> {
906
906
  const { chain, args } = params;
907
907
  const ACCOUNT_CREATION_FEE: bigint =
908
- chain === "zeko" ? 100_000_000n : 1_000_000_000n;
908
+ chain === "zeko:testnet" ? 100_000_000n : 1_000_000_000n;
909
909
  const { nonce, txType } = args;
910
910
  if (nonce === undefined) throw new Error("Nonce is required");
911
911
  if (typeof nonce !== "number") throw new Error("Nonce must be a number");
@@ -975,7 +975,7 @@ export async function buildNftMintTransaction(params: {
975
975
  });
976
976
 
977
977
  const vk =
978
- tokenVerificationKeys[chain === "mainnet" ? "mainnet" : "devnet"].vk;
978
+ tokenVerificationKeys[chain === "mina:mainnet" ? "mainnet" : "devnet"].vk;
979
979
  if (
980
980
  !vk ||
981
981
  !vk.Collection ||
@@ -1014,13 +1014,13 @@ export async function buildNftMintTransaction(params: {
1014
1014
  if (metadataRoot === undefined) throw new Error("metadataRoot is required");
1015
1015
 
1016
1016
  const slot =
1017
- chain === "local"
1017
+ chain === "mina:local"
1018
1018
  ? Mina.currentSlot()
1019
- : chain === "zeko"
1020
- ? UInt32.from((await getCurrentZekoSlot("zeko")) ?? 2_000_000)
1019
+ : chain === "zeko:testnet"
1020
+ ? UInt32.from((await getCurrentZekoSlot("zeko:testnet")) ?? 2_000_000)
1021
1021
  : (await fetchLastBlock()).globalSlotSinceGenesis;
1022
1022
  const expiry = slot.add(UInt32.from(100));
1023
- if (chain === "zeko") {
1023
+ if (chain === "zeko:testnet") {
1024
1024
  console.log("zeko slot", slot.toBigint());
1025
1025
  console.log("zeko expiry", expiry.toBigint());
1026
1026
  }
@@ -1102,7 +1102,7 @@ export async function getNftSymbolAndAdmin(params: {
1102
1102
  // bidAddress?: PublicKey;
1103
1103
  nftAddress?: PublicKey;
1104
1104
  collectionAddress: PublicKey;
1105
- chain: blockchain;
1105
+ chain: CanonicalBlockchain;
1106
1106
  }): Promise<{
1107
1107
  adminContractAddress: PublicKey;
1108
1108
  symbol: string;
@@ -1116,7 +1116,7 @@ export async function getNftSymbolAndAdmin(params: {
1116
1116
  }> {
1117
1117
  const { txType, collectionAddress, chain, nftAddress } = params;
1118
1118
  const vk =
1119
- tokenVerificationKeys[chain === "mainnet" ? "mainnet" : "devnet"].vk;
1119
+ tokenVerificationKeys[chain === "mina:mainnet" ? "mainnet" : "devnet"].vk;
1120
1120
  let verificationKeyHashes: string[] = [];
1121
1121
  let nftName: string | undefined = undefined;
1122
1122
  let storage: string | undefined = undefined;
@@ -6,7 +6,7 @@ import {
6
6
  LaunchTokenStandardAdminParams,
7
7
  LaunchTokenBondingCurveAdminParams,
8
8
  } from "@silvana-one/api";
9
- import { blockchain } from "../types.js";
9
+ import { CanonicalBlockchain } from "@silvana-one/api";
10
10
  import { fetchMinaAccount } from "../fetch.js";
11
11
  import {
12
12
  FungibleToken,
@@ -36,7 +36,7 @@ import {
36
36
  export type AdminType = "standard" | "advanced" | "bondingCurve" | "unknown";
37
37
 
38
38
  export async function buildTokenLaunchTransaction(params: {
39
- chain: blockchain;
39
+ chain: CanonicalBlockchain;
40
40
  args:
41
41
  | LaunchTokenStandardAdminParams
42
42
  | LaunchTokenAdvancedAdminParams
@@ -55,7 +55,7 @@ export async function buildTokenLaunchTransaction(params: {
55
55
  }> {
56
56
  const { chain, args } = params;
57
57
  const ACCOUNT_CREATION_FEE: bigint =
58
- chain === "zeko" ? 100_000_000n : 1_000_000_000n;
58
+ chain === "zeko:testnet" ? 100_000_000n : 1_000_000_000n;
59
59
  const { uri, symbol, memo, nonce, adminContract: adminType } = args;
60
60
  if (memo && typeof memo !== "string")
61
61
  throw new Error("Memo must be a string");
@@ -91,7 +91,7 @@ export async function buildTokenLaunchTransaction(params: {
91
91
  ? BondingCurveFungibleToken
92
92
  : FungibleToken;
93
93
  const vk =
94
- tokenVerificationKeys[chain === "mainnet" ? "mainnet" : "devnet"].vk;
94
+ tokenVerificationKeys[chain === "mina:mainnet" ? "mainnet" : "devnet"].vk;
95
95
  if (
96
96
  !vk ||
97
97
  !vk.FungibleTokenOfferContract ||
@@ -279,7 +279,7 @@ export async function buildTokenLaunchTransaction(params: {
279
279
  }
280
280
 
281
281
  export async function buildTokenTransaction(params: {
282
- chain: blockchain;
282
+ chain: CanonicalBlockchain;
283
283
  args: Exclude<
284
284
  TokenTransactionParams,
285
285
  | LaunchTokenStandardAdminParams
@@ -305,7 +305,7 @@ export async function buildTokenTransaction(params: {
305
305
  }> {
306
306
  const { chain, args } = params;
307
307
  const ACCOUNT_CREATION_FEE: bigint =
308
- chain === "zeko" ? 100_000_000n : 1_000_000_000n;
308
+ chain === "zeko:testnet" ? 100_000_000n : 1_000_000_000n;
309
309
  const { nonce, txType } = args;
310
310
  if (nonce === undefined) throw new Error("Nonce is required");
311
311
  if (typeof nonce !== "number") throw new Error("Nonce must be a number");
@@ -512,7 +512,7 @@ export async function buildTokenTransaction(params: {
512
512
  ? new FungibleTokenBidContract(bidAddress)
513
513
  : undefined;
514
514
  const vk =
515
- tokenVerificationKeys[chain === "mainnet" ? "mainnet" : "devnet"].vk;
515
+ tokenVerificationKeys[chain === "mina:mainnet" ? "mainnet" : "devnet"].vk;
516
516
  if (
517
517
  !vk ||
518
518
  !vk.FungibleTokenOfferContract ||
@@ -875,7 +875,7 @@ export async function getTokenSymbolAndAdmin(params: {
875
875
  offerAddress?: PublicKey;
876
876
  bidAddress?: PublicKey;
877
877
  tokenAddress: PublicKey;
878
- chain: blockchain;
878
+ chain: CanonicalBlockchain;
879
879
  }): Promise<{
880
880
  adminContractAddress: PublicKey;
881
881
  adminAddress: PublicKey;
@@ -886,7 +886,7 @@ export async function getTokenSymbolAndAdmin(params: {
886
886
  }> {
887
887
  const { txType, tokenAddress, chain, to, offerAddress, bidAddress } = params;
888
888
  const vk =
889
- tokenVerificationKeys[chain === "mainnet" ? "mainnet" : "devnet"].vk;
889
+ tokenVerificationKeys[chain === "mina:mainnet" ? "mainnet" : "devnet"].vk;
890
890
  let verificationKeyHashes: string[] = [];
891
891
  if (bidAddress) {
892
892
  verificationKeyHashes.push(vk.FungibleTokenBidContract.hash);
@@ -1,4 +0,0 @@
1
- /**
2
- * blockchain is the type for the chain ID.
3
- */
4
- export type blockchain = "local" | "devnet" | "lightnet" | "mainnet" | "zeko";
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}
@@ -1,4 +0,0 @@
1
- /**
2
- * blockchain is the type for the chain ID.
3
- */
4
- export type blockchain = "local" | "devnet" | "lightnet" | "mainnet" | "zeko";
package/dist/web/types.js DELETED
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}
package/src/types.ts DELETED
@@ -1,4 +0,0 @@
1
- /**
2
- * blockchain is the type for the chain ID.
3
- */
4
- export type blockchain = "local" | "devnet" | "lightnet" | "mainnet" | "zeko";