Skip to content

Commit

Permalink
Migrate to @solana/buffer-layout (solana-labs#2624)
Browse files Browse the repository at this point in the history
* Update package.json

* Fix build errors

* More fixes

* Add flow definitions
  • Loading branch information
abhimanyusinghgaur authored Dec 9, 2021
1 parent 0b89615 commit e29bc53
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 74 deletions.
2 changes: 1 addition & 1 deletion token/js/client/layout.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @flow

import * as BufferLayout from 'buffer-layout';
import * as BufferLayout from '@solana/buffer-layout';

/**
* Layout for a public key
Expand Down
2 changes: 1 addition & 1 deletion token/js/client/token.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import {Buffer} from 'buffer';
import assert from 'assert';
import BN from 'bn.js';
import * as BufferLayout from 'buffer-layout';
import * as BufferLayout from '@solana/buffer-layout';
import {
Keypair,
PublicKey,
Expand Down
32 changes: 32 additions & 0 deletions token/js/flow-typed/npm/@solana/buffer-layout_vx.x.x.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// flow-typed signature: b7ffeae986a5978b6826caf9cdff226b
// flow-typed version: <<STUB>>/@solana/buffer-layout_v3.0.0/flow_v0.160.0

/**
* This is an autogenerated libdef stub for:
*
* '@solana/buffer-layout'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/

declare module '@solana/buffer-layout' {
declare module.exports: any;
}

/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module '@solana/buffer-layout/lib/Layout' {
declare module.exports: any;
}

// Filename aliases
declare module '@solana/buffer-layout/lib/Layout.js' {
declare module.exports: $Exports<'@solana/buffer-layout/lib/Layout'>;
}
53 changes: 0 additions & 53 deletions token/js/flow-typed/npm/buffer-layout_vx.x.x.js

This file was deleted.

2 changes: 1 addition & 1 deletion token/js/module.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
declare module '@solana/spl-token' {
import {Buffer} from 'buffer';
import {Layout} from 'buffer-layout';
import {Layout} from '@solana/buffer-layout';
import {
PublicKey,
Signer,
Expand Down
2 changes: 1 addition & 1 deletion token/js/module.flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import BN from 'bn.js'; // eslint-disable-line
import {Buffer} from 'buffer';
import {Layout} from 'buffer-layout';
import {Layout} from '@solana/buffer-layout';
import {Connection, PublicKey, TransactionInstruction} from '@solana/web3.js';
import type {Signer, TransactionSignature} from '@solana/web3.js';

Expand Down
15 changes: 1 addition & 14 deletions token/js/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion token/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"@solana/web3.js": "^1.21.0",
"bn.js": "^5.1.0",
"buffer": "6.0.3",
"buffer-layout": "^1.2.0",
"@solana/buffer-layout": "^3.0.0",
"dotenv": "10.0.0"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions token/js/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function generateConfig(configType, format) {
// Bundled for `Buffer` consistency
// 'bs58',
// 'buffer',
// 'buffer-layout',
// '@solana/buffer-layout',
'@solana/web3.js',
];

Expand Down Expand Up @@ -110,7 +110,7 @@ function generateConfig(configType, format) {
/@babel\/runtime/,
'assert',
'bn.js',
'buffer-layout',
'@solana/buffer-layout',
'@solana/web3.js',
];
break;
Expand Down

0 comments on commit e29bc53

Please sign in to comment.