This repository was archived by the owner on Mar 24, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 24
@mintbase-js/rpc: add rpcUrl mandatory param #521
Merged
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
709057e
Update near-api-js to v3 (#515)
bh2smith 806a070
🤖 npm prerelease beta
mintbaseteam 16defd9
Use `mintbasev2.near` instead of `mintbase2.near` (#519)
tifrel 34483fe
🤖 npm prerelease beta
mintbaseteam d546a29
add new rpcs
rubenmarcus 7af6529
new rpc, and rpcUrl prop
rubenmarcus 5a83890
fix
rubenmarcus c4e6d51
remove props from mbjs
rubenmarcus cbd48f8
resolve all conflicts
rubenmarcus a130c4c
rpc changes
rubenmarcus 27b8392
fix react package
rubenmarcus 8332124
add data package on react
rubenmarcus 4a413c2
update lava public rpc
rubenmarcus 7fdcf40
Update packages/rpc/README.md
rubenmarcus 101e481
changes
rubenmarcus 475ed07
new rpcs
rubenmarcus f89b8d7
changes
rubenmarcus ad643d2
on
rubenmarcus 7cb6c7e
tests
rubenmarcus 9a69863
tests
rubenmarcus cbe9c90
tests
rubenmarcus 13e04fa
readme
rubenmarcus 1149567
code changes
rubenmarcus File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -5,4 +5,4 @@ | |
| "packages": [ | ||
| "packages/*" | ||
| ] | ||
| } | ||
| } | ||
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -15,4 +15,3 @@ export const tokenOwnersByMetadataIdMock = { | |
| }, | ||
| }, | ||
| }; | ||
|
|
||
2 changes: 1 addition & 1 deletion
2
packages/data/src/api/userMintedTokens/userMintedTokens.test.ts
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,21 +1,23 @@ | ||
| import BN from 'bn.js'; | ||
| import { RPC_OPTIONS, requestFromNearRpc } from '../util'; | ||
| import { Network } from '@mintbase-js/sdk'; | ||
| import { callNearRpc, } from '../util'; | ||
| import { AccountParams } from '../types'; | ||
|
|
||
| export const getBalance = async (accountId: string, network?: Network, rpc?: RPC_OPTIONS): Promise<BN> => { | ||
| const res = await requestFromNearRpc({ | ||
| jsonrpc: '2.0', | ||
| id: 'dontcare', | ||
| method: 'query', | ||
| export const getBalance = async ({ accountId, rpcUrl }: AccountParams): Promise<BN> => { | ||
|
|
||
| const res = await callNearRpc({ | ||
| params: { | ||
| request_type: 'view_account', | ||
| finality: 'final', | ||
| account_id: accountId, | ||
| }, | ||
| }, network, rpc); | ||
| request_type: 'view_account', | ||
| finality: 'final', | ||
| account_id: accountId, | ||
| }, | ||
| method:'query', | ||
| rpcUrl | ||
| }) | ||
|
|
||
| const balanceString = res?.result?.amount as string; | ||
| if (!balanceString) { | ||
| throw new Error(`Malformed response: ${JSON.stringify(res)}`); | ||
| } | ||
| return new BN(balanceString); | ||
| }; | ||
|
|
This file contains hidden or 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 hidden or 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 hidden or 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,19 +1,11 @@ | ||
| import { Network } from '@mintbase-js/sdk'; | ||
| import { RPC_OPTIONS, callViewMethod } from '../util'; | ||
| import { FTParams } from '../types'; | ||
| import { callViewMethod } from '../util'; | ||
|
|
||
| interface FTBalanceProps { | ||
| contractId: string; | ||
| accountId: string; | ||
| network?: Network; | ||
| rpc?: RPC_OPTIONS; | ||
| } | ||
|
|
||
| export const ftBalance = async ({ contractId, accountId, network, rpc }: FTBalanceProps): Promise<string> => { | ||
| export const ftBalance = async ({ contractId, accountId, rpcUrl }: FTParams): Promise<string> => { | ||
| return callViewMethod<string>({ | ||
| contractId, | ||
| method: 'ft_balance_of', | ||
| args: { account_id: accountId }, | ||
| network: network, | ||
| rpc, | ||
| rpcUrl, | ||
| }); | ||
| }; |
This file contains hidden or 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 hidden or 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 hidden or 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,16 +1,17 @@ | ||
| import { Network } from '@mintbase-js/sdk'; | ||
| import { RPC_OPTIONS, requestFromNearRpc } from '../util'; | ||
| import { callNearRpc } from '../util'; | ||
|
|
||
| export const getBlockHash = async (network?: Network, rpc?: RPC_OPTIONS): Promise<string> => { | ||
| const res = await requestFromNearRpc({ | ||
| jsonrpc: '2.0', | ||
| id: 'dontcare', | ||
| export const getBlockHash = async (rpcUrl: string): Promise<string> => { | ||
| const res = await callNearRpc({ | ||
| method: 'status', | ||
| params: [], | ||
| }, network, rpc); | ||
| rpcUrl | ||
| }, ); | ||
|
|
||
| const blockHash = (res?.result?.sync_info as {latest_block_hash: string})?.latest_block_hash; | ||
|
|
||
| if (!blockHash) { | ||
| throw new Error(`Malformed response: ${JSON.stringify(res)}`); | ||
| } | ||
|
|
||
| return blockHash; | ||
| }; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.