Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update to near-api-js 4.0.2 #1411

Merged
merged 2 commits into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/payment-processor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"@requestnetwork/utils": "0.43.0",
"@superfluid-finance/sdk-core": "0.5.0",
"ethers": "5.5.1",
"near-api-js": "2.1.4",
"near-api-js": "^4.0.2",
"tslib": "2.5.0"
},
"devDependencies": {
Expand Down
6 changes: 6 additions & 0 deletions packages/payment-processor/src/payment/utils-near.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export const isNearAccountSolvent = (
const fungibleContract = new Contract(nearWalletConnection.account(), token.value, {
changeMethods: [],
viewMethods: ['ft_balance_of'],
useLocalViewExecution: true,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This parameter was added in near/near-api-js#1172. I don't fully understand it, but I don't think it will break anything. It might make view functions to the same blockId more efficient.

}) as any;
return fungibleContract
.ft_balance_of({
Expand Down Expand Up @@ -88,6 +89,7 @@ export const processNearPayment = async (
{
changeMethods: ['transfer_with_reference'],
viewMethods: [],
useLocalViewExecution: true,
},
) as any;
await contract.transfer_with_reference({
Expand Down Expand Up @@ -145,6 +147,7 @@ export const processNearPaymentWithConversion = async (
{
changeMethods: ['transfer_with_reference'],
viewMethods: [],
useLocalViewExecution: true,
},
) as any;
await contract.transfer_with_reference({
Expand Down Expand Up @@ -181,6 +184,7 @@ export const processNearFungiblePayment = async (
const fungibleContract = new Contract(walletConnection.account(), currencyAddress, {
changeMethods: ['ft_transfer_call'],
viewMethods: [],
useLocalViewExecution: true,
}) as any;

const proxyAddress = erc20FeeProxyArtifact.getAddress(network, 'near');
Expand Down Expand Up @@ -224,6 +228,7 @@ export const storageDeposit = async (
const fungibleContract = new Contract(walletConnection.account(), tokenAddress, {
changeMethods: ['storage_deposit'],
viewMethods: [],
useLocalViewExecution: true,
}) as any;
await fungibleContract.storage_deposit({
args: { account_id: paymentAddress },
Expand All @@ -247,6 +252,7 @@ export const isReceiverReady = async (
const fungibleContract = new Contract(walletConnection.account(), tokenAddress, {
changeMethods: [],
viewMethods: ['storage_balance_of'],
useLocalViewExecution: true,
}) as any;
const storage = (await fungibleContract.storage_balance_of({
account_id: paymentAddress,
Expand Down
Loading
Loading