Skip to content

Commit

Permalink
Updated example.
Browse files Browse the repository at this point in the history
  • Loading branch information
oable committed Jan 7, 2024
1 parent 5c02190 commit cdcfb67
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 16 deletions.
8 changes: 3 additions & 5 deletions examples/react/neon-transfer-react/config-overrides.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@ module.exports = function(config, env) {
...config.module,
rules: [
...config.module.rules,
{
test: /\.(m?js|ts)$/,
enforce: 'pre',
use: ['source-map-loader']
}
{ test: /\.(m?js|ts)$/, enforce: 'pre', use: ['source-map-loader'] },
{ test: /\.m?js/, type: 'javascript/auto', resolve: { fullySpecified: false } },
{ test: /\.json$/, type: 'json' }
]
},
plugins: [
Expand Down
2 changes: 1 addition & 1 deletion examples/react/neon-transfer-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
]
},
"dependencies": {
"@neonevm/token-transfer": "^3.0.0",
"@neonevm/token-transfer": "3.0.1",
"@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^13.0.0",
"@testing-library/user-event": "^13.2.1",
Expand Down
12 changes: 6 additions & 6 deletions examples/react/neon-transfer-react/src/neon-transfer-app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import React, { useCallback, useEffect, useMemo, useState } from 'react';
import { Connection, Keypair, PublicKey, Signer } from '@solana/web3.js';
import { getAssociatedTokenAddressSync } from '@solana/spl-token';
import {
createMintNeonWeb3Transaction,
createMintNeonTransactionWeb3,
createMintSolanaTransaction,
GasToken,
NEON_STATUS_DEVNET_SNAPSHOT,
NEON_TOKEN_MINT_DEVNET,
NEON_TRANSFER_CONTRACT_DEVNET,
neonNeonWeb3Transaction,
neonNeonTransactionWeb3,
NeonProgramStatus,
NeonProxyRpcApi,
neonTransferMintWeb3Transaction,
Expand Down Expand Up @@ -296,20 +296,20 @@ function NeonTransferApp() {
const associatedToken = getAssociatedTokenAddressSync(mintPubkey, solanaWallet.publicKey);
switch (splToken.symbol) {
case 'NEON': {
const transaction = await neonNeonWeb3Transaction(web3, neonWallet.address, NEON_TRANSFER_CONTRACT_DEVNET, solanaWallet.publicKey, amount);
const transaction = await neonNeonTransactionWeb3(web3, neonWallet.address, NEON_TRANSFER_CONTRACT_DEVNET, solanaWallet.publicKey, amount);
const neon = await sendSignedTransaction(web3, transaction, neonWallet);
setSignature({ neon });
break;
}
case 'SOL': {
const transaction = await neonNeonWeb3Transaction(web3, neonWallet.address, SOL_TRANSFER_CONTRACT_DEVNET, solanaWallet.publicKey, amount);
const transaction = await neonNeonTransactionWeb3(web3, neonWallet.address, SOL_TRANSFER_CONTRACT_DEVNET, solanaWallet.publicKey, amount);
const neon = await sendSignedTransaction(web3, transaction, neonWallet);
setSignature({ neon });
break;
}
case 'wSOL': {
const solanaTransaction = createMintSolanaTransaction(solanaWallet.publicKey, mintPubkey, associatedToken, NEON_STATUS_DEVNET_SNAPSHOT);
const neonTransaction = await createMintNeonWeb3Transaction(web3, neonWallet.address, associatedToken, splToken, amount);
const neonTransaction = await createMintNeonTransactionWeb3(web3, neonWallet.address, associatedToken, splToken, amount);
solanaTransaction.recentBlockhash = (await connection.getLatestBlockhash()).blockhash;
const solana = await sendTransaction(connection, solanaTransaction, [solanaSigner], true, { skipPreflight: false });
delay(1e3);
Expand All @@ -319,7 +319,7 @@ function NeonTransferApp() {
}
default: {
const solanaTransaction = createMintSolanaTransaction(solanaWallet.publicKey, mintPubkey, associatedToken, NEON_STATUS_DEVNET_SNAPSHOT);
const neonTransaction = await createMintNeonWeb3Transaction(web3, neonWallet.address, associatedToken, splToken, amount);
const neonTransaction = await createMintNeonTransactionWeb3(web3, neonWallet.address, associatedToken, splToken, amount);
solanaTransaction.recentBlockhash = (await connection.getLatestBlockhash()).blockhash;
const solana = await sendTransaction(connection, solanaTransaction, [solanaSigner], true, { skipPreflight: false });
delay(1e3);
Expand Down
8 changes: 4 additions & 4 deletions examples/react/neon-transfer-react/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1826,10 +1826,10 @@
resolved "https://registry.yarnpkg.com/@leichtgewicht/ip-codec/-/ip-codec-2.0.4.tgz#b2ac626d6cb9c8718ab459166d4bb405b8ffa78b"
integrity sha512-Hcv+nVC0kZnQ3tD9GVu5xSMR4VVYOteQIr/hwFPVEvPdlXqgGEuRjiheChHgdM+JyqdgNcmzZOX/tnl0JOiI7A==

"@neonevm/token-transfer@^3.0.0":
version "3.0.0"
resolved "https://registry.yarnpkg.com/@neonevm/token-transfer/-/token-transfer-3.0.0.tgz#d66927ae646024906c2b6089393ae4791d4c221e"
integrity sha512-H+n1sq/SAhn2PhE1dvGC1DC3n0yXzNrhsJAENG1YWgiQzDGNsLcQL0+dp64S64EAuiw5HswRrxeZF1gSA70qsg==
"@neonevm/token-transfer@3.0.1":
version "3.0.1"
resolved "https://registry.yarnpkg.com/@neonevm/token-transfer/-/token-transfer-3.0.1.tgz#691d7e4037964815151eef76591e023c8c60718c"
integrity sha512-eQDCr/30tdIQzXyuRGSnrTb3oMBCXyJjaYda3jqCrCOo+jdrIi5Xv2IUfEJE3QfH/4zwBSl4RzByH0DYCUjXxg==
dependencies:
"@solana/spl-token" "^0.3.8"
"@solana/web3.js" "^1.77.3"
Expand Down

0 comments on commit cdcfb67

Please sign in to comment.