-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: ruisantiago <ruisantiagomr@gmail.com>
- Loading branch information
1 parent
2454a1a
commit f54d753
Showing
22 changed files
with
2,044 additions
and
2,130 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
Large diffs are not rendered by default.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
export * from './WalletContext'; | ||
// export * from './MintbaseSessionContext'; | ||
// export * from './hooks/useMinter'; | ||
export * from './hooks/useTokenById'; | ||
// export * from './hooks/useTokenById'; | ||
export * from './hooks/useOwnedNftsByStores'; | ||
export * from './hooks/useNearPrice'; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { requestFromNearRpc } from '../util'; | ||
|
||
export const getBlockHash = async (): Promise<number> => { | ||
const res = await requestFromNearRpc({ | ||
jsonrpc: '2.0', | ||
id: 'dontcare', | ||
method: 'status', | ||
params: [], | ||
}); | ||
const blockHeight = res?.result?.sync_info?.latest_block_hash; | ||
if (!blockHeight) { | ||
throw new Error(`Malformed response: ${JSON.stringify(res)}`); | ||
} | ||
return blockHeight; | ||
}; |
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,15 @@ | ||
import { requestFromNearRpc } from '../util'; | ||
|
||
export const getGasPrice = async (hash: string): Promise<number> => { | ||
const res = await requestFromNearRpc({ | ||
jsonrpc: '2.0', | ||
id: 'dontcare', | ||
method: 'gas_price', | ||
params: [hash], | ||
}); | ||
const blockHeight = res?.result?.gas_price; | ||
if (!blockHeight) { | ||
throw new Error(`Malformed response: ${JSON.stringify(res)}`); | ||
} | ||
return blockHeight; | ||
}; |
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,15 @@ | ||
import { requestFromNearRpc } from '../util'; | ||
|
||
export const getLatestGasPrice = async (): Promise<number> => { | ||
const res = await requestFromNearRpc({ | ||
jsonrpc: '2.0', | ||
id: 'dontcare', | ||
method: 'gas_price', | ||
params: [null], | ||
}); | ||
const blockHeight = res?.result?.gas_price; | ||
if (!blockHeight) { | ||
throw new Error(`Malformed response: ${JSON.stringify(res)}`); | ||
} | ||
return blockHeight; | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
const path = require('path'); | ||
module.exports = { | ||
"extends": "../../.eslintrc.json", | ||
"parserOptions": { | ||
"project": path.resolve(__dirname, "../../tsconfig.lint.json") | ||
} | ||
} |
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,52 @@ | ||
# @mintbase-js/wallet | ||
|
||
This is the [Mintbase Wallet](https://wallet.mintbase.xyz/) package. | ||
|
||
## Installation and Usage | ||
|
||
The easiest way to use this package is to install it from the NPM registry, this package requires `near-api-js` v1.0.0 or above: | ||
|
||
```bash | ||
# Using Yarn | ||
yarn add near-api-js | ||
|
||
# Using NPM. | ||
npm install near-api-js | ||
|
||
# Using PNPM. | ||
pnpm install near-api-js | ||
|
||
``` | ||
```bash | ||
# Using Yarn | ||
yarn add @mintbase-js/wallet | ||
|
||
# Using NPM. | ||
npm install @mintbase-js/wallet | ||
|
||
# Using PNPM. | ||
pnpm install @mintbase-js/wallet | ||
|
||
``` | ||
|
||
Then use it in your dApp: | ||
|
||
```ts | ||
import { setupWalletSelector } from "@near-wallet-selector/core"; | ||
import { setupMintbaseWallet } from "@mintbase-js/wallet"; | ||
|
||
const mintbaseWallet = setupMintbaseWallet({ | ||
networkId: network, | ||
walletUrl: 'https://wallet.mintbase.xyz', | ||
deprecated: false, | ||
}); | ||
|
||
const selector = await setupWalletSelector({ | ||
network: "mainnet", | ||
modules: [mintbaseWallet], | ||
}); | ||
``` | ||
|
||
## License | ||
|
||
This repository is distributed under the terms of both the MIT license and the Apache License (Version 2.0). |
Oops, something went wrong.