@streamflow/stream 10.0.0-alpha.p313.3ce4d29 → 10.0.0-alpha.p313.4046054
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/cjs/index.cjs +138 -39
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +1 -1
- package/dist/cjs/solana/descriptor/streamflow_aligned_unlocks.d.cts +101 -1
- package/dist/cjs/solana/index.cjs +138 -39
- package/dist/cjs/solana/index.cjs.map +1 -1
- package/dist/cjs/solana/index.d.cts +3 -8
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +139 -39
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/solana/descriptor/idl/streamflow_aligned_unlocks.json +101 -1
- package/dist/esm/solana/descriptor/streamflow_aligned_unlocks.d.ts +101 -1
- package/dist/esm/solana/index.d.ts +3 -8
- package/dist/esm/solana/index.js +139 -39
- package/dist/esm/solana/index.js.map +1 -1
- package/package.json +4 -4
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"address": "aSTRM2NKoKxNnkmLWk9sz3k74gKBk9t7bpPrTGxMszH",
|
|
3
3
|
"metadata": {
|
|
4
4
|
"name": "streamflow_aligned_unlocks",
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "1.4.0",
|
|
6
6
|
"spec": "0.1.0",
|
|
7
7
|
"description": "Proxy to update unlock amount within Streamflow vesting protocol according to Token performance and other metrics"
|
|
8
8
|
},
|
|
@@ -876,6 +876,80 @@
|
|
|
876
876
|
],
|
|
877
877
|
"args": []
|
|
878
878
|
},
|
|
879
|
+
{
|
|
880
|
+
"name": "update_contract",
|
|
881
|
+
"discriminator": [
|
|
882
|
+
78,
|
|
883
|
+
184,
|
|
884
|
+
162,
|
|
885
|
+
174,
|
|
886
|
+
233,
|
|
887
|
+
5,
|
|
888
|
+
40,
|
|
889
|
+
82
|
|
890
|
+
],
|
|
891
|
+
"accounts": [
|
|
892
|
+
{
|
|
893
|
+
"name": "sender",
|
|
894
|
+
"writable": true,
|
|
895
|
+
"signer": true
|
|
896
|
+
},
|
|
897
|
+
{
|
|
898
|
+
"name": "proxy_metadata",
|
|
899
|
+
"docs": [
|
|
900
|
+
"Proxy Contract"
|
|
901
|
+
],
|
|
902
|
+
"writable": true,
|
|
903
|
+
"pda": {
|
|
904
|
+
"seeds": [
|
|
905
|
+
{
|
|
906
|
+
"kind": "const",
|
|
907
|
+
"value": [
|
|
908
|
+
99,
|
|
909
|
+
111,
|
|
910
|
+
110,
|
|
911
|
+
116,
|
|
912
|
+
114,
|
|
913
|
+
97,
|
|
914
|
+
99,
|
|
915
|
+
116
|
|
916
|
+
]
|
|
917
|
+
},
|
|
918
|
+
{
|
|
919
|
+
"kind": "account",
|
|
920
|
+
"path": "stream_metadata"
|
|
921
|
+
}
|
|
922
|
+
]
|
|
923
|
+
}
|
|
924
|
+
},
|
|
925
|
+
{
|
|
926
|
+
"name": "stream_metadata",
|
|
927
|
+
"writable": true
|
|
928
|
+
},
|
|
929
|
+
{
|
|
930
|
+
"name": "withdrawor",
|
|
931
|
+
"writable": true
|
|
932
|
+
},
|
|
933
|
+
{
|
|
934
|
+
"name": "streamflow_program",
|
|
935
|
+
"address": "strmRqUCoQUgGUan5YhzUZa6KqdzwX5L6FpUxfmKg5m"
|
|
936
|
+
},
|
|
937
|
+
{
|
|
938
|
+
"name": "system_program",
|
|
939
|
+
"address": "11111111111111111111111111111111"
|
|
940
|
+
}
|
|
941
|
+
],
|
|
942
|
+
"args": [
|
|
943
|
+
{
|
|
944
|
+
"name": "params",
|
|
945
|
+
"type": {
|
|
946
|
+
"defined": {
|
|
947
|
+
"name": "UpdateContractParams"
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
}
|
|
951
|
+
]
|
|
952
|
+
},
|
|
879
953
|
{
|
|
880
954
|
"name": "update_test_oracle",
|
|
881
955
|
"discriminator": [
|
|
@@ -1471,6 +1545,32 @@
|
|
|
1471
1545
|
]
|
|
1472
1546
|
}
|
|
1473
1547
|
},
|
|
1548
|
+
{
|
|
1549
|
+
"name": "UpdateContractParams",
|
|
1550
|
+
"type": {
|
|
1551
|
+
"kind": "struct",
|
|
1552
|
+
"fields": [
|
|
1553
|
+
{
|
|
1554
|
+
"name": "transferable_by_sender",
|
|
1555
|
+
"type": {
|
|
1556
|
+
"option": "bool"
|
|
1557
|
+
}
|
|
1558
|
+
},
|
|
1559
|
+
{
|
|
1560
|
+
"name": "transferable_by_recipient",
|
|
1561
|
+
"type": {
|
|
1562
|
+
"option": "bool"
|
|
1563
|
+
}
|
|
1564
|
+
},
|
|
1565
|
+
{
|
|
1566
|
+
"name": "cancelable_by_sender",
|
|
1567
|
+
"type": {
|
|
1568
|
+
"option": "bool"
|
|
1569
|
+
}
|
|
1570
|
+
}
|
|
1571
|
+
]
|
|
1572
|
+
}
|
|
1573
|
+
},
|
|
1474
1574
|
{
|
|
1475
1575
|
"name": "UpdateTestOracleParams",
|
|
1476
1576
|
"type": {
|
|
@@ -8,7 +8,7 @@ type StreamflowAlignedUnlocks = {
|
|
|
8
8
|
"address": "aSTRM2NKoKxNnkmLWk9sz3k74gKBk9t7bpPrTGxMszH";
|
|
9
9
|
"metadata": {
|
|
10
10
|
"name": "streamflowAlignedUnlocks";
|
|
11
|
-
"version": "1.
|
|
11
|
+
"version": "1.4.0";
|
|
12
12
|
"spec": "0.1.0";
|
|
13
13
|
"description": "Proxy to update unlock amount within Streamflow vesting protocol according to Token performance and other metrics";
|
|
14
14
|
};
|
|
@@ -882,6 +882,80 @@ type StreamflowAlignedUnlocks = {
|
|
|
882
882
|
];
|
|
883
883
|
"args": [];
|
|
884
884
|
},
|
|
885
|
+
{
|
|
886
|
+
"name": "updateContract";
|
|
887
|
+
"discriminator": [
|
|
888
|
+
78,
|
|
889
|
+
184,
|
|
890
|
+
162,
|
|
891
|
+
174,
|
|
892
|
+
233,
|
|
893
|
+
5,
|
|
894
|
+
40,
|
|
895
|
+
82
|
|
896
|
+
];
|
|
897
|
+
"accounts": [
|
|
898
|
+
{
|
|
899
|
+
"name": "sender";
|
|
900
|
+
"writable": true;
|
|
901
|
+
"signer": true;
|
|
902
|
+
},
|
|
903
|
+
{
|
|
904
|
+
"name": "proxyMetadata";
|
|
905
|
+
"docs": [
|
|
906
|
+
"Proxy Contract"
|
|
907
|
+
];
|
|
908
|
+
"writable": true;
|
|
909
|
+
"pda": {
|
|
910
|
+
"seeds": [
|
|
911
|
+
{
|
|
912
|
+
"kind": "const";
|
|
913
|
+
"value": [
|
|
914
|
+
99,
|
|
915
|
+
111,
|
|
916
|
+
110,
|
|
917
|
+
116,
|
|
918
|
+
114,
|
|
919
|
+
97,
|
|
920
|
+
99,
|
|
921
|
+
116
|
|
922
|
+
];
|
|
923
|
+
},
|
|
924
|
+
{
|
|
925
|
+
"kind": "account";
|
|
926
|
+
"path": "streamMetadata";
|
|
927
|
+
}
|
|
928
|
+
];
|
|
929
|
+
};
|
|
930
|
+
},
|
|
931
|
+
{
|
|
932
|
+
"name": "streamMetadata";
|
|
933
|
+
"writable": true;
|
|
934
|
+
},
|
|
935
|
+
{
|
|
936
|
+
"name": "withdrawor";
|
|
937
|
+
"writable": true;
|
|
938
|
+
},
|
|
939
|
+
{
|
|
940
|
+
"name": "streamflowProgram";
|
|
941
|
+
"address": "strmRqUCoQUgGUan5YhzUZa6KqdzwX5L6FpUxfmKg5m";
|
|
942
|
+
},
|
|
943
|
+
{
|
|
944
|
+
"name": "systemProgram";
|
|
945
|
+
"address": "11111111111111111111111111111111";
|
|
946
|
+
}
|
|
947
|
+
];
|
|
948
|
+
"args": [
|
|
949
|
+
{
|
|
950
|
+
"name": "params";
|
|
951
|
+
"type": {
|
|
952
|
+
"defined": {
|
|
953
|
+
"name": "updateContractParams";
|
|
954
|
+
};
|
|
955
|
+
};
|
|
956
|
+
}
|
|
957
|
+
];
|
|
958
|
+
},
|
|
885
959
|
{
|
|
886
960
|
"name": "updateTestOracle";
|
|
887
961
|
"discriminator": [
|
|
@@ -1477,6 +1551,32 @@ type StreamflowAlignedUnlocks = {
|
|
|
1477
1551
|
];
|
|
1478
1552
|
};
|
|
1479
1553
|
},
|
|
1554
|
+
{
|
|
1555
|
+
"name": "updateContractParams";
|
|
1556
|
+
"type": {
|
|
1557
|
+
"kind": "struct";
|
|
1558
|
+
"fields": [
|
|
1559
|
+
{
|
|
1560
|
+
"name": "transferableBySender";
|
|
1561
|
+
"type": {
|
|
1562
|
+
"option": "bool";
|
|
1563
|
+
};
|
|
1564
|
+
},
|
|
1565
|
+
{
|
|
1566
|
+
"name": "transferableByRecipient";
|
|
1567
|
+
"type": {
|
|
1568
|
+
"option": "bool";
|
|
1569
|
+
};
|
|
1570
|
+
},
|
|
1571
|
+
{
|
|
1572
|
+
"name": "cancelableBySender";
|
|
1573
|
+
"type": {
|
|
1574
|
+
"option": "bool";
|
|
1575
|
+
};
|
|
1576
|
+
}
|
|
1577
|
+
];
|
|
1578
|
+
};
|
|
1579
|
+
},
|
|
1480
1580
|
{
|
|
1481
1581
|
"name": "updateTestOracleParams";
|
|
1482
1582
|
"type": {
|
|
@@ -114,7 +114,6 @@ declare enum StreamDirection {
|
|
|
114
114
|
}
|
|
115
115
|
declare enum StreamType {
|
|
116
116
|
All = "all",
|
|
117
|
-
Payment = "payment",
|
|
118
117
|
Vesting = "vesting",
|
|
119
118
|
Lock = "lock"
|
|
120
119
|
}
|
|
@@ -785,8 +784,8 @@ declare class SolanaStreamClient {
|
|
|
785
784
|
*/
|
|
786
785
|
extractErrorCode(err: Error): string | null;
|
|
787
786
|
/**
|
|
788
|
-
|
|
789
|
-
|
|
787
|
+
* Utility function that checks whether the associated stream address is an aligned unlock contract, indicated by whether the sender/creator is a PDA
|
|
788
|
+
*/
|
|
790
789
|
isAlignedUnlock(streamPublicKey: PublicKey, senderPublicKey: PublicKey): boolean;
|
|
791
790
|
/**
|
|
792
791
|
* Utility function to generate metadata for a Contract or return existing Pubkey
|
|
@@ -994,11 +993,7 @@ declare const isCliffCloseToDepositedAmount: (streamData: {
|
|
|
994
993
|
depositedAmount: BN;
|
|
995
994
|
cliffAmount: BN;
|
|
996
995
|
}) => boolean;
|
|
997
|
-
declare const isPayment: (streamData: {
|
|
998
|
-
canTopup: boolean;
|
|
999
|
-
}) => boolean;
|
|
1000
996
|
declare const isVesting: (streamData: {
|
|
1001
|
-
canTopup: boolean;
|
|
1002
997
|
depositedAmount: BN;
|
|
1003
998
|
cliffAmount: BN;
|
|
1004
999
|
minPrice?: number;
|
|
@@ -1131,4 +1126,4 @@ declare const _default: {
|
|
|
1131
1126
|
}[];
|
|
1132
1127
|
};
|
|
1133
1128
|
|
|
1134
|
-
export { AIRDROP_AMOUNT, AIRDROP_TEST_TOKEN, ALIGNED_COMPUTE_LIMIT, ALIGNED_PRECISION_FACTOR_POW, ALIGNED_UNLOCKS_PROGRAM_ID, type Account, AlignedContract, AlignedProxyErrorCode, type AlignedStream, type AlignedStreamData, type AlignedUnlocksContract, type BatchItem, type BatchItemError, type BatchItemResult, type BatchItemSuccess, CONTRACT_DISCRIMINATOR, CONTRACT_SEED, CREATE_PARAMS_PADDING, type ChangeOracleParams, type ClientCreationOptions, Contract, ContractErrorCode, type CreateParams, type CreateTestOracleParams, DEFAULT_STREAMFLOW_FEE, type DecodedStream, ESCROW_SEED, FEES_METADATA_SEED, FEE_ORACLE_PUBLIC_KEY, type IAlignedStreamConfig, type IBaseStreamConfig, type ICancelData, type ICreateAlignedStreamData, type ICreateExt, type ICreateLinearStreamData, type ICreateMultiError, type ICreateMultipleAlignedStreamData, type ICreateMultipleLinearStreamData, type ICreateMultipleStreamData, type ICreateResult, type ICreateStreamData, type ICreateStreamExt, type ICreateStreamInstructions, type IFees, type IGetAllData, type IGetFeesData, type IGetOneData, type IInteractData, type IInteractStreamExt, type IMultiTransactionResult, type IPrepareCreateStreamExt, type IPrepareStreamExt, type IRecipient, type ISearchStreams, type ITopUpData, type ITopUpStreamExt, type ITransactionExtWithInstructions, type ITransactionResult, type ITransferData, type IUpdateData, type IWithdrawData, type InstructionGenerator, type LinearStream, MAX_SAFE_UNIX_TIME_VALUE, type MetadataRecipientHashMap, ORIGINAL_CONTRACT_SENDER_OFFSET, type OracleType, type OracleTypeName, PARTNERS_SCHEMA, PARTNER_ORACLE_PROGRAM_ID, PARTNER_SCHEMA, PROGRAM_ID, SOLANA_ERROR_MAP, SOLANA_ERROR_MATCH_REGEX, STREAMFLOW_TREASURY_PUBLIC_KEY, STREAM_STRUCT_OFFSETS, STREAM_STRUCT_OFFSET_CLOSED, STREAM_STRUCT_OFFSET_MINT, STREAM_STRUCT_OFFSET_RECIPIENT, STREAM_STRUCT_OFFSET_SENDER, SolanaStreamClient, type Stream, type StreamClientOptions, StreamDirection, StreamType, TEST_ORACLE_DISCRIMINATOR, TEST_ORACLE_SEED, TX_FINALITY_CONFIRMED, type TestOracle, type TransactionSchedulingOptions, type UpdateTestOracleParams, WITHDRAWOR_PUBLIC_KEY, WITHDRAW_AVAILABLE_AMOUNT, buildStreamType, calculateTotalAmountToDeposit, calculateUnlockedAmount, cancelStreamInstruction, createStreamInstruction, createUncheckedStreamInstruction, decodeEndTime, decodeStream, deriveContractPDA, deriveEscrowPDA, deriveTestOraclePDA, extractSolanaErrorCode, handleContractError, isAligned, isCliffCloseToDepositedAmount, isCreateAlignedStreamData, isDynamicLock,
|
|
1129
|
+
export { AIRDROP_AMOUNT, AIRDROP_TEST_TOKEN, ALIGNED_COMPUTE_LIMIT, ALIGNED_PRECISION_FACTOR_POW, ALIGNED_UNLOCKS_PROGRAM_ID, type Account, AlignedContract, AlignedProxyErrorCode, type AlignedStream, type AlignedStreamData, type AlignedUnlocksContract, type BatchItem, type BatchItemError, type BatchItemResult, type BatchItemSuccess, CONTRACT_DISCRIMINATOR, CONTRACT_SEED, CREATE_PARAMS_PADDING, type ChangeOracleParams, type ClientCreationOptions, Contract, ContractErrorCode, type CreateParams, type CreateTestOracleParams, DEFAULT_STREAMFLOW_FEE, type DecodedStream, ESCROW_SEED, FEES_METADATA_SEED, FEE_ORACLE_PUBLIC_KEY, type IAlignedStreamConfig, type IBaseStreamConfig, type ICancelData, type ICreateAlignedStreamData, type ICreateExt, type ICreateLinearStreamData, type ICreateMultiError, type ICreateMultipleAlignedStreamData, type ICreateMultipleLinearStreamData, type ICreateMultipleStreamData, type ICreateResult, type ICreateStreamData, type ICreateStreamExt, type ICreateStreamInstructions, type IFees, type IGetAllData, type IGetFeesData, type IGetOneData, type IInteractData, type IInteractStreamExt, type IMultiTransactionResult, type IPrepareCreateStreamExt, type IPrepareStreamExt, type IRecipient, type ISearchStreams, type ITopUpData, type ITopUpStreamExt, type ITransactionExtWithInstructions, type ITransactionResult, type ITransferData, type IUpdateData, type IWithdrawData, type InstructionGenerator, type LinearStream, MAX_SAFE_UNIX_TIME_VALUE, type MetadataRecipientHashMap, ORIGINAL_CONTRACT_SENDER_OFFSET, type OracleType, type OracleTypeName, PARTNERS_SCHEMA, PARTNER_ORACLE_PROGRAM_ID, PARTNER_SCHEMA, PROGRAM_ID, SOLANA_ERROR_MAP, SOLANA_ERROR_MATCH_REGEX, STREAMFLOW_TREASURY_PUBLIC_KEY, STREAM_STRUCT_OFFSETS, STREAM_STRUCT_OFFSET_CLOSED, STREAM_STRUCT_OFFSET_MINT, STREAM_STRUCT_OFFSET_RECIPIENT, STREAM_STRUCT_OFFSET_SENDER, SolanaStreamClient, type Stream, type StreamClientOptions, StreamDirection, StreamType, TEST_ORACLE_DISCRIMINATOR, TEST_ORACLE_SEED, TX_FINALITY_CONFIRMED, type TestOracle, type TransactionSchedulingOptions, type UpdateTestOracleParams, WITHDRAWOR_PUBLIC_KEY, WITHDRAW_AVAILABLE_AMOUNT, buildStreamType, calculateTotalAmountToDeposit, calculateUnlockedAmount, cancelStreamInstruction, createStreamInstruction, createUncheckedStreamInstruction, decodeEndTime, decodeStream, deriveContractPDA, deriveEscrowPDA, deriveTestOraclePDA, extractSolanaErrorCode, handleContractError, isAligned, isCliffCloseToDepositedAmount, isCreateAlignedStreamData, isDynamicLock, isTokenLock, isVesting, sendAndConfirmStreamRawTransaction, signAllTransactionWithRecipients, _default as timelockIDL, topupStreamInstruction, transferStreamInstruction, updateStreamInstruction, withdrawStreamInstruction };
|
package/dist/esm/solana/index.js
CHANGED
|
@@ -33,11 +33,8 @@ var calculateUnlockedAmount = ({
|
|
|
33
33
|
var isCliffCloseToDepositedAmount = (streamData) => {
|
|
34
34
|
return streamData.cliffAmount.gte(streamData.depositedAmount.sub(new BN3(1)));
|
|
35
35
|
};
|
|
36
|
-
var isPayment = (streamData) => {
|
|
37
|
-
return streamData.canTopup;
|
|
38
|
-
};
|
|
39
36
|
var isVesting = (streamData) => {
|
|
40
|
-
return !
|
|
37
|
+
return !isCliffCloseToDepositedAmount(streamData) && !isDynamicLock(streamData.minPrice, streamData.maxPrice, streamData.minPercentage, streamData.maxPercentage);
|
|
41
38
|
};
|
|
42
39
|
var isAligned = (stream) => {
|
|
43
40
|
return "minPrice" in stream && "maxPrice" in stream && "minPercentage" in stream && "maxPercentage" in stream;
|
|
@@ -52,13 +49,10 @@ var isTokenLock = (streamData) => {
|
|
|
52
49
|
return !streamData.canTopup && !streamData.automaticWithdrawal && !streamData.cancelableBySender && !streamData.cancelableByRecipient && !streamData.transferableBySender && (isCliffCloseToDepositedAmount(streamData) || isDynamicLock(streamData.minPrice, streamData.maxPrice, streamData.minPercentage, streamData.maxPercentage));
|
|
53
50
|
};
|
|
54
51
|
var buildStreamType = (streamData) => {
|
|
55
|
-
if (isVesting(streamData)) {
|
|
56
|
-
return "vesting" /* Vesting */;
|
|
57
|
-
}
|
|
58
52
|
if (isTokenLock(streamData)) {
|
|
59
53
|
return "lock" /* Lock */;
|
|
60
54
|
}
|
|
61
|
-
return "
|
|
55
|
+
return "vesting" /* Vesting */;
|
|
62
56
|
};
|
|
63
57
|
var decodeEndTime = (endTime) => {
|
|
64
58
|
if (endTime.gt(new BN3(MAX_SAFE_UNIX_TIME_VALUE))) {
|
|
@@ -75,7 +69,6 @@ var StreamDirection = /* @__PURE__ */ ((StreamDirection2) => {
|
|
|
75
69
|
})(StreamDirection || {});
|
|
76
70
|
var StreamType = /* @__PURE__ */ ((StreamType2) => {
|
|
77
71
|
StreamType2["All"] = "all";
|
|
78
|
-
StreamType2["Payment"] = "payment";
|
|
79
72
|
StreamType2["Vesting"] = "vesting";
|
|
80
73
|
StreamType2["Lock"] = "lock";
|
|
81
74
|
return StreamType2;
|
|
@@ -886,7 +879,7 @@ var streamflow_aligned_unlocks_default = {
|
|
|
886
879
|
address: "aSTRM2NKoKxNnkmLWk9sz3k74gKBk9t7bpPrTGxMszH",
|
|
887
880
|
metadata: {
|
|
888
881
|
name: "streamflow_aligned_unlocks",
|
|
889
|
-
version: "1.
|
|
882
|
+
version: "1.4.0",
|
|
890
883
|
spec: "0.1.0",
|
|
891
884
|
description: "Proxy to update unlock amount within Streamflow vesting protocol according to Token performance and other metrics"
|
|
892
885
|
},
|
|
@@ -1760,6 +1753,80 @@ var streamflow_aligned_unlocks_default = {
|
|
|
1760
1753
|
],
|
|
1761
1754
|
args: []
|
|
1762
1755
|
},
|
|
1756
|
+
{
|
|
1757
|
+
name: "update_contract",
|
|
1758
|
+
discriminator: [
|
|
1759
|
+
78,
|
|
1760
|
+
184,
|
|
1761
|
+
162,
|
|
1762
|
+
174,
|
|
1763
|
+
233,
|
|
1764
|
+
5,
|
|
1765
|
+
40,
|
|
1766
|
+
82
|
|
1767
|
+
],
|
|
1768
|
+
accounts: [
|
|
1769
|
+
{
|
|
1770
|
+
name: "sender",
|
|
1771
|
+
writable: true,
|
|
1772
|
+
signer: true
|
|
1773
|
+
},
|
|
1774
|
+
{
|
|
1775
|
+
name: "proxy_metadata",
|
|
1776
|
+
docs: [
|
|
1777
|
+
"Proxy Contract"
|
|
1778
|
+
],
|
|
1779
|
+
writable: true,
|
|
1780
|
+
pda: {
|
|
1781
|
+
seeds: [
|
|
1782
|
+
{
|
|
1783
|
+
kind: "const",
|
|
1784
|
+
value: [
|
|
1785
|
+
99,
|
|
1786
|
+
111,
|
|
1787
|
+
110,
|
|
1788
|
+
116,
|
|
1789
|
+
114,
|
|
1790
|
+
97,
|
|
1791
|
+
99,
|
|
1792
|
+
116
|
|
1793
|
+
]
|
|
1794
|
+
},
|
|
1795
|
+
{
|
|
1796
|
+
kind: "account",
|
|
1797
|
+
path: "stream_metadata"
|
|
1798
|
+
}
|
|
1799
|
+
]
|
|
1800
|
+
}
|
|
1801
|
+
},
|
|
1802
|
+
{
|
|
1803
|
+
name: "stream_metadata",
|
|
1804
|
+
writable: true
|
|
1805
|
+
},
|
|
1806
|
+
{
|
|
1807
|
+
name: "withdrawor",
|
|
1808
|
+
writable: true
|
|
1809
|
+
},
|
|
1810
|
+
{
|
|
1811
|
+
name: "streamflow_program",
|
|
1812
|
+
address: "strmRqUCoQUgGUan5YhzUZa6KqdzwX5L6FpUxfmKg5m"
|
|
1813
|
+
},
|
|
1814
|
+
{
|
|
1815
|
+
name: "system_program",
|
|
1816
|
+
address: "11111111111111111111111111111111"
|
|
1817
|
+
}
|
|
1818
|
+
],
|
|
1819
|
+
args: [
|
|
1820
|
+
{
|
|
1821
|
+
name: "params",
|
|
1822
|
+
type: {
|
|
1823
|
+
defined: {
|
|
1824
|
+
name: "UpdateContractParams"
|
|
1825
|
+
}
|
|
1826
|
+
}
|
|
1827
|
+
}
|
|
1828
|
+
]
|
|
1829
|
+
},
|
|
1763
1830
|
{
|
|
1764
1831
|
name: "update_test_oracle",
|
|
1765
1832
|
discriminator: [
|
|
@@ -2355,6 +2422,32 @@ var streamflow_aligned_unlocks_default = {
|
|
|
2355
2422
|
]
|
|
2356
2423
|
}
|
|
2357
2424
|
},
|
|
2425
|
+
{
|
|
2426
|
+
name: "UpdateContractParams",
|
|
2427
|
+
type: {
|
|
2428
|
+
kind: "struct",
|
|
2429
|
+
fields: [
|
|
2430
|
+
{
|
|
2431
|
+
name: "transferable_by_sender",
|
|
2432
|
+
type: {
|
|
2433
|
+
option: "bool"
|
|
2434
|
+
}
|
|
2435
|
+
},
|
|
2436
|
+
{
|
|
2437
|
+
name: "transferable_by_recipient",
|
|
2438
|
+
type: {
|
|
2439
|
+
option: "bool"
|
|
2440
|
+
}
|
|
2441
|
+
},
|
|
2442
|
+
{
|
|
2443
|
+
name: "cancelable_by_sender",
|
|
2444
|
+
type: {
|
|
2445
|
+
option: "bool"
|
|
2446
|
+
}
|
|
2447
|
+
}
|
|
2448
|
+
]
|
|
2449
|
+
}
|
|
2450
|
+
},
|
|
2358
2451
|
{
|
|
2359
2452
|
name: "UpdateTestOracleParams",
|
|
2360
2453
|
type: {
|
|
@@ -2579,7 +2672,10 @@ var SolanaStreamClient = class {
|
|
|
2579
2672
|
floorPrice
|
|
2580
2673
|
} = streamParams;
|
|
2581
2674
|
const { isNative, sender, computeLimit, computePrice, metadataPubKeys } = extParams;
|
|
2582
|
-
invariant(
|
|
2675
|
+
invariant(
|
|
2676
|
+
priceOracle || !oracleType || oracleType === "none",
|
|
2677
|
+
"Price oracle is required for the specified oracle type"
|
|
2678
|
+
);
|
|
2583
2679
|
assertHasPublicKey(sender, "Sender's PublicKey is not available, check passed wallet adapter!");
|
|
2584
2680
|
const recipientPublicKey = new PublicKey(recipient);
|
|
2585
2681
|
const mintPublicKey = isNative ? NATIVE_MINT : new PublicKey(mint);
|
|
@@ -2754,10 +2850,7 @@ var SolanaStreamClient = class {
|
|
|
2754
2850
|
* @returns Create result
|
|
2755
2851
|
*/
|
|
2756
2852
|
async createUnchecked(data, extParams) {
|
|
2757
|
-
const { ixs, metadata, metadataPubKey } = await this.prepareCreateUncheckedInstructions(
|
|
2758
|
-
data,
|
|
2759
|
-
extParams
|
|
2760
|
-
);
|
|
2853
|
+
const { ixs, metadata, metadataPubKey } = await this.prepareCreateUncheckedInstructions(data, extParams);
|
|
2761
2854
|
const { tx, hash, context } = await prepareTransaction(
|
|
2762
2855
|
this.connection,
|
|
2763
2856
|
ixs,
|
|
@@ -2909,19 +3002,10 @@ var SolanaStreamClient = class {
|
|
|
2909
3002
|
recipient: recipientData.recipient
|
|
2910
3003
|
});
|
|
2911
3004
|
}
|
|
2912
|
-
const prepareInstructions = await this.getCreateATAInstructions(
|
|
2913
|
-
[partnerPublicKey],
|
|
2914
|
-
mintPublicKey,
|
|
2915
|
-
sender,
|
|
2916
|
-
true
|
|
2917
|
-
);
|
|
3005
|
+
const prepareInstructions = await this.getCreateATAInstructions([partnerPublicKey], mintPublicKey, sender, true);
|
|
2918
3006
|
if (isNative) {
|
|
2919
3007
|
const totalDepositedAmount = recipients.reduce((acc, recipient) => recipient.amount.add(acc), new BN3(0));
|
|
2920
|
-
const nativeInstructions = await prepareWrappedAccount(
|
|
2921
|
-
this.connection,
|
|
2922
|
-
sender.publicKey,
|
|
2923
|
-
totalDepositedAmount
|
|
2924
|
-
);
|
|
3008
|
+
const nativeInstructions = await prepareWrappedAccount(this.connection, sender.publicKey, totalDepositedAmount);
|
|
2925
3009
|
prepareInstructions.push(...nativeInstructions);
|
|
2926
3010
|
}
|
|
2927
3011
|
return {
|
|
@@ -3119,10 +3203,7 @@ var SolanaStreamClient = class {
|
|
|
3119
3203
|
async withdraw({ id, amount = WITHDRAW_AVAILABLE_AMOUNT }, extParams) {
|
|
3120
3204
|
const { invoker, customInstructions } = extParams;
|
|
3121
3205
|
assertHasPublicKey(invoker, "Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
3122
|
-
const ixs = await this.prepareWithdrawInstructions(
|
|
3123
|
-
{ id, amount },
|
|
3124
|
-
extParams
|
|
3125
|
-
);
|
|
3206
|
+
const ixs = await this.prepareWithdrawInstructions({ id, amount }, extParams);
|
|
3126
3207
|
const metadata = new PublicKey(id);
|
|
3127
3208
|
await this.applyCustomAfterInstructions(ixs, customInstructions, metadata);
|
|
3128
3209
|
const { tx, hash, context } = await prepareTransaction(this.connection, ixs, invoker.publicKey);
|
|
@@ -3572,10 +3653,20 @@ var SolanaStreamClient = class {
|
|
|
3572
3653
|
const accounts = await this.connection.getProgramAccounts(this.programId, {
|
|
3573
3654
|
filters
|
|
3574
3655
|
});
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3656
|
+
const mapped = await Promise.all(
|
|
3657
|
+
accounts.map(async ({ pubkey, account }) => {
|
|
3658
|
+
const stream = decodeStream(account.data);
|
|
3659
|
+
if (this.isAlignedUnlock(pubkey, stream.sender)) {
|
|
3660
|
+
const alignedProxy = await this.alignedProxyProgram.account.contract.fetch(
|
|
3661
|
+
deriveContractPDA(this.alignedProxyProgram.programId, pubkey)
|
|
3662
|
+
);
|
|
3663
|
+
invariant(alignedProxy, "Couldn't get aligned proxy account info");
|
|
3664
|
+
return { publicKey: pubkey, account: new AlignedContract(stream, alignedProxy) };
|
|
3665
|
+
}
|
|
3666
|
+
return { publicKey: pubkey, account: new Contract(stream) };
|
|
3667
|
+
})
|
|
3668
|
+
);
|
|
3669
|
+
return mapped;
|
|
3579
3670
|
}
|
|
3580
3671
|
/**
|
|
3581
3672
|
* Attempts updating the stream auto withdrawal params and amount per period
|
|
@@ -3616,17 +3707,26 @@ var SolanaStreamClient = class {
|
|
|
3616
3707
|
const streamPublicKey = new PublicKey(data.id);
|
|
3617
3708
|
const escrow = await this.connection.getAccountInfo(streamPublicKey);
|
|
3618
3709
|
invariant(escrow, "Couldn't get account info");
|
|
3710
|
+
const { sender: senderPublicKey } = decodeStream(escrow.data);
|
|
3711
|
+
const isAlignedUnlock = this.isAlignedUnlock(streamPublicKey, senderPublicKey);
|
|
3712
|
+
if (isAlignedUnlock && (data.enableAutomaticWithdrawal !== void 0 || data.amountPerPeriod !== void 0)) {
|
|
3713
|
+
throw new Error("Automatic withdrawal and rate update are not possible in price-based vesting!");
|
|
3714
|
+
}
|
|
3619
3715
|
const ixs = prepareBaseInstructions(this.connection, {
|
|
3620
3716
|
computePrice,
|
|
3621
3717
|
computeLimit
|
|
3622
3718
|
});
|
|
3623
3719
|
ixs.push(
|
|
3624
|
-
await
|
|
3720
|
+
await (isAlignedUnlock ? this.alignedProxyProgram.methods.updateContract({
|
|
3721
|
+
transferableBySender: data.transferableBySender ?? null,
|
|
3722
|
+
transferableByRecipient: data.transferableByRecipient ?? null,
|
|
3723
|
+
cancelableBySender: data.cancelableBySender ?? null
|
|
3724
|
+
}).accounts({ sender: invoker.publicKey, streamMetadata: streamPublicKey, withdrawor: WITHDRAWOR_PUBLIC_KEY }).accountsPartial({ streamflowProgram: this.programId }).instruction() : updateStreamInstruction(data, this.programId, {
|
|
3625
3725
|
authority: invoker.publicKey,
|
|
3626
3726
|
metadata: streamPublicKey,
|
|
3627
3727
|
withdrawor: WITHDRAWOR_PUBLIC_KEY,
|
|
3628
3728
|
systemProgram: SystemProgram.programId
|
|
3629
|
-
})
|
|
3729
|
+
}))
|
|
3630
3730
|
);
|
|
3631
3731
|
return ixs;
|
|
3632
3732
|
}
|
|
@@ -3685,8 +3785,8 @@ var SolanaStreamClient = class {
|
|
|
3685
3785
|
return extractSolanaErrorCode(err.toString() ?? "Unknown error!", logs);
|
|
3686
3786
|
}
|
|
3687
3787
|
/**
|
|
3688
|
-
|
|
3689
|
-
|
|
3788
|
+
* Utility function that checks whether the associated stream address is an aligned unlock contract, indicated by whether the sender/creator is a PDA
|
|
3789
|
+
*/
|
|
3690
3790
|
isAlignedUnlock(streamPublicKey, senderPublicKey) {
|
|
3691
3791
|
const pda = deriveContractPDA(this.alignedProxyProgram.programId, streamPublicKey);
|
|
3692
3792
|
return senderPublicKey.equals(pda);
|
|
@@ -4150,6 +4250,6 @@ var timelockIDL_default = {
|
|
|
4150
4250
|
]
|
|
4151
4251
|
};
|
|
4152
4252
|
|
|
4153
|
-
export { AIRDROP_AMOUNT, AIRDROP_TEST_TOKEN, ALIGNED_COMPUTE_LIMIT, ALIGNED_PRECISION_FACTOR_POW2 as ALIGNED_PRECISION_FACTOR_POW, ALIGNED_UNLOCKS_PROGRAM_ID, AlignedContract, AlignedProxyErrorCode, CONTRACT_DISCRIMINATOR, CONTRACT_SEED, CREATE_PARAMS_PADDING, Contract, ContractErrorCode, DEFAULT_STREAMFLOW_FEE, ESCROW_SEED, FEES_METADATA_SEED, FEE_ORACLE_PUBLIC_KEY, MAX_SAFE_UNIX_TIME_VALUE2 as MAX_SAFE_UNIX_TIME_VALUE, ORIGINAL_CONTRACT_SENDER_OFFSET, PARTNERS_SCHEMA, PARTNER_ORACLE_PROGRAM_ID, PARTNER_SCHEMA, PROGRAM_ID, SOLANA_ERROR_MAP, SOLANA_ERROR_MATCH_REGEX, STREAMFLOW_TREASURY_PUBLIC_KEY, STREAM_STRUCT_OFFSETS, STREAM_STRUCT_OFFSET_CLOSED, STREAM_STRUCT_OFFSET_MINT, STREAM_STRUCT_OFFSET_RECIPIENT, STREAM_STRUCT_OFFSET_SENDER, SolanaStreamClient, StreamDirection, StreamType, TEST_ORACLE_DISCRIMINATOR, TEST_ORACLE_SEED, TX_FINALITY_CONFIRMED, WITHDRAWOR_PUBLIC_KEY, WITHDRAW_AVAILABLE_AMOUNT, buildStreamType, calculateTotalAmountToDeposit, calculateUnlockedAmount, cancelStreamInstruction, createStreamInstruction, createUncheckedStreamInstruction, decodeEndTime, decodeStream, deriveContractPDA, deriveEscrowPDA, deriveTestOraclePDA, extractSolanaErrorCode, handleContractError, isAligned, isCliffCloseToDepositedAmount, isCreateAlignedStreamData, isDynamicLock,
|
|
4253
|
+
export { AIRDROP_AMOUNT, AIRDROP_TEST_TOKEN, ALIGNED_COMPUTE_LIMIT, ALIGNED_PRECISION_FACTOR_POW2 as ALIGNED_PRECISION_FACTOR_POW, ALIGNED_UNLOCKS_PROGRAM_ID, AlignedContract, AlignedProxyErrorCode, CONTRACT_DISCRIMINATOR, CONTRACT_SEED, CREATE_PARAMS_PADDING, Contract, ContractErrorCode, DEFAULT_STREAMFLOW_FEE, ESCROW_SEED, FEES_METADATA_SEED, FEE_ORACLE_PUBLIC_KEY, MAX_SAFE_UNIX_TIME_VALUE2 as MAX_SAFE_UNIX_TIME_VALUE, ORIGINAL_CONTRACT_SENDER_OFFSET, PARTNERS_SCHEMA, PARTNER_ORACLE_PROGRAM_ID, PARTNER_SCHEMA, PROGRAM_ID, SOLANA_ERROR_MAP, SOLANA_ERROR_MATCH_REGEX, STREAMFLOW_TREASURY_PUBLIC_KEY, STREAM_STRUCT_OFFSETS, STREAM_STRUCT_OFFSET_CLOSED, STREAM_STRUCT_OFFSET_MINT, STREAM_STRUCT_OFFSET_RECIPIENT, STREAM_STRUCT_OFFSET_SENDER, SolanaStreamClient, StreamDirection, StreamType, TEST_ORACLE_DISCRIMINATOR, TEST_ORACLE_SEED, TX_FINALITY_CONFIRMED, WITHDRAWOR_PUBLIC_KEY, WITHDRAW_AVAILABLE_AMOUNT, buildStreamType, calculateTotalAmountToDeposit, calculateUnlockedAmount, cancelStreamInstruction, createStreamInstruction, createUncheckedStreamInstruction, decodeEndTime, decodeStream, deriveContractPDA, deriveEscrowPDA, deriveTestOraclePDA, extractSolanaErrorCode, handleContractError, isAligned, isCliffCloseToDepositedAmount, isCreateAlignedStreamData, isDynamicLock, isTokenLock, isVesting, sendAndConfirmStreamRawTransaction, signAllTransactionWithRecipients, timelockIDL_default as timelockIDL, topupStreamInstruction, transferStreamInstruction, updateStreamInstruction, withdrawStreamInstruction };
|
|
4154
4254
|
//# sourceMappingURL=index.js.map
|
|
4155
4255
|
//# sourceMappingURL=index.js.map
|