@fastnear/api 0.7.2 → 0.8.0
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/dist/cjs/index.cjs +2 -2
- package/dist/cjs/index.d.cts +2 -2
- package/dist/cjs/near.cjs +16 -16
- package/dist/cjs/near.cjs.map +1 -1
- package/dist/cjs/state.cjs +2 -2
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js +2 -2
- package/dist/esm/near.js +15 -15
- package/dist/esm/near.js.map +1 -1
- package/dist/esm/state.js +2 -2
- package/dist/umd/browser.global.js +15 -15
- package/dist/umd/browser.global.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/* ⋈ 🏃🏻💨 FastNEAR API - IIFE/UMD (@fastnear/api version 0.
|
|
2
|
-
/* https://www.npmjs.com/package/@fastnear/api/v/0.
|
|
1
|
+
/* ⋈ 🏃🏻💨 FastNEAR API - IIFE/UMD (@fastnear/api version 0.8.0) */
|
|
2
|
+
/* https://www.npmjs.com/package/@fastnear/api/v/0.8.0 */
|
|
3
3
|
"use strict";
|
|
4
4
|
var near = (() => {
|
|
5
5
|
var __defProp = Object.defineProperty;
|
|
@@ -54,10 +54,10 @@ var near = (() => {
|
|
|
54
54
|
queryAccessKey: () => queryAccessKey,
|
|
55
55
|
queryAccount: () => queryAccount,
|
|
56
56
|
queryBlock: () => queryBlock,
|
|
57
|
-
queryRpc: () => queryRpc,
|
|
58
57
|
queryTx: () => queryTx,
|
|
59
58
|
requestSignIn: () => requestSignIn,
|
|
60
59
|
resetTxHistory: () => resetTxHistory,
|
|
60
|
+
sendRpc: () => sendRpc,
|
|
61
61
|
sendTx: () => sendTx,
|
|
62
62
|
sendTxToRpc: () => sendTxToRpc,
|
|
63
63
|
setConfig: () => setConfig,
|
|
@@ -4042,7 +4042,7 @@ var near = (() => {
|
|
|
4042
4042
|
return blockId ? { ...params, block_id: blockId } : { ...params, finality: "optimistic" };
|
|
4043
4043
|
}
|
|
4044
4044
|
__name(withBlockId, "withBlockId");
|
|
4045
|
-
async function
|
|
4045
|
+
async function sendRpc(method, params) {
|
|
4046
4046
|
const config2 = getConfig();
|
|
4047
4047
|
if (!config2?.nodeUrl) {
|
|
4048
4048
|
throw new Error("fastnear: getConfig() returned invalid config: missing nodeUrl.");
|
|
@@ -4061,17 +4061,17 @@ var near = (() => {
|
|
|
4061
4061
|
if (result.error) {
|
|
4062
4062
|
throw new Error(JSON.stringify(result.error));
|
|
4063
4063
|
}
|
|
4064
|
-
return result
|
|
4064
|
+
return result;
|
|
4065
4065
|
}
|
|
4066
|
-
__name(
|
|
4066
|
+
__name(sendRpc, "sendRpc");
|
|
4067
4067
|
function afterTxSent(txId) {
|
|
4068
4068
|
const txHistory = getTxHistory();
|
|
4069
|
-
|
|
4069
|
+
sendRpc("tx", {
|
|
4070
4070
|
tx_hash: txHistory[txId]?.txHash,
|
|
4071
4071
|
sender_account_id: txHistory[txId]?.tx?.signerId,
|
|
4072
4072
|
wait_until: "EXECUTED_OPTIMISTIC"
|
|
4073
4073
|
}).then((result) => {
|
|
4074
|
-
const successValue = result?.status?.SuccessValue;
|
|
4074
|
+
const successValue = result?.result?.status?.SuccessValue;
|
|
4075
4075
|
updateTxHistory({
|
|
4076
4076
|
txId,
|
|
4077
4077
|
status: "Executed",
|
|
@@ -4092,7 +4092,7 @@ var near = (() => {
|
|
|
4092
4092
|
async function sendTxToRpc(signedTxBase64, waitUntil, txId) {
|
|
4093
4093
|
waitUntil = waitUntil || "INCLUDED";
|
|
4094
4094
|
try {
|
|
4095
|
-
const sendTxRes = await
|
|
4095
|
+
const sendTxRes = await sendRpc("send_tx", {
|
|
4096
4096
|
signed_tx_base64: signedTxBase64,
|
|
4097
4097
|
wait_until: waitUntil
|
|
4098
4098
|
});
|
|
@@ -4167,7 +4167,7 @@ var near = (() => {
|
|
|
4167
4167
|
blockId
|
|
4168
4168
|
}) => {
|
|
4169
4169
|
const encodedArgs = argsBase64 || (args ? toBase64(JSON.stringify(args)) : "");
|
|
4170
|
-
const
|
|
4170
|
+
const queryResult = await sendRpc(
|
|
4171
4171
|
"query",
|
|
4172
4172
|
withBlockId(
|
|
4173
4173
|
{
|
|
@@ -4179,26 +4179,26 @@ var near = (() => {
|
|
|
4179
4179
|
blockId
|
|
4180
4180
|
)
|
|
4181
4181
|
);
|
|
4182
|
-
return parseJsonFromBytes(result.result);
|
|
4182
|
+
return parseJsonFromBytes(queryResult.result.result);
|
|
4183
4183
|
}, "view");
|
|
4184
4184
|
var queryAccount = /* @__PURE__ */ __name(async ({
|
|
4185
4185
|
accountId: accountId2,
|
|
4186
4186
|
blockId
|
|
4187
4187
|
}) => {
|
|
4188
|
-
return
|
|
4188
|
+
return sendRpc(
|
|
4189
4189
|
"query",
|
|
4190
4190
|
withBlockId({ request_type: "view_account", account_id: accountId2 }, blockId)
|
|
4191
4191
|
);
|
|
4192
4192
|
}, "queryAccount");
|
|
4193
4193
|
var queryBlock = /* @__PURE__ */ __name(async ({ blockId }) => {
|
|
4194
|
-
return
|
|
4194
|
+
return sendRpc("block", withBlockId({}, blockId));
|
|
4195
4195
|
}, "queryBlock");
|
|
4196
4196
|
var queryAccessKey = /* @__PURE__ */ __name(async ({
|
|
4197
4197
|
accountId: accountId2,
|
|
4198
4198
|
publicKey: publicKey2,
|
|
4199
4199
|
blockId
|
|
4200
4200
|
}) => {
|
|
4201
|
-
return
|
|
4201
|
+
return sendRpc(
|
|
4202
4202
|
"query",
|
|
4203
4203
|
withBlockId(
|
|
4204
4204
|
{ request_type: "view_access_key", account_id: accountId2, public_key: publicKey2 },
|
|
@@ -4207,7 +4207,7 @@ var near = (() => {
|
|
|
4207
4207
|
);
|
|
4208
4208
|
}, "queryAccessKey");
|
|
4209
4209
|
var queryTx = /* @__PURE__ */ __name(async ({ txHash, accountId: accountId2 }) => {
|
|
4210
|
-
return
|
|
4210
|
+
return sendRpc("tx", [txHash, accountId2]);
|
|
4211
4211
|
}, "queryTx");
|
|
4212
4212
|
var localTxHistory = /* @__PURE__ */ __name(() => {
|
|
4213
4213
|
return getTxHistory();
|