zkcloudworker 0.5.8 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. package/lib/ts/src/api/api.js +15 -4
  2. package/lib/ts/src/cloud/cloud.d.ts +16 -6
  3. package/lib/ts/src/cloud/index.d.ts +5 -0
  4. package/lib/ts/src/cloud/index.js +21 -0
  5. package/lib/ts/src/cloud/local.d.ts +7 -4
  6. package/lib/ts/src/cloud/local.js +15 -4
  7. package/lib/ts/src/config.d.ts +0 -1
  8. package/lib/ts/src/config.js +0 -1
  9. package/lib/ts/src/encryption/client.d.ts +19 -0
  10. package/lib/ts/src/encryption/client.js +155 -0
  11. package/lib/ts/src/encryption/connections.d.ts +1 -0
  12. package/lib/ts/src/encryption/connections.js +4 -0
  13. package/lib/ts/src/encryption/encryption.d.ts +3 -2
  14. package/lib/ts/src/encryption/encryption.js +2 -2
  15. package/lib/ts/src/encryption/index.d.ts +4 -0
  16. package/lib/ts/src/encryption/index.js +14 -0
  17. package/lib/ts/src/encryption/messages.d.ts +1 -0
  18. package/lib/ts/src/encryption/messages.js +27 -14
  19. package/lib/ts/src/index.d.ts +3 -12
  20. package/lib/ts/src/index.js +3 -12
  21. package/lib/ts/src/networks.d.ts +1 -0
  22. package/lib/ts/src/networks.js +2 -0
  23. package/lib/ts/src/{fee.js → utils/fee.js} +1 -1
  24. package/lib/ts/src/utils/fetch.js +1 -1
  25. package/lib/ts/src/utils/graphql.d.ts +11 -0
  26. package/lib/ts/src/utils/graphql.js +229 -0
  27. package/lib/ts/src/utils/index.d.ts +6 -0
  28. package/lib/ts/src/utils/index.js +22 -0
  29. package/lib/ts/src/{mina.d.ts → utils/mina.d.ts} +1 -1
  30. package/lib/ts/src/{mina.js → utils/mina.js} +1 -1
  31. package/lib/ts/tsconfig.tsbuildinfo +1 -1
  32. package/lib/web/src/api/api.js +15 -4
  33. package/lib/web/src/api/api.js.map +1 -1
  34. package/lib/web/src/cloud/cloud.d.ts +16 -6
  35. package/lib/web/src/cloud/cloud.js.map +1 -1
  36. package/lib/web/src/cloud/index.d.ts +5 -0
  37. package/lib/web/src/cloud/index.js +6 -0
  38. package/lib/web/src/cloud/index.js.map +1 -0
  39. package/lib/web/src/cloud/local.d.ts +7 -4
  40. package/lib/web/src/cloud/local.js +15 -4
  41. package/lib/web/src/cloud/local.js.map +1 -1
  42. package/lib/web/src/config.d.ts +0 -1
  43. package/lib/web/src/config.js +0 -1
  44. package/lib/web/src/config.js.map +1 -1
  45. package/lib/web/src/encryption/client.d.ts +19 -0
  46. package/lib/web/src/encryption/client.js +151 -0
  47. package/lib/web/src/encryption/client.js.map +1 -0
  48. package/lib/web/src/encryption/connections.d.ts +1 -0
  49. package/lib/web/src/encryption/connections.js +2 -0
  50. package/lib/web/src/encryption/connections.js.map +1 -0
  51. package/lib/web/src/encryption/encryption.d.ts +3 -2
  52. package/lib/web/src/encryption/encryption.js +4 -3
  53. package/lib/web/src/encryption/encryption.js.map +1 -1
  54. package/lib/web/src/encryption/index.d.ts +4 -0
  55. package/lib/web/src/encryption/index.js +5 -0
  56. package/lib/web/src/encryption/index.js.map +1 -0
  57. package/lib/web/src/encryption/messages.d.ts +1 -0
  58. package/lib/web/src/encryption/messages.js +23 -8
  59. package/lib/web/src/encryption/messages.js.map +1 -1
  60. package/lib/web/src/index.d.ts +3 -12
  61. package/lib/web/src/index.js +3 -12
  62. package/lib/web/src/index.js.map +1 -1
  63. package/lib/web/src/networks.d.ts +1 -0
  64. package/lib/web/src/networks.js +2 -0
  65. package/lib/web/src/networks.js.map +1 -1
  66. package/lib/web/src/{fee.js → utils/fee.js} +1 -1
  67. package/lib/web/src/utils/fee.js.map +1 -0
  68. package/lib/web/src/utils/fetch.js +1 -1
  69. package/lib/web/src/utils/fetch.js.map +1 -1
  70. package/lib/web/src/utils/graphql.d.ts +11 -0
  71. package/lib/web/src/utils/graphql.js +225 -0
  72. package/lib/web/src/utils/graphql.js.map +1 -0
  73. package/lib/web/src/utils/index.d.ts +6 -0
  74. package/lib/web/src/utils/index.js +7 -0
  75. package/lib/web/src/utils/index.js.map +1 -0
  76. package/lib/web/src/{mina.d.ts → utils/mina.d.ts} +1 -1
  77. package/lib/web/src/{mina.js → utils/mina.js} +1 -1
  78. package/lib/web/src/utils/mina.js.map +1 -0
  79. package/lib/web/tsconfig.web.tsbuildinfo +1 -1
  80. package/package.json +2 -2
  81. package/lib/ts/src/encryption/nats-client.d.ts +0 -1
  82. package/lib/ts/src/encryption/nats-client.js +0 -85
  83. package/lib/web/src/encryption/nats-client.d.ts +0 -1
  84. package/lib/web/src/encryption/nats-client.js +0 -79
  85. package/lib/web/src/encryption/nats-client.js.map +0 -1
  86. package/lib/web/src/fee.js.map +0 -1
  87. package/lib/web/src/mina.js.map +0 -1
  88. /package/lib/ts/src/{fee.d.ts → utils/fee.d.ts} +0 -0
  89. /package/lib/web/src/{fee.d.ts → utils/fee.d.ts} +0 -0
