@neutral-trade/sdk 1.0.6 → 1.0.7
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/dist/index.d.mts +4 -0
- package/dist/index.mjs +18 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -767,6 +767,10 @@ declare function fetchReferrerStatus(rpc: ExtensionsRpc, params: {
|
|
|
767
767
|
* to verify active status and the net-deposit threshold.
|
|
768
768
|
* Deterministic eligibility failures use stable error messages; deposits below
|
|
769
769
|
* the vault minimum throw `BuilderDepositAmountTooLowError`.
|
|
770
|
+
*
|
|
771
|
+
* One transaction: bind the on-chain referrer for fee split, request the
|
|
772
|
+
* deposit, and emit the points attribution memo. Atomic — a partial link is
|
|
773
|
+
* not possible.
|
|
770
774
|
*/
|
|
771
775
|
declare function buildAttributedDepositTx(rpc: ExtensionsRpc, params: BuildAttributedDepositTxParams): Promise<Array<Instruction>>;
|
|
772
776
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -1931,6 +1931,19 @@ async function buildRequestSwitchInstructions(rpc, params) {
|
|
|
1931
1931
|
* oracle freshness, remains authoritative onchain because it can race a build.
|
|
1932
1932
|
*/
|
|
1933
1933
|
const DEFAULT_PUBLIC_KEY = "11111111111111111111111111111111";
|
|
1934
|
+
const MEMO_PROGRAM_ADDRESS = "MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr";
|
|
1935
|
+
/**
|
|
1936
|
+
* Points attribution rides the same transaction as the on-chain referral
|
|
1937
|
+
* binding, so a builder wires one call and gets both. The memo carries the
|
|
1938
|
+
* referrer address because an instruction builder has no code to carry and no
|
|
1939
|
+
* business making an HTTP call to look one up.
|
|
1940
|
+
*/
|
|
1941
|
+
function buildPointsAttributionMemoInstruction(referrer) {
|
|
1942
|
+
return {
|
|
1943
|
+
programAddress: MEMO_PROGRAM_ADDRESS,
|
|
1944
|
+
data: new TextEncoder().encode(`NT_REF=v1|op=register|ref=${referrer}`)
|
|
1945
|
+
};
|
|
1946
|
+
}
|
|
1934
1947
|
/**
|
|
1935
1948
|
* Converts the signed aggregate from one `ReferrerAccount` read into exact
|
|
1936
1949
|
* basis-point progress between two product-supplied tier thresholds.
|
|
@@ -2126,6 +2139,10 @@ async function fetchReferrerStatus(rpc, params) {
|
|
|
2126
2139
|
* to verify active status and the net-deposit threshold.
|
|
2127
2140
|
* Deterministic eligibility failures use stable error messages; deposits below
|
|
2128
2141
|
* the vault minimum throw `BuilderDepositAmountTooLowError`.
|
|
2142
|
+
*
|
|
2143
|
+
* One transaction: bind the on-chain referrer for fee split, request the
|
|
2144
|
+
* deposit, and emit the points attribution memo. Atomic — a partial link is
|
|
2145
|
+
* not possible.
|
|
2129
2146
|
*/
|
|
2130
2147
|
async function buildAttributedDepositTx(rpc, params) {
|
|
2131
2148
|
assertValidAmountRaw(params.amount);
|
|
@@ -2160,7 +2177,7 @@ async function buildAttributedDepositTx(rpc, params) {
|
|
|
2160
2177
|
}, { programAddress: resolvedVault.programAddress });
|
|
2161
2178
|
const instructions = [];
|
|
2162
2179
|
if (depositContext.initializeInstruction) instructions.push(depositContext.initializeInstruction);
|
|
2163
|
-
instructions.push(setUserReferrerInstruction, depositContext.requestInstruction);
|
|
2180
|
+
instructions.push(setUserReferrerInstruction, depositContext.requestInstruction, buildPointsAttributionMemoInstruction(referrer));
|
|
2164
2181
|
return instructions;
|
|
2165
2182
|
}
|
|
2166
2183
|
/**
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neutral-trade/sdk",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.7",
|
|
5
5
|
"description": "Neutral Trade vault registry and Codama-generated ntbundle client for @solana/kit",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://github.com/neutral-trade/sdk#readme",
|