-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
v9.7.0: add Token.solana initializeAccountInstruction + closeAccountI…
…nstruction
- Loading branch information
1 parent
4c6423b
commit 7568df3
Showing
8 changed files
with
214 additions
and
4 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
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
37 changes: 37 additions & 0 deletions
37
tests/units/platforms/solana/closeAccountInstruction.spec.js
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,37 @@ | ||
import { mock, resetMocks } from '@depay/web3-mock' | ||
import { resetCache, provider } from '@depay/web3-client' | ||
import { supported } from 'src/blockchains' | ||
import { SystemProgram } from '@depay/solana-web3.js' | ||
import { Token } from 'src' | ||
import { TOKEN_PROGRAM } from 'src/platforms/solana/constants' | ||
|
||
describe('closeAccountInstruction', () => { | ||
|
||
supported.solana.forEach((blockchain)=>{ | ||
|
||
beforeEach(resetCache) | ||
beforeEach(resetMocks) | ||
|
||
it('provides a close account instruction', async ()=> { | ||
|
||
let account = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v' | ||
let owner = '2UgCJaHU5y8NC4uWQcZYeV9a5RyYLF7iKYCybCsdFFD1' | ||
|
||
mock({ | ||
blockchain, | ||
provider: provider(blockchain), | ||
}) | ||
|
||
let instruction = await Token.solana.closeAccountInstruction({ | ||
account, | ||
owner, | ||
}) | ||
|
||
expect(instruction.keys[0].pubkey.toString()).toEqual(account) | ||
expect(instruction.keys[1].pubkey.toString()).toEqual(owner) | ||
expect(instruction.keys[2].pubkey.toString()).toEqual(owner) | ||
expect(instruction.programId.toString()).toEqual(Token.solana.TOKEN_PROGRAM) | ||
}) | ||
}) | ||
}) | ||
|
37 changes: 37 additions & 0 deletions
37
tests/units/platforms/solana/initializeAccountInstruction.spec.js
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,37 @@ | ||
import { mock, resetMocks } from '@depay/web3-mock' | ||
import { resetCache, provider } from '@depay/web3-client' | ||
import { supported } from 'src/blockchains' | ||
import { SystemProgram } from '@depay/solana-web3.js' | ||
import { Token } from 'src' | ||
import { TOKEN_PROGRAM } from 'src/platforms/solana/constants' | ||
|
||
describe('initializeAccountInstruction', () => { | ||
|
||
supported.solana.forEach((blockchain)=>{ | ||
|
||
beforeEach(resetCache) | ||
beforeEach(resetMocks) | ||
|
||
it('provides a initialize token account instruction', async ()=> { | ||
|
||
let account = 'EFjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v' | ||
let token = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v' | ||
let owner = '2UgCJaHU5y8NC4uWQcZYeV9a5RyYLF7iKYCybCsdFFD1' | ||
|
||
mock({ | ||
blockchain, | ||
provider: provider(blockchain), | ||
}) | ||
|
||
let instruction = await Token.solana.initializeAccountInstruction({ | ||
account, | ||
token, | ||
owner, | ||
}) | ||
|
||
expect(instruction.keys[0].pubkey.toString()).toEqual(account) | ||
expect(instruction.keys[1].pubkey.toString()).toEqual(token) | ||
expect(instruction.programId.toString()).toEqual(Token.solana.TOKEN_PROGRAM) | ||
}) | ||
}) | ||
}) |