@@ -1,14 +1,5 @@
1
1
  export * from "./api/api";
2
- export * from "./cloud/cloud";
3
- export * from "./cloud/local";
4
- export * from "./cloud/job";
5
- export * from "./cloud/task";
6
- export * from "./mina";
7
- export * from "./fee";
2
+ export * from "./cloud";
8
3
  export * from "./networks";
9
- export * from "./encryption/encryption";
10
- export * from "./encryption/nats-client";
11
- export * from "./encryption/messages";
12
- export * from "./utils/fields";
13
- export * from "./utils/base64";
14
- export * from "./utils/fetch";
4
+ export * from "./encryption";
5
+ export * from "./utils";
@@ -1,15 +1,6 @@
1
1
  export * from "./api/api";
2
- export * from "./cloud/cloud";
3
- export * from "./cloud/local";
4
- export * from "./cloud/job";
5
- export * from "./cloud/task";
6
- export * from "./mina";
7
- export * from "./fee";
2
+ export * from "./cloud";
8
3
  export * from "./networks";
9
- export * from "./encryption/encryption";
10
- export * from "./encryption/nats-client";
11
- export * from "./encryption/messages";
12
- export * from "./utils/fields";
13
- export * from "./utils/base64";
14
- export * from "./utils/fetch";
4
+ export * from "./encryption";
5
+ export * from "./utils";
15
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC"}
@@ -8,6 +8,7 @@ interface MinaNetwork {
8
8
  accountManager?: string;
9
9
  explorerAccountUrl?: string;
10
10
  explorerTransactionUrl?: string;
11
+ faucet?: string;
11
12
  }
12
13
  declare const Mainnet: MinaNetwork;
13
14
  declare const Local: MinaNetwork;
