@sip-protocol/sdk 0.2.3 → 0.2.4
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/browser.js +5 -4
- package/dist/browser.mjs +1 -1
- package/dist/chunk-VXSHK7US.mjs +10158 -0
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +5 -4
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
- package/src/sip.ts +6 -2
package/dist/index.d.mts
CHANGED
|
@@ -1557,9 +1557,10 @@ declare class SIP {
|
|
|
1557
1557
|
*
|
|
1558
1558
|
* @param params - Intent parameters (CreateIntentParams for production, ShieldedIntent/CreateIntentParams for demo)
|
|
1559
1559
|
* @param recipientMetaAddress - Optional stealth meta-address for privacy modes
|
|
1560
|
+
* @param senderAddress - Optional sender wallet address for cross-curve refunds
|
|
1560
1561
|
* @returns Array of quotes (with deposit info in production mode)
|
|
1561
1562
|
*/
|
|
1562
|
-
getQuotes(params: CreateIntentParams | ShieldedIntent, recipientMetaAddress?: StealthMetaAddress | string): Promise<ProductionQuote[]>;
|
|
1563
|
+
getQuotes(params: CreateIntentParams | ShieldedIntent, recipientMetaAddress?: StealthMetaAddress | string, senderAddress?: string): Promise<ProductionQuote[]>;
|
|
1563
1564
|
/**
|
|
1564
1565
|
* Execute an intent with a selected quote
|
|
1565
1566
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -1557,9 +1557,10 @@ declare class SIP {
|
|
|
1557
1557
|
*
|
|
1558
1558
|
* @param params - Intent parameters (CreateIntentParams for production, ShieldedIntent/CreateIntentParams for demo)
|
|
1559
1559
|
* @param recipientMetaAddress - Optional stealth meta-address for privacy modes
|
|
1560
|
+
* @param senderAddress - Optional sender wallet address for cross-curve refunds
|
|
1560
1561
|
* @returns Array of quotes (with deposit info in production mode)
|
|
1561
1562
|
*/
|
|
1562
|
-
getQuotes(params: CreateIntentParams | ShieldedIntent, recipientMetaAddress?: StealthMetaAddress | string): Promise<ProductionQuote[]>;
|
|
1563
|
+
getQuotes(params: CreateIntentParams | ShieldedIntent, recipientMetaAddress?: StealthMetaAddress | string, senderAddress?: string): Promise<ProductionQuote[]>;
|
|
1563
1564
|
/**
|
|
1564
1565
|
* Execute an intent with a selected quote
|
|
1565
1566
|
*
|
package/dist/index.js
CHANGED
|
@@ -2884,9 +2884,10 @@ var SIP = class {
|
|
|
2884
2884
|
*
|
|
2885
2885
|
* @param params - Intent parameters (CreateIntentParams for production, ShieldedIntent/CreateIntentParams for demo)
|
|
2886
2886
|
* @param recipientMetaAddress - Optional stealth meta-address for privacy modes
|
|
2887
|
+
* @param senderAddress - Optional sender wallet address for cross-curve refunds
|
|
2887
2888
|
* @returns Array of quotes (with deposit info in production mode)
|
|
2888
2889
|
*/
|
|
2889
|
-
async getQuotes(params, recipientMetaAddress) {
|
|
2890
|
+
async getQuotes(params, recipientMetaAddress, senderAddress) {
|
|
2890
2891
|
if (this.isProductionMode()) {
|
|
2891
2892
|
if (!("input" in params)) {
|
|
2892
2893
|
throw new ValidationError(
|
|
@@ -2894,7 +2895,7 @@ var SIP = class {
|
|
|
2894
2895
|
"params"
|
|
2895
2896
|
);
|
|
2896
2897
|
}
|
|
2897
|
-
return this.getQuotesProduction(params, recipientMetaAddress);
|
|
2898
|
+
return this.getQuotesProduction(params, recipientMetaAddress, senderAddress);
|
|
2898
2899
|
}
|
|
2899
2900
|
return this.getQuotesDemo(params);
|
|
2900
2901
|
}
|
|
@@ -2934,7 +2935,7 @@ var SIP = class {
|
|
|
2934
2935
|
return this.config.network;
|
|
2935
2936
|
}
|
|
2936
2937
|
// ─── Production Mode Implementation ─────────────────────────────────────────
|
|
2937
|
-
async getQuotesProduction(params, recipientMetaAddress) {
|
|
2938
|
+
async getQuotesProduction(params, recipientMetaAddress, senderAddress) {
|
|
2938
2939
|
if (!this.intentsAdapter) {
|
|
2939
2940
|
throw new ValidationError(
|
|
2940
2941
|
"NEAR Intents adapter not configured. Set intentsAdapter in config for production mode.",
|
|
@@ -2961,7 +2962,7 @@ var SIP = class {
|
|
|
2961
2962
|
const prepared = await this.intentsAdapter.prepareSwap(
|
|
2962
2963
|
swapRequest,
|
|
2963
2964
|
metaAddr,
|
|
2964
|
-
this.wallet?.address
|
|
2965
|
+
senderAddress ?? this.wallet?.address
|
|
2965
2966
|
);
|
|
2966
2967
|
const rawQuote = await this.intentsAdapter.getQuote(prepared);
|
|
2967
2968
|
this.pendingSwaps.set(requestId, {
|
package/dist/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sip-protocol/sdk",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"description": "Core SDK for Shielded Intents Protocol - Privacy layer for cross-chain transactions",
|
|
5
5
|
"author": "SIP Protocol <hello@sip-protocol.org>",
|
|
6
6
|
"homepage": "https://sip-protocol.org",
|
package/src/sip.ts
CHANGED
|
@@ -320,11 +320,13 @@ export class SIP {
|
|
|
320
320
|
*
|
|
321
321
|
* @param params - Intent parameters (CreateIntentParams for production, ShieldedIntent/CreateIntentParams for demo)
|
|
322
322
|
* @param recipientMetaAddress - Optional stealth meta-address for privacy modes
|
|
323
|
+
* @param senderAddress - Optional sender wallet address for cross-curve refunds
|
|
323
324
|
* @returns Array of quotes (with deposit info in production mode)
|
|
324
325
|
*/
|
|
325
326
|
async getQuotes(
|
|
326
327
|
params: CreateIntentParams | ShieldedIntent,
|
|
327
328
|
recipientMetaAddress?: StealthMetaAddress | string,
|
|
329
|
+
senderAddress?: string,
|
|
328
330
|
): Promise<ProductionQuote[]> {
|
|
329
331
|
// Production mode - use real NEAR Intents
|
|
330
332
|
if (this.isProductionMode()) {
|
|
@@ -335,7 +337,7 @@ export class SIP {
|
|
|
335
337
|
'params'
|
|
336
338
|
)
|
|
337
339
|
}
|
|
338
|
-
return this.getQuotesProduction(params, recipientMetaAddress)
|
|
340
|
+
return this.getQuotesProduction(params, recipientMetaAddress, senderAddress)
|
|
339
341
|
}
|
|
340
342
|
|
|
341
343
|
// Demo mode - return mock quotes
|
|
@@ -400,6 +402,7 @@ export class SIP {
|
|
|
400
402
|
private async getQuotesProduction(
|
|
401
403
|
params: CreateIntentParams,
|
|
402
404
|
recipientMetaAddress?: StealthMetaAddress | string,
|
|
405
|
+
senderAddress?: string,
|
|
403
406
|
): Promise<ProductionQuote[]> {
|
|
404
407
|
if (!this.intentsAdapter) {
|
|
405
408
|
throw new ValidationError(
|
|
@@ -437,10 +440,11 @@ export class SIP {
|
|
|
437
440
|
|
|
438
441
|
try {
|
|
439
442
|
// Get quote from 1Click API
|
|
443
|
+
// Use provided senderAddress or fallback to connected wallet address (for cross-curve refunds)
|
|
440
444
|
const prepared = await this.intentsAdapter.prepareSwap(
|
|
441
445
|
swapRequest,
|
|
442
446
|
metaAddr,
|
|
443
|
-
this.wallet?.address,
|
|
447
|
+
senderAddress ?? this.wallet?.address,
|
|
444
448
|
)
|
|
445
449
|
const rawQuote = await this.intentsAdapter.getQuote(prepared)
|
|
446
450
|
|