Skip to content

Commit

Permalink
Merge pull request #131 from mercurial-finance/feat/deserializeMint
Browse files Browse the repository at this point in the history
Feat/added deserializeMint
  • Loading branch information
00xSam authored Oct 9, 2024
2 parents c07fe96 + 80cd87f commit 799e689
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Security

## @mercurial-finance/vault-sdk [2.2.1] - PR [#131](https://github.com/mercurial-finance/vault-sdk/pull/131)

### Added

- new utils `deserializeMint`

## @mercurial-finance/vault-sdk [2.2.0] - PR [#130](https://github.com/mercurial-finance/vault-sdk/pull/130)

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion ts-client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mercurial-finance/vault-sdk",
"version": "2.2.0",
"version": "2.2.1",
"description": "Mercurial Vault SDK is a typescript library that allows you to interact with Mercurial v2's vault.",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
Expand Down
10 changes: 10 additions & 0 deletions ts-client/src/vault/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import {
createCloseAccountInstruction,
RawAccount,
AccountLayout,
MintLayout,
RawMint,
} from '@solana/spl-token';
import {
Connection,
Expand All @@ -33,6 +35,14 @@ export const deserializeAccount = (data: Buffer | undefined): RawAccount | undef
return accountInfo;
};

export const deserializeMint = (data: Buffer | undefined): RawMint | undefined => {
if (data == undefined || data.length == 0) {
return undefined;
}
const mintInfo = MintLayout.decode(data);
return mintInfo;
};

export const getOrCreateATAInstruction = async (
tokenAddress: PublicKey,
owner: PublicKey,
Expand Down

0 comments on commit 799e689

Please sign in to comment.