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

Expose additional properties for dynamic airdrops and streams #273

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
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 lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"packages": [
"packages/*"
],
"version": "7.4.13",
"version": "7.4.14",
"$schema": "node_modules/lerna/schemas/lerna-schema.json"
}
2 changes: 1 addition & 1 deletion packages/common/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@streamflow/common",
"version": "7.4.13",
"version": "7.4.14",
"description": "Common utilities and types used by streamflow packages.",
"homepage": "https://github.com/streamflow-finance/js-sdk/",
"main": "./dist/esm/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/distributor/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@streamflow/distributor",
"version": "7.4.13",
"version": "7.4.14",
"description": "JavaScript SDK to interact with Streamflow Airdrop protocol.",
"homepage": "https://github.com/streamflow-finance/js-sdk/",
"main": "dist/esm/index.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ export default class SolanaAlignedDistributorClient extends BaseDistributorClien
sender: alignedProxy.admin.toBase58(),
updatePeriod: getNumberFromBN(alignedProxy.updatePeriod, ALIGNED_PRECISION_FACTOR_POW),
clawedBack: alignedProxy.distributorClawedBack,
initialDuration: alignedProxy.initialDuration.toNumber(),
initialPrice: getNumberFromBN(alignedProxy.initialPrice, ALIGNED_PRECISION_FACTOR_POW),
lastPrice: getNumberFromBN(alignedProxy.lastPrice, ALIGNED_PRECISION_FACTOR_POW),
lastDurationUpdateTs: alignedProxy.lastDurationUpdateTs.toNumber(),
};
}

Expand Down
4 changes: 4 additions & 0 deletions packages/distributor/solana/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ export interface AlignedDistributorData {
priceOracle: string | undefined;
updatePeriod: number;
clawedBack: boolean;
initialDuration: number;
initialPrice: number;
lastPrice: number;
lastDurationUpdateTs: number;
}

export interface NewAlignedDistributorArgs {
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@streamflow/eslint-config",
"version": "7.4.13",
"version": "7.4.14",
"license": "ISC",
"main": "index.js",
"files": [
Expand Down
2 changes: 1 addition & 1 deletion packages/launchpad/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@streamflow/launchpad",
"version": "7.4.13",
"version": "7.4.14",
"description": "JavaScript SDK to interact with Streamflow Launchpad protocol.",
"homepage": "https://github.com/streamflow-finance/js-sdk/",
"main": "dist/esm/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/staking/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@streamflow/staking",
"version": "7.4.13",
"version": "7.4.14",
"description": "JavaScript SDK to interact with Streamflow Staking protocol.",
"homepage": "https://github.com/streamflow-finance/js-sdk/",
"main": "dist/esm/index.js",
Expand Down
5 changes: 5 additions & 0 deletions packages/stream/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,11 @@ export type AlignedStreamData = {
oracleType: OracleTypeName;
priceOracle: string | undefined;
tickSize: number;
initialAmountPerPeriod: BN;
initialPrice: number;
lastPrice: number;
lastAmountUpdateTime: number;
initialNetAmount: BN;
};

export type AlignedStream = LinearStream & AlignedStreamData;
Expand Down
2 changes: 1 addition & 1 deletion packages/stream/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@streamflow/stream",
"version": "7.4.13",
"version": "7.4.14",
"description": "JavaScript SDK to interact with Streamflow protocol.",
"homepage": "https://github.com/streamflow-finance/js-sdk/",
"main": "./dist/esm/index.js",
Expand Down
15 changes: 15 additions & 0 deletions packages/stream/solana/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,16 @@ export class AlignedContract extends Contract implements AlignedStream {

oracleType: OracleTypeName;

initialAmountPerPeriod: BN;

initialPrice: number;

lastPrice: number;

lastAmountUpdateTime: number;

initialNetAmount: BN;

constructor(stream: DecodedStream, alignedProxy: AlignedUnlocksContract) {
super(stream);
this.minPrice = getNumberFromBN(alignedProxy.minPrice, ALIGNED_PRECISION_FACTOR_POW);
Expand All @@ -247,6 +257,11 @@ export class AlignedContract extends Contract implements AlignedStream {
this.sender = alignedProxy.sender.toBase58();
this.canceledAt = alignedProxy.streamCanceledTime.toNumber();
this.proxyAddress = stream.sender.toBase58();
this.initialAmountPerPeriod = alignedProxy.initialAmountPerPeriod;
this.initialPrice = getNumberFromBN(alignedProxy.initialPrice, ALIGNED_PRECISION_FACTOR_POW);
this.lastPrice = getNumberFromBN(alignedProxy.lastPrice, ALIGNED_PRECISION_FACTOR_POW);
this.lastAmountUpdateTime = alignedProxy.lastAmountUpdateTime.toNumber();
this.initialNetAmount = alignedProxy.initialNetAmount;
// need to call this again since minPrice and maxPrice are used in determining the type
this.type = buildStreamType(this);
this.isAligned = true;
Expand Down
Loading