@sip-protocol/sdk 0.6.18 → 0.6.19
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 +19 -19
- package/dist/browser.mjs +19 -19
- package/package.json +1 -1
- package/src/proofs/browser.ts +24 -20
package/dist/browser.js
CHANGED
|
@@ -21604,7 +21604,7 @@ var BrowserNoirProvider = class _BrowserNoirProvider {
|
|
|
21604
21604
|
minimum_required: `0x${params.minimumRequired.toString(16)}`,
|
|
21605
21605
|
asset_id: `0x${this.assetIdToField(params.assetId)}`,
|
|
21606
21606
|
balance: `0x${params.balance.toString(16)}`,
|
|
21607
|
-
blinding: blindingField
|
|
21607
|
+
blinding: `0x${blindingField}`
|
|
21608
21608
|
};
|
|
21609
21609
|
onProgress?.({
|
|
21610
21610
|
stage: "witness",
|
|
@@ -21704,20 +21704,20 @@ var BrowserNoirProvider = class _BrowserNoirProvider {
|
|
|
21704
21704
|
pubKeyY = coords.y;
|
|
21705
21705
|
}
|
|
21706
21706
|
const witnessInputs = {
|
|
21707
|
-
intent_hash: intentHashField
|
|
21708
|
-
sender_commitment_x: commitmentX
|
|
21709
|
-
sender_commitment_y: commitmentY
|
|
21710
|
-
nullifier
|
|
21707
|
+
intent_hash: `0x${intentHashField}`,
|
|
21708
|
+
sender_commitment_x: `0x${commitmentX}`,
|
|
21709
|
+
sender_commitment_y: `0x${commitmentY}`,
|
|
21710
|
+
nullifier: `0x${nullifier}`,
|
|
21711
21711
|
timestamp: params.timestamp.toString(),
|
|
21712
21712
|
expiry: params.expiry.toString(),
|
|
21713
|
-
sender_address: senderAddressField
|
|
21714
|
-
sender_blinding: senderBlindingField
|
|
21715
|
-
sender_secret: senderSecretField
|
|
21713
|
+
sender_address: `0x${senderAddressField}`,
|
|
21714
|
+
sender_blinding: `0x${senderBlindingField}`,
|
|
21715
|
+
sender_secret: `0x${senderSecretField}`,
|
|
21716
21716
|
pub_key_x: pubKeyX,
|
|
21717
21717
|
pub_key_y: pubKeyY,
|
|
21718
21718
|
signature,
|
|
21719
21719
|
message_hash: messageHash,
|
|
21720
|
-
nonce: nonceField
|
|
21720
|
+
nonce: `0x${nonceField}`
|
|
21721
21721
|
};
|
|
21722
21722
|
onProgress?.({
|
|
21723
21723
|
stage: "witness",
|
|
@@ -21799,20 +21799,20 @@ var BrowserNoirProvider = class _BrowserNoirProvider {
|
|
|
21799
21799
|
const oraclePubKeyX = this.config.oraclePublicKey?.x ?? new Array(32).fill(0);
|
|
21800
21800
|
const oraclePubKeyY = this.config.oraclePublicKey?.y ?? new Array(32).fill(0);
|
|
21801
21801
|
const witnessInputs = {
|
|
21802
|
-
intent_hash: intentHashField
|
|
21803
|
-
output_commitment_x: commitmentX
|
|
21804
|
-
output_commitment_y: commitmentY
|
|
21805
|
-
recipient_stealth: recipientStealthField
|
|
21802
|
+
intent_hash: `0x${intentHashField}`,
|
|
21803
|
+
output_commitment_x: `0x${commitmentX}`,
|
|
21804
|
+
output_commitment_y: `0x${commitmentY}`,
|
|
21805
|
+
recipient_stealth: `0x${recipientStealthField}`,
|
|
21806
21806
|
min_output_amount: params.minOutputAmount.toString(),
|
|
21807
|
-
solver_id: solverId
|
|
21807
|
+
solver_id: `0x${solverId}`,
|
|
21808
21808
|
fulfillment_time: params.fulfillmentTime.toString(),
|
|
21809
21809
|
expiry: params.expiry.toString(),
|
|
21810
21810
|
output_amount: params.outputAmount.toString(),
|
|
21811
|
-
output_blinding: outputBlindingField
|
|
21812
|
-
solver_secret: solverSecretField
|
|
21813
|
-
attestation_recipient: attestationRecipientField
|
|
21811
|
+
output_blinding: `0x${outputBlindingField}`,
|
|
21812
|
+
solver_secret: `0x${solverSecretField}`,
|
|
21813
|
+
attestation_recipient: `0x${attestationRecipientField}`,
|
|
21814
21814
|
attestation_amount: attestation.amount.toString(),
|
|
21815
|
-
attestation_tx_hash: attestationTxHashField
|
|
21815
|
+
attestation_tx_hash: `0x${attestationTxHashField}`,
|
|
21816
21816
|
attestation_block: attestation.blockNumber.toString(),
|
|
21817
21817
|
oracle_signature: oracleSignature,
|
|
21818
21818
|
oracle_message_hash: oracleMessageHash,
|
|
@@ -21992,7 +21992,7 @@ var BrowserNoirProvider = class _BrowserNoirProvider {
|
|
|
21992
21992
|
for (let i = 0; i < len; i++) {
|
|
21993
21993
|
result = result * 256n + BigInt(arr[i]);
|
|
21994
21994
|
}
|
|
21995
|
-
return
|
|
21995
|
+
return result.toString(16).padStart(64, "0");
|
|
21996
21996
|
}
|
|
21997
21997
|
bigintToBytes(value, length) {
|
|
21998
21998
|
const bytes = new Uint8Array(length);
|
package/dist/browser.mjs
CHANGED
|
@@ -618,7 +618,7 @@ var BrowserNoirProvider = class _BrowserNoirProvider {
|
|
|
618
618
|
minimum_required: `0x${params.minimumRequired.toString(16)}`,
|
|
619
619
|
asset_id: `0x${this.assetIdToField(params.assetId)}`,
|
|
620
620
|
balance: `0x${params.balance.toString(16)}`,
|
|
621
|
-
blinding: blindingField
|
|
621
|
+
blinding: `0x${blindingField}`
|
|
622
622
|
};
|
|
623
623
|
onProgress?.({
|
|
624
624
|
stage: "witness",
|
|
@@ -718,20 +718,20 @@ var BrowserNoirProvider = class _BrowserNoirProvider {
|
|
|
718
718
|
pubKeyY = coords.y;
|
|
719
719
|
}
|
|
720
720
|
const witnessInputs = {
|
|
721
|
-
intent_hash: intentHashField
|
|
722
|
-
sender_commitment_x: commitmentX
|
|
723
|
-
sender_commitment_y: commitmentY
|
|
724
|
-
nullifier
|
|
721
|
+
intent_hash: `0x${intentHashField}`,
|
|
722
|
+
sender_commitment_x: `0x${commitmentX}`,
|
|
723
|
+
sender_commitment_y: `0x${commitmentY}`,
|
|
724
|
+
nullifier: `0x${nullifier}`,
|
|
725
725
|
timestamp: params.timestamp.toString(),
|
|
726
726
|
expiry: params.expiry.toString(),
|
|
727
|
-
sender_address: senderAddressField
|
|
728
|
-
sender_blinding: senderBlindingField
|
|
729
|
-
sender_secret: senderSecretField
|
|
727
|
+
sender_address: `0x${senderAddressField}`,
|
|
728
|
+
sender_blinding: `0x${senderBlindingField}`,
|
|
729
|
+
sender_secret: `0x${senderSecretField}`,
|
|
730
730
|
pub_key_x: pubKeyX,
|
|
731
731
|
pub_key_y: pubKeyY,
|
|
732
732
|
signature,
|
|
733
733
|
message_hash: messageHash,
|
|
734
|
-
nonce: nonceField
|
|
734
|
+
nonce: `0x${nonceField}`
|
|
735
735
|
};
|
|
736
736
|
onProgress?.({
|
|
737
737
|
stage: "witness",
|
|
@@ -813,20 +813,20 @@ var BrowserNoirProvider = class _BrowserNoirProvider {
|
|
|
813
813
|
const oraclePubKeyX = this.config.oraclePublicKey?.x ?? new Array(32).fill(0);
|
|
814
814
|
const oraclePubKeyY = this.config.oraclePublicKey?.y ?? new Array(32).fill(0);
|
|
815
815
|
const witnessInputs = {
|
|
816
|
-
intent_hash: intentHashField
|
|
817
|
-
output_commitment_x: commitmentX
|
|
818
|
-
output_commitment_y: commitmentY
|
|
819
|
-
recipient_stealth: recipientStealthField
|
|
816
|
+
intent_hash: `0x${intentHashField}`,
|
|
817
|
+
output_commitment_x: `0x${commitmentX}`,
|
|
818
|
+
output_commitment_y: `0x${commitmentY}`,
|
|
819
|
+
recipient_stealth: `0x${recipientStealthField}`,
|
|
820
820
|
min_output_amount: params.minOutputAmount.toString(),
|
|
821
|
-
solver_id: solverId
|
|
821
|
+
solver_id: `0x${solverId}`,
|
|
822
822
|
fulfillment_time: params.fulfillmentTime.toString(),
|
|
823
823
|
expiry: params.expiry.toString(),
|
|
824
824
|
output_amount: params.outputAmount.toString(),
|
|
825
|
-
output_blinding: outputBlindingField
|
|
826
|
-
solver_secret: solverSecretField
|
|
827
|
-
attestation_recipient: attestationRecipientField
|
|
825
|
+
output_blinding: `0x${outputBlindingField}`,
|
|
826
|
+
solver_secret: `0x${solverSecretField}`,
|
|
827
|
+
attestation_recipient: `0x${attestationRecipientField}`,
|
|
828
828
|
attestation_amount: attestation.amount.toString(),
|
|
829
|
-
attestation_tx_hash: attestationTxHashField
|
|
829
|
+
attestation_tx_hash: `0x${attestationTxHashField}`,
|
|
830
830
|
attestation_block: attestation.blockNumber.toString(),
|
|
831
831
|
oracle_signature: oracleSignature,
|
|
832
832
|
oracle_message_hash: oracleMessageHash,
|
|
@@ -1006,7 +1006,7 @@ var BrowserNoirProvider = class _BrowserNoirProvider {
|
|
|
1006
1006
|
for (let i = 0; i < len; i++) {
|
|
1007
1007
|
result = result * 256n + BigInt(arr[i]);
|
|
1008
1008
|
}
|
|
1009
|
-
return
|
|
1009
|
+
return result.toString(16).padStart(64, "0");
|
|
1010
1010
|
}
|
|
1011
1011
|
bigintToBytes(value, length) {
|
|
1012
1012
|
const bytes = new Uint8Array(length);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sip-protocol/sdk",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.19",
|
|
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/proofs/browser.ts
CHANGED
|
@@ -573,11 +573,12 @@ export class BrowserNoirProvider implements ProofProvider {
|
|
|
573
573
|
|
|
574
574
|
// Circuit signature: (minimum_required: pub Field, asset_id: pub Field, balance: Field, blinding: Field) -> [u8; 32]
|
|
575
575
|
// Using Field type for unlimited precision (handles NEAR's 24 decimals, etc.)
|
|
576
|
+
// Noir expects field values as hex strings with 0x prefix
|
|
576
577
|
const witnessInputs = {
|
|
577
578
|
minimum_required: `0x${params.minimumRequired.toString(16)}`,
|
|
578
579
|
asset_id: `0x${this.assetIdToField(params.assetId)}`,
|
|
579
580
|
balance: `0x${params.balance.toString(16)}`,
|
|
580
|
-
blinding: blindingField
|
|
581
|
+
blinding: `0x${blindingField}`,
|
|
581
582
|
}
|
|
582
583
|
|
|
583
584
|
onProgress?.({
|
|
@@ -707,21 +708,22 @@ export class BrowserNoirProvider implements ProofProvider {
|
|
|
707
708
|
pubKeyY = coords.y
|
|
708
709
|
}
|
|
709
710
|
|
|
711
|
+
// Noir expects field values as hex strings with 0x prefix
|
|
710
712
|
const witnessInputs = {
|
|
711
|
-
intent_hash: intentHashField
|
|
712
|
-
sender_commitment_x: commitmentX
|
|
713
|
-
sender_commitment_y: commitmentY
|
|
714
|
-
nullifier: nullifier
|
|
713
|
+
intent_hash: `0x${intentHashField}`,
|
|
714
|
+
sender_commitment_x: `0x${commitmentX}`,
|
|
715
|
+
sender_commitment_y: `0x${commitmentY}`,
|
|
716
|
+
nullifier: `0x${nullifier}`,
|
|
715
717
|
timestamp: params.timestamp.toString(),
|
|
716
718
|
expiry: params.expiry.toString(),
|
|
717
|
-
sender_address: senderAddressField
|
|
718
|
-
sender_blinding: senderBlindingField
|
|
719
|
-
sender_secret: senderSecretField
|
|
719
|
+
sender_address: `0x${senderAddressField}`,
|
|
720
|
+
sender_blinding: `0x${senderBlindingField}`,
|
|
721
|
+
sender_secret: `0x${senderSecretField}`,
|
|
720
722
|
pub_key_x: pubKeyX,
|
|
721
723
|
pub_key_y: pubKeyY,
|
|
722
724
|
signature: signature,
|
|
723
725
|
message_hash: messageHash,
|
|
724
|
-
nonce: nonceField
|
|
726
|
+
nonce: `0x${nonceField}`,
|
|
725
727
|
}
|
|
726
728
|
|
|
727
729
|
onProgress?.({
|
|
@@ -823,21 +825,22 @@ export class BrowserNoirProvider implements ProofProvider {
|
|
|
823
825
|
const oraclePubKeyX = this.config.oraclePublicKey?.x ?? new Array(32).fill(0)
|
|
824
826
|
const oraclePubKeyY = this.config.oraclePublicKey?.y ?? new Array(32).fill(0)
|
|
825
827
|
|
|
828
|
+
// Noir expects field values as hex strings with 0x prefix
|
|
826
829
|
const witnessInputs = {
|
|
827
|
-
intent_hash: intentHashField
|
|
828
|
-
output_commitment_x: commitmentX
|
|
829
|
-
output_commitment_y: commitmentY
|
|
830
|
-
recipient_stealth: recipientStealthField
|
|
830
|
+
intent_hash: `0x${intentHashField}`,
|
|
831
|
+
output_commitment_x: `0x${commitmentX}`,
|
|
832
|
+
output_commitment_y: `0x${commitmentY}`,
|
|
833
|
+
recipient_stealth: `0x${recipientStealthField}`,
|
|
831
834
|
min_output_amount: params.minOutputAmount.toString(),
|
|
832
|
-
solver_id: solverId
|
|
835
|
+
solver_id: `0x${solverId}`,
|
|
833
836
|
fulfillment_time: params.fulfillmentTime.toString(),
|
|
834
837
|
expiry: params.expiry.toString(),
|
|
835
838
|
output_amount: params.outputAmount.toString(),
|
|
836
|
-
output_blinding: outputBlindingField
|
|
837
|
-
solver_secret: solverSecretField
|
|
838
|
-
attestation_recipient: attestationRecipientField
|
|
839
|
+
output_blinding: `0x${outputBlindingField}`,
|
|
840
|
+
solver_secret: `0x${solverSecretField}`,
|
|
841
|
+
attestation_recipient: `0x${attestationRecipientField}`,
|
|
839
842
|
attestation_amount: attestation.amount.toString(),
|
|
840
|
-
attestation_tx_hash: attestationTxHashField
|
|
843
|
+
attestation_tx_hash: `0x${attestationTxHashField}`,
|
|
841
844
|
attestation_block: attestation.blockNumber.toString(),
|
|
842
845
|
oracle_signature: oracleSignature,
|
|
843
846
|
oracle_message_hash: oracleMessageHash,
|
|
@@ -1057,8 +1060,9 @@ export class BrowserNoirProvider implements ProofProvider {
|
|
|
1057
1060
|
for (let i = 0; i < len; i++) {
|
|
1058
1061
|
result = result * 256n + BigInt(arr[i])
|
|
1059
1062
|
}
|
|
1060
|
-
// Return hex format
|
|
1061
|
-
|
|
1063
|
+
// Return hex format WITHOUT prefix (consistent with hexToField)
|
|
1064
|
+
// Prefix is added when building witnessInputs for Noir
|
|
1065
|
+
return result.toString(16).padStart(64, '0')
|
|
1062
1066
|
}
|
|
1063
1067
|
|
|
1064
1068
|
private bigintToBytes(value: bigint, length: number): Uint8Array {
|