@@ -22,6 +22,7 @@ const Devnet = {
22
22
  explorerTransactionUrl: "https://minascan.io/devnet/tx/",
23
23
  chainId: "devnet",
24
24
  name: "Devnet",
25
+ faucet: "https://faucet.minaprotocol.com",
25
26
  };
26
27
  const Zeko = {
27
28
  mina: ["https://devnet.zeko.io/graphql"],
@@ -30,6 +31,7 @@ const Zeko = {
30
31
  explorerTransactionUrl: "https://zekoscan.io/devnet/tx/",
31
32
  chainId: "zeko",
32
33
  name: "Zeko",
34
+ faucet: "https://zeko.io/faucet",
33
35
  };
34
36
  const Lightnet = {
35
37
  mina: ["http://localhost:8080/graphql"],
@@ -1 +1 @@
1
- {"version":3,"file":"networks.js","sourceRoot":"","sources":["../../../../src/networks.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,QAAQ,EACR,OAAO,EACP,MAAM,EACN,IAAI,EACJ,QAAQ,EACR,KAAK,GACN,CAAC;AAoBF,MAAM,OAAO,GAAgB;IAC3B,IAAI,EAAE,EAAE;IACR,OAAO,EAAE,EAAE;IACX,OAAO,EAAE,SAAS;CACnB,CAAC;AAEF,MAAM,KAAK,GAAgB;IACzB,IAAI,EAAE,EAAE;IACR,OAAO,EAAE,EAAE;IACX,OAAO,EAAE,OAAO;CACjB,CAAC;AAEF,MAAM,MAAM,GAAgB;IAC1B,IAAI,EAAE;QACJ,gDAAgD;QAChD,kDAAkD;KACnD;IACD,OAAO,EAAE;QACP,mDAAmD;QACnD,4CAA4C;KAC7C;IACD,kBAAkB,EAAE,qCAAqC;IACzD,sBAAsB,EAAE,gCAAgC;IACxD,OAAO,EAAE,QAAQ;IACjB,IAAI,EAAE,QAAQ;CACf,CAAC;AAEF,MAAM,IAAI,GAAgB;IACxB,IAAI,EAAE,CAAC,gCAAgC,CAAC;IACxC,OAAO,EAAE,EAAE;IACX,kBAAkB,EAAE,qCAAqC;IACzD,sBAAsB,EAAE,gCAAgC;IACxD,OAAO,EAAE,MAAM;IACf,IAAI,EAAE,MAAM;CACb,CAAC;AAEF,MAAM,QAAQ,GAAgB;IAC5B,IAAI,EAAE,CAAC,+BAA+B,CAAC;IACvC,OAAO,EAAE,CAAC,uBAAuB,CAAC;IAClC,cAAc,EAAE,uBAAuB;IACvC,OAAO,EAAE,UAAU;IACnB,IAAI,EAAE,UAAU;CACjB,CAAC;AAEF,MAAM,QAAQ,GAAkB,CAAC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;AAEzE;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2BE"}
1
+ {"version":3,"file":"networks.js","sourceRoot":"","sources":["../../../../src/networks.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,QAAQ,EACR,OAAO,EACP,MAAM,EACN,IAAI,EACJ,QAAQ,EACR,KAAK,GACN,CAAC;AAqBF,MAAM,OAAO,GAAgB;IAC3B,IAAI,EAAE,EAAE;IACR,OAAO,EAAE,EAAE;IACX,OAAO,EAAE,SAAS;CACnB,CAAC;AAEF,MAAM,KAAK,GAAgB;IACzB,IAAI,EAAE,EAAE;IACR,OAAO,EAAE,EAAE;IACX,OAAO,EAAE,OAAO;CACjB,CAAC;AAEF,MAAM,MAAM,GAAgB;IAC1B,IAAI,EAAE;QACJ,gDAAgD;QAChD,kDAAkD;KACnD;IACD,OAAO,EAAE;QACP,mDAAmD;QACnD,4CAA4C;KAC7C;IACD,kBAAkB,EAAE,qCAAqC;IACzD,sBAAsB,EAAE,gCAAgC;IACxD,OAAO,EAAE,QAAQ;IACjB,IAAI,EAAE,QAAQ;IACd,MAAM,EAAE,iCAAiC;CAC1C,CAAC;AAEF,MAAM,IAAI,GAAgB;IACxB,IAAI,EAAE,CAAC,gCAAgC,CAAC;IACxC,OAAO,EAAE,EAAE;IACX,kBAAkB,EAAE,qCAAqC;IACzD,sBAAsB,EAAE,gCAAgC;IACxD,OAAO,EAAE,MAAM;IACf,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,wBAAwB;CACjC,CAAC;AAEF,MAAM,QAAQ,GAAgB;IAC5B,IAAI,EAAE,CAAC,+BAA+B,CAAC;IACvC,OAAO,EAAE,CAAC,uBAAuB,CAAC;IAClC,cAAc,EAAE,uBAAuB;IACvC,OAAO,EAAE,UAAU;IACnB,IAAI,EAAE,UAAU;CACjB,CAAC;AAEF,MAAM,QAAQ,GAAkB,CAAC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;AAEzE;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2BE"}
@@ -1,5 +1,5 @@
1
1
  import { UInt64 } from "o1js";
2
- import config from "./config";
2
+ import config from "../config";
3
3
  export async function fee() {
4
4
  //TODO: update after mainnet launch
5
5
  return UInt64.fromJSON(config.MINAFEE);
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fee.js","sourceRoot":"","sources":["../../../../../src/utils/fee.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAAO,MAAM,MAAM,WAAW,CAAC;AAE/B,MAAM,CAAC,KAAK,UAAU,GAAG;IACvB,mCAAmC;IACnC,OAAO,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AACzC,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { Mina, fetchAccount, checkZkappTransaction, } from "o1js";
2
- import { sleep } from "../mina";
2
+ import { sleep } from "./mina";
3
3
  export async function fetchMinaAccount(params) {
4
4
  const { publicKey, tokenId, force } = params;
5
5
  const timeout = 1000 * 60 * 2; // 2 minutes
@@ -1 +1 @@
1
- {"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../../../../src/utils/fetch.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,IAAI,EACJ,YAAY,EACZ,qBAAqB,GACtB,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,MAItC;IACC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC;IAC7C,MAAM,OAAO,GAAG,IAAI,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,YAAY;IAC3C,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAC7B,IAAI,MAAM,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;IACpC,OAAO,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,GAAG,OAAO,EAAE,CAAC;QACxC,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC;gBAChC,SAAS;gBACT,OAAO;aACR,CAAC,CAAC;YACH,OAAO,MAAM,CA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CAAC,CACnC,CAAC;QACJ,CAAC;QACD,MAAM,KAAK,CAAC,IAAI,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;IAC7B,CAAC;IACD,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC;IAC3C,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAAC,IAAY;IAC1D,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,qBAAqB,CAAC,IAAI,CAAC,CAAC;QACjD,OAAO,MAAM,CAAC;IAChB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,iCAAiC,EAAE,KAAK,CAAC,CAAC;QACxD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC5B,CAAC;AACH,CAAC"}
@@ -0,0 +1,11 @@
1
+ export declare const defaultToken = "wSHV2S4qX9jFsLjQo8r1BsMLH2ZRKsZx6EJd1sbozGPieEC4Jf";
2
+ export declare function getBalanceFromGraphQL(params: {
3
+ publicKey: string;
4
+ tokenId?: string;
5
+ mina: string[];
6
+ }): Promise<bigint>;
7
+ export declare function getAccountFromGraphQL(params: {
8
+ publicKey: string;
9
+ tokenId?: string;
10
+ mina: string[];
11
+ }): Promise<any>;
@@ -0,0 +1,225 @@
1
+ export const defaultToken = "wSHV2S4qX9jFsLjQo8r1BsMLH2ZRKsZx6EJd1sbozGPieEC4Jf";
2
+ export async function getBalanceFromGraphQL(params) {
3
+ const { publicKey, mina } = params;
4
+ const tokenId = params.tokenId ?? defaultToken;
5
+ if (mina.length === 0)
6
+ throw new Error("no mina endpoints provided");
7
+ const account = await fetchAccountInternal({
8
+ publicKey,
9
+ tokenId,
10
+ mina,
11
+ queryType: "balance",
12
+ });
13
+ //console.log("getBalanceFromGraphQL account:", account);
14
+ const balance = account?.account?.balance?.total;
15
+ return balance ? BigInt(balance) : 0n;
16
+ }
17
+ export async function getAccountFromGraphQL(params) {
18
+ const { publicKey, mina } = params;
19
+ const tokenId = params.tokenId ?? defaultToken;
20
+ if (mina.length === 0)
21
+ throw new Error("no mina endpoints provided");
22
+ const account = await fetchAccountInternal({
23
+ publicKey,
24
+ tokenId,
25
+ mina,
26
+ queryType: "account",
27
+ });
28
+ return account?.account;
29
+ }
30
+ async function fetchAccountInternal(params) {
31
+ const { publicKey, tokenId, mina, timeout, queryType } = params;
32
+ const query = queryType === "balance"
33
+ ? balanceQuery(publicKey, tokenId)
34
+ : accountQuery(publicKey, tokenId);
35
+ let [response, error] = await makeGraphqlRequest({
36
+ query,
37
+ mina,
38
+ timeout,
39
+ });
40
+ if (error !== undefined)
41
+ return { account: undefined, error };
42
+ const account = response?.data?.account;
43
+ if (!account) {
44
+ return {
45
+ account: undefined,
46
+ error: {
47
+ statusCode: 404,
48
+ statusText: `fetchAccount: Account with public key ${publicKey} does not exist.`,
49
+ },
50
+ };
51
+ }
52
+ return {
53
+ account,
54
+ error: undefined,
55
+ };
56
+ }
57
+ async function makeGraphqlRequest(params) {
58
+ const defaultTimeout = 5 * 60 * 1000; // 5 minutes
59
+ const timeout = params.timeout ?? defaultTimeout;
60
+ const { query, mina } = params;
61
+ const graphqlEndpoint = mina[0];
62
+ const fallbackEndpoints = mina.slice(1);
63
+ if (graphqlEndpoint === "none")
64
+ throw Error("Should have made a graphql request, but don't know to which endpoint.");
65
+ let timeouts = [];
66
+ const clearTimeouts = () => {
67
+ timeouts.forEach((t) => clearTimeout(t));
68
+ timeouts = [];
69
+ };
70
+ const makeRequest = async (url) => {
71
+ const controller = new AbortController();
72
+ const timer = setTimeout(() => controller.abort(), timeout);
73
+ timeouts.push(timer);
74
+ let body = JSON.stringify({
75
+ operationName: null,
76
+ query,
77
+ variables: {},
78
+ });
79
+ try {
80
+ let response = await fetch(url, {
81
+ method: "POST",
82
+ headers: { "Content-Type": "application/json" },
83
+ body,
84
+ signal: controller.signal,
85
+ });
86
+ return checkResponseStatus(response);
87
+ }
88
+ finally {
89
+ clearTimeouts();
90
+ }
91
+ };
92
+ // try to fetch from endpoints in pairs
93
+ let timeoutErrors = [];
94
+ let urls = [graphqlEndpoint, ...fallbackEndpoints];
95
+ for (let i = 0; i < urls.length; i += 2) {
96
+ let url1 = urls[i];
97
+ let url2 = urls[i + 1];
98
+ if (url2 === undefined) {
99
+ try {
100
+ return await makeRequest(url1);
101
+ }
102
+ catch (error) {
103
+ return [undefined, inferError(error)];
104
+ }
105
+ }
106
+ try {
107
+ return await Promise.race([makeRequest(url1), makeRequest(url2)]);
108
+ }
109
+ catch (unknownError) {
110
+ let error = inferError(unknownError);
111
+ if (error.statusCode === 408) {
112
+ // If the request timed out, try the next 2 endpoints
113
+ timeoutErrors.push({ url1, url2, error });
114
+ }
115
+ else {
116
+ // If the request failed for some other reason (e.g. o1js error), return the error
117
+ return [undefined, error];
118
+ }
119
+ }
120
+ }
121
+ const statusText = timeoutErrors
122
+ .map(({ url1, url2, error }) => `Request to ${url1} and ${url2} timed out. Error: ${error}`)
123
+ .join("\n");
124
+ return [undefined, { statusCode: 408, statusText }];
125
+ }
126
+ function inferError(error) {
127
+ let errorMessage = JSON.stringify(error);
128
+ if (error instanceof AbortSignal) {
129
+ return { statusCode: 408, statusText: `Request Timeout: ${errorMessage}` };
130
+ }
131
+ else {
132
+ return {
133
+ statusCode: 500,
134
+ statusText: `Unknown Error: ${errorMessage}`,
135
+ };
136
+ }
137
+ }
138
+ async function checkResponseStatus(response) {
139
+ if (response.ok) {
140
+ const jsonResponse = (await response.json());
141
+ if (jsonResponse.errors && jsonResponse.errors.length > 0) {
142
+ return [
143
+ undefined,
144
+ {
145
+ statusCode: response.status,
146
+ statusText: jsonResponse.errors
147
+ .map((error) => error.message)
148
+ .join("\n"),
149
+ },
150
+ ];
151
+ }
152
+ else if (jsonResponse.data === undefined) {
153
+ return [
154
+ undefined,
155
+ {
156
+ statusCode: response.status,
157
+ statusText: `GraphQL response data is undefined`,
158
+ },
159
+ ];
160
+ }
161
+ return [jsonResponse, undefined];
162
+ }
163
+ else {
164
+ return [
165
+ undefined,
166
+ {
167
+ statusCode: response.status,
168
+ statusText: response.statusText,
169
+ },
170
+ ];
171
+ }
172
+ }
173
+ const balanceQuery = (publicKey, tokenId) => `{
174
+ account(publicKey: "${publicKey}", token: "${tokenId}") {
175
+ balance { total }
176
+ }
177
+ }
178
+ `;
179
+ const accountQuery = (publicKey, tokenId) => `{
180
+ account(publicKey: "${publicKey}", token: "${tokenId}") {
181
+ publicKey
182
+ token
183
+ nonce
184
+ balance { total }
185
+ tokenSymbol
186
+ receiptChainHash
187
+ timing {
188
+ initialMinimumBalance
189
+ cliffTime
190
+ cliffAmount
191
+ vestingPeriod
192
+ vestingIncrement
193
+ }
194
+ permissions {
195
+ editState
196
+ access
197
+ send
198
+ receive
199
+ setDelegate
200
+ setPermissions
201
+ setVerificationKey {
202
+ auth
203
+ txnVersion
204
+ }
205
+ setZkappUri
206
+ editActionState
207
+ setTokenSymbol
208
+ incrementNonce
209
+ setVotingFor
210
+ setTiming
211
+ }
212
+ delegateAccount { publicKey }
213
+ votingFor
214
+ zkappState
215
+ verificationKey {
216
+ verificationKey
217
+ hash
218
+ }
219
+ actionState
220
+ provedState
221
+ zkappUri
222
+ }
223
+ }
224
+ `;
225
+ //# sourceMappingURL=graphql.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graphql.js","sourceRoot":"","sources":["../../../../../src/utils/graphql.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,YAAY,GACvB,oDAAoD,CAAC;AAEvD,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,MAI3C;IACC,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;IACnC,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,YAAY,CAAC;IAC/C,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;IACrE,MAAM,OAAO,GAAG,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BACT;oBACE,UAAU,EAAE,QAAQ,CAAC,MAAM;oBAC3B,UAAU,EAAE,YAAY,CAAC,MAAM;yBAC5B,GAAG,CAAC,CAAC,KAAU,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC;yBAClC,IAAI,CAAC,IAAI,CAAC;iBACd;aACF,CAAC;QACJ,CAAC;aAAM,IAAI,YAAY,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;YAC3C,OAAO;gBACL,SAAS;gBACT;oBACE,UAAU,EAAE,QAAQ,CAAC,MAAM;oBAC3B,UAAU,EAAE,oCAAoC;iBACjD;aACF,CAAC;QACJ,CAAC;QACD,OAAO,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;IACnC,CAAC;SAAM,CAAC;QACN,OAAO;YACL,SAAS;YACT;gBACE,UAAU,EAAE,QAAQ,CAAC,MAAM;gBAC3B,UAAU,EAAE,QAAQ,CAAC,UAAU;aAChC;SACF,CAAC;IACJ,CAAC;AACH,CAAC;AAED,MAAM,YAAY,GAAG,CAAC,SAAiB,EAAE,OAAe,EAAE,EAAE,CAAC;wBACrC,SAAS,cAAc,OAAO;;;;CAIrD,CAAC;AAEF,MAAM,YAAY,GAAG,CAAC,SAAiB,EAAE,OAAe,EAAE,EAAE,CAAC;wBACrC,SAAS,cAAc,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4CrD,CAAC"}
@@ -0,0 +1,6 @@
1
+ export * from "./base64";
2
+ export * from "./fetch";
3
+ export * from "./fields";
4
+ export * from "./graphql";
5
+ export * from "./fee";
6
+ export * from "./mina";
@@ -0,0 +1,7 @@
1
+ export * from "./base64";
2
+ export * from "./fetch";
3
+ export * from "./fields";
4
+ export * from "./graphql";
5
+ export * from "./fee";
6
+ export * from "./mina";
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC"}
@@ -1,6 +1,6 @@
1
1
  export { initBlockchain, Memory, makeString, sleep, accountBalance, accountBalanceMina, formatTime, MinaNetworkInstance, currentNetwork, getNetworkIdHash, getCurrentNetwork, getDeployer, };
2
2
  import { Mina, PublicKey, UInt64, Field } from "o1js";
3
- import { blockchain, MinaNetwork } from "./networks";
3
+ import { blockchain, MinaNetwork } from "../networks";
4
4
  interface MinaNetworkInstance {
5
5
  keys: Mina.TestPublicKey[];
6
6
  network: MinaNetwork;
@@ -1,6 +1,6 @@
1
1
  export { initBlockchain, Memory, makeString, sleep, accountBalance, accountBalanceMina, formatTime, currentNetwork, getNetworkIdHash, getCurrentNetwork, getDeployer, };
2
2
  import { Mina, PrivateKey, UInt64, fetchAccount, Encoding, Poseidon, Lightnet, } from "o1js";
3
- import { networks, Local } from "./networks";
3
+ import { networks, Local } from "../networks";
4
4
  let currentNetwork = undefined;
5
5
  function getNetworkIdHash() {
6
6
  if (currentNetwork === undefined) {
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mina.js","sourceRoot":"","sources":["../../../../../src/utils/mina.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,MAAM,EACN,UAAU,EACV,KAAK,EACL,cAAc,EACd,kBAAkB,EAClB,UAAU,EAEV,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,GACZ,CAAC;AAEF,OAAO,EACL,IAAI,EAEJ,UAAU,EACV,MAAM,EACN,YAAY,EAEZ,QAAQ,EACR,QAAQ,EACR,QAAQ,GACT,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,QAAQ,EAA2B,KAAK,EAAE,MAAM,aAAa,CAAC;AAQvE,IAAI,cAAc,GAAoC,SAAS,CAAC;AAEhE,SAAS,gBAAgB;IACvB,IAAI,c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