@notabene/javascript-sdk 2.4.1 → 2.5.0

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 CHANGED
@@ -20,32 +20,50 @@ This library is the JavaScript SDK for loading the Notabene UX components in the
20
20
 
21
21
  ## Table of Contents
22
22
 
23
- - [Installation](#installation)
24
- - [Quick Start](#quick-start)
25
- - [Core Concepts](#core-concepts)
26
- - [Authentication](#authentication)
27
- - [General Component Usage](#general-component-usage)
28
- - [Embedded Component](#embedded-component)
29
- - [Dynamic updates](#dynamic-updates)
30
- - [Modal](#modal)
31
- - [Linked Component](#linked-component)
32
- - [Components](#components)
23
+ - [Notabene SafeConnect Components JavaScript SDK](#notabene-safeconnect-components-javascript-sdk)
24
+ - [Table of Contents](#table-of-contents)
25
+ - [Installation](#installation)
26
+ - [Quick Start](#quick-start)
27
+ - [Core Concepts](#core-concepts)
28
+ - [Authentication](#authentication)
29
+ - [General Component Usage](#general-component-usage)
30
+ - [Embedded Component](#embedded-component)
31
+ - [Dynamic updates](#dynamic-updates)
32
+ - [Modal](#modal)
33
+ - [Popup](#popup)
34
+ - [Linked Component](#linked-component)
35
+ - [Components](#components)
33
36
  - [Assisted Withdrawal](#assisted-withdrawal)
37
+ - [Parameters](#parameters)
38
+ - [Configuration Options](#configuration-options)
34
39
  - [Connect Wallet](#connect-wallet)
40
+ - [Parameters](#parameters-1)
41
+ - [Configuration Options](#configuration-options-1)
35
42
  - [Deposit Request](#deposit-request)
36
- - [Error handling](#error-handling)
37
- - [Transaction parameters](#transaction-parameters)
38
- - [Asset specification](#asset-specification)
39
- - [Transaction amount](#transaction-amount)
40
- - [Destination](#destination)
41
- - [Asset Price](#asset-price)
42
- - [Configuration](#configuration)
43
- - [Transaction Options](#transaction-options)
44
- - [Common use cases](#common-use-cases)
45
- - [Configuring ownership proofs](#configuring-ownership-proofs)
46
- - [Counterparty Field Properties](#counterparty-field-properties)
47
- - [Locales](#locales)
48
- - [License](#license)
43
+ - [Parameters](#parameters-2)
44
+ - [Deposit Assist](#deposit-assist)
45
+ - [Parameters](#parameters-3)
46
+ - [Error handling](#error-handling)
47
+ - [Transaction parameters](#transaction-parameters)
48
+ - [Asset specification](#asset-specification)
49
+ - [Transaction amount](#transaction-amount)
50
+ - [Destination](#destination)
51
+ - [Origin](#origin)
52
+ - [Asset Price](#asset-price)
53
+ - [Configuration](#configuration)
54
+ - [Transaction Options](#transaction-options)
55
+ - [Common use cases](#common-use-cases)
56
+ - [Only allow first party transactions](#only-allow-first-party-transactions)
57
+ - [Only VASP to VASP transactions](#only-vasp-to-vasp-transactions)
58
+ - [Only Self-hosted wallet transactions](#only-self-hosted-wallet-transactions)
59
+ - [Configuring ownership proofs](#configuring-ownership-proofs)
60
+ - [Supporting Micro Transactions (aka Satoshi tests)](#supporting-micro-transactions-aka-satoshi-tests)
61
+ - [Fallback Proof Options](#fallback-proof-options)
62
+ - [Counterparty Field Properties](#counterparty-field-properties)
63
+ - [Full Example](#full-example)
64
+ - [Field reference](#field-reference)
65
+ - [Locales](#locales)
66
+ - [License](#license)
49
67
 
50
68
  ## Installation
51
69
 
@@ -371,6 +389,33 @@ const withdrawal = notabene.createDepositRequest({
371
389
 
372
390
  If any of the required parameters are missing the component will just show the Notabene badge.
373
391
 
392
+ ## Deposit Assist
393
+
394
+ The Deposit Assist component helps you collect missing Travel Rule data after a deposit has already been recorded on-chain. For example, if the deposit arrived with incomplete originator information, you can use Deposit Assist to request this information from your end-user.
395
+
396
+ ```js
397
+ const deposit = notabene.createDepositAssist(
398
+ {
399
+ asset: 'ETH',
400
+ amountDecimal: 1.23,
401
+ origin: '0x...',
402
+ destination: '0x...',
403
+ },
404
+ {
405
+ // Optional transaction options
406
+ },
407
+ );
408
+ ```
409
+
410
+ ### Parameters
411
+
412
+ - `asset`: The cryptocurrency or token being transferred. See [Asset Specification](#asset-specification)
413
+ - `origin`: The origin or blockchain address for the deposit. See [Origin](#origin)
414
+ - `destination`: The destination or blockchain address for the deposit. See [Destination](#destination)
415
+ - `amountDecimal`: Optional amount to deposit in decimal format. See [Transaction Amount](#transaction-amount)
416
+
417
+ If any of the required parameters are missing the component will just show the Notabene badge.
418
+
374
419
  ---
375
420
 
376
421
  ## Error handling
@@ -406,6 +451,15 @@ Specify the beneficiary address as `destination` using one of the following form
406
451
  - [BIP-21](https://en.bitcoin.it/wiki/BIP_0021) Bitcoin URI
407
452
  - Native blockchain address
408
453
 
454
+ ### Origin
455
+
456
+ Specify the originator address as `origin` using one of the following formats:
457
+
458
+ - [CAIP-10](https://github.com/ChainAgnostic/CAIPs/blob/main/CAIPs/caip-10.md_) is a chain agnostic format allows you to specify the specific blockchain and address
459
+ - [EIP-3770](https://eips.ethereum.org/EIPS/eip-3770) EVM URI
460
+ - [BIP-21](https://en.bitcoin.it/wiki/BIP_0021) Bitcoin URI
461
+ - Native blockchain address
462
+
409
463
  ### Asset Price
410
464
 
411
465
  The price of the asset is used to determine certain rules based on thresholds. We recommond you pass in your price like this:
@@ -479,8 +533,8 @@ const options: TransactionOptions = {
479
533
  onlyActive: true, // Only list active VASPs - Default false
480
534
  searchable: [
481
535
  VASPSearchControl.ALLOWED, // JS: 'allowed'
482
- VASPSearchControl.PENDING // JS: 'pending'
483
- ] // Control searches for VASPs - Defaults to undefined
536
+ VASPSearchControl.PENDING, // JS: 'pending'
537
+ ], // Control searches for VASPs - Defaults to undefined
484
538
  },
485
539
  hide: [ValidationSections.ASSET, ValidationSections.DESTINATION], // Don't show specific sections of component
486
540
  },
package/dist/notabene.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var w=Object.defineProperty;var I=(t,e,r)=>e in t?w(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var o=(t,e,r)=>I(t,typeof e!="symbol"?e+"":e,r);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var c=(t=>(t.PRIVATE="WALLET",t.VASP="VASP",t))(c||{}),m=(t=>(t.NATURAL="natural",t.LEGAL="legal",t.SELF="self",t))(m||{}),u=(t=>(t.EMPTY="empty",t.VERIFY="verify",t.PENDING="pending",t.VERIFIED="verified",t.BANNED="banned",t))(u||{}),E=(t=>(t.ALLOWED="allowed",t.PENDING="pending",t))(E||{}),f=(t=>(t.ASSET="asset",t.DESTINATION="destination",t.COUNTERPARTY="counterparty",t.AGENT="agent",t))(f||{}),a=(t=>(t.COMPLETE="complete",t.RESIZE="resize",t.RESULT="result",t.READY="ready",t.INVALID="invalid",t.ERROR="error",t.CANCEL="cancel",t))(a||{}),d=(t=>(t.UPDATE="update",t.REQUEST_RESPONSE="requestResponse",t))(d||{}),p=(t=>(t.PENDING="pending",t.FAILED="rejected",t.FLAGGED="flagged",t.VERIFIED="verified",t))(p||{}),v=(t=>(t.SelfDeclaration="self-declaration",t.SIWE="siwe",t.SIWX="siwx",t.EIP191="eip-191",t.EIP712="eip-712",t.EIP1271="eip-1271",t.BIP137="bip-137",t.BIP322="bip-322",t.BIP137_XPUB="xpub",t.TIP191="tip-191",t.ED25519="ed25519",t.MicroTransfer="microtransfer",t.Screenshot="screenshot",t.Connect="connect",t))(v||{});class b{constructor(){o(this,"listeners",new Map);o(this,"port");this.handleMessage=this.handleMessage.bind(this)}setPort(e){this.port=e,this.port.onmessage=this.handleMessage,this.port.start()}on(e,r){return this.listeners.has(e)||this.listeners.set(e,new Set),this.listeners.get(e).add(r),()=>this.off(e,r)}off(e,r){const i=this.listeners.get(e);i&&(i.delete(r),i.size===0&&this.listeners.delete(e))}handleMessage(e){const r=e.data;if(typeof r=="object"&&r!==null&&"type"in r){const i=r.type,s=this.listeners.get(i);s&&s.forEach(n=>n(r))}}send(e){this.port&&this.port.postMessage(e)}}class g{constructor(e,r,i){o(this,"_url");o(this,"_value");o(this,"_options");o(this,"_errors",[]);o(this,"iframe");o(this,"eventManager");o(this,"modal");this._url=e,this._value=r,this._options=i,this.eventManager=new b,this.on(a.INVALID,s=>{s.type===a.INVALID&&(this._errors=s.errors,this._value=s.value)}),this.on(a.RESIZE,s=>{s.type===a.RESIZE&&this.iframe&&(this.iframe.style.height=`${s.height}px`)})}get url(){return this._url}get value(){return this._value}get options(){return this._options}get errors(){return this._errors}open(){document.location.href=this.url}mount(e){const r=document.querySelector(e);if(!r)throw new Error(`parentID ${e} not found`);this.embed(r)}embed(e,r=!1){var i,s;this.removeEmbed(),this.iframe=document.createElement("iframe"),this.iframe.src=this.url+(r?"":"&embedded=true"),this.iframe.allow="web-share; clipboard-write; hid; bluetooth;",this.iframe.style.width="100%",this.iframe.style.height="0px",this.iframe.style.border="none",this.iframe.style.overflow="hidden",this.iframe.scrolling="no",e.appendChild(this.iframe),window.addEventListener("message",n=>{var l,h;n.source===((l=this.iframe)==null?void 0:l.contentWindow)&&((h=this.eventManager)==null||h.setPort(n.ports[0]))}),(s=(i=this.iframe)==null?void 0:i.contentWindow)==null||s.focus()}removeEmbed(){this.iframe&&this.iframe.remove()}send(e){this.eventManager.send(e)}on(e,r){return this.eventManager.on(e,r)}off(e,r){this.eventManager.off(e,r)}update(e,r){this._value=e,r&&(this._options=r),this.send({type:d.UPDATE,value:e,options:this._options})}completion(){return new Promise((e,r)=>{let i,s,n;function l(){i&&i(),s&&s(),n&&n()}i=this.on(a.COMPLETE,h=>{e(h.response),l()}),s=this.on(a.CANCEL,()=>{r(new Error("User cancelled")),l()}),n=this.on("error",h=>{r(new Error(h.message)),l()})})}async openModal(){this.modal&&this.closeModal(),this.modal=document.createElement("dialog"),this.modal.style.border="none",this.modal.style.backgroundColor="white",this.modal.style.maxWidth="100vw",this.modal.style.maxHeight="100vh",this.modal.style.width="600px",this.modal.style.height="600px",document.body.appendChild(this.modal),this.embed(this.modal,!0);const e=this.on(a.CANCEL,()=>{this.closeModal()}),r=this.on(a.COMPLETE,()=>{this.closeModal()});return this.modal.showModal(),this.modal.addEventListener("click",()=>{this.closeModal()}),this.completion().finally(()=>{e(),r()})}closeModal(){var e;this.modal&&((e=this.modal)==null||e.close(),this.modal.remove(),this.modal=void 0)}async popup(){const e=window.open(this.url,"_blank","popup=true,width=600,height=600");window.addEventListener("message",s=>{var n;s.source===e&&(console.log("received message from popup",s.data),(n=this.eventManager)==null||n.setPort(s.ports[0]))});const r=this.on(a.CANCEL,()=>{e==null||e.close()}),i=this.on(a.COMPLETE,()=>{e==null||e.close()});return this.completion().finally(()=>{r(),i()})}}function C(t){return Object.entries(t).map(([e,r])=>{if(r==null)return;const i=encodeURIComponent(e),s=encodeURIComponent(typeof r=="object"?JSON.stringify(r):String(r));return`${i}=${s}`}).filter(e=>e!==void 0).join("&")}function U(t){const e=t.slice(1);return e?e.split("&").filter(Boolean).reduce((i,s)=>{const[n,l]=s.split("=");return n&&(i[decodeURIComponent(n)]=l?decodeURIComponent(l):""),i},{}):{}}class A{constructor(e){o(this,"nodeUrl");o(this,"authToken");o(this,"uxUrl");o(this,"theme");o(this,"locale");this.uxUrl=e.uxUrl||"https://connect.notabene.id",this.nodeUrl=e.nodeUrl,this.authToken=e.authToken,this.theme=e.theme,this.locale=e.locale}componentUrl(e,r,i,s){const n=new URL(this.uxUrl);n.pathname=e;const l=C({authToken:this.authToken,value:r,configuration:i});return n.hash=l,this.nodeUrl&&n.searchParams.set("nodeUrl",this.nodeUrl),this.theme&&n.searchParams.set("theme",JSON.stringify(this.theme)),this.locale&&n.searchParams.set("locale",this.locale),s&&(s.callback&&n.searchParams.set("callback_url",s.callback),s.redirectUri&&n.searchParams.set("redirect_uri",s.redirectUri)),n.toString()}createComponent(e,r,i,s){return new g(this.componentUrl(e,r,i,s),r,i)}createWithdrawalAssist(e,r,i){return this.createComponent("withdrawal-assist",e,r,i)}createConnectWallet(e,r,i){return this.createComponent("connect",e,r,i)}createDepositRequest(e,r,i){return this.createComponent("deposit-request",e,r,i)}}exports.AgentType=c;exports.CMType=a;exports.EmbeddedComponent=g;exports.HMType=d;exports.PersonType=m;exports.ProofStatus=p;exports.ProofTypes=v;exports.Status=u;exports.VASPSearchControl=E;exports.ValidationSections=f;exports.decodeFragmentToObject=U;exports.default=A;
1
+ "use strict";var w=Object.defineProperty;var I=(t,e,r)=>e in t?w(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var o=(t,e,r)=>I(t,typeof e!="symbol"?e+"":e,r);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var c=(t=>(t.PRIVATE="WALLET",t.VASP="VASP",t))(c||{}),m=(t=>(t.NATURAL="natural",t.LEGAL="legal",t.SELF="self",t))(m||{}),u=(t=>(t.EMPTY="empty",t.VERIFY="verify",t.PENDING="pending",t.VERIFIED="verified",t.BANNED="banned",t))(u||{}),E=(t=>(t.ALLOWED="allowed",t.PENDING="pending",t))(E||{}),f=(t=>(t.ASSET="asset",t.DESTINATION="destination",t.COUNTERPARTY="counterparty",t.AGENT="agent",t))(f||{}),a=(t=>(t.COMPLETE="complete",t.RESIZE="resize",t.RESULT="result",t.READY="ready",t.INVALID="invalid",t.ERROR="error",t.CANCEL="cancel",t))(a||{}),d=(t=>(t.UPDATE="update",t.REQUEST_RESPONSE="requestResponse",t))(d||{}),p=(t=>(t.PENDING="pending",t.FAILED="rejected",t.FLAGGED="flagged",t.VERIFIED="verified",t))(p||{}),v=(t=>(t.SelfDeclaration="self-declaration",t.SIWE="siwe",t.SIWX="siwx",t.EIP191="eip-191",t.EIP712="eip-712",t.EIP1271="eip-1271",t.BIP137="bip-137",t.BIP322="bip-322",t.BIP137_XPUB="xpub",t.TIP191="tip-191",t.ED25519="ed25519",t.MicroTransfer="microtransfer",t.Screenshot="screenshot",t.Connect="connect",t))(v||{});class b{constructor(){o(this,"listeners",new Map);o(this,"port");this.handleMessage=this.handleMessage.bind(this)}setPort(e){this.port=e,this.port.onmessage=this.handleMessage,this.port.start()}on(e,r){return this.listeners.has(e)||this.listeners.set(e,new Set),this.listeners.get(e).add(r),()=>this.off(e,r)}off(e,r){const i=this.listeners.get(e);i&&(i.delete(r),i.size===0&&this.listeners.delete(e))}handleMessage(e){const r=e.data;if(typeof r=="object"&&r!==null&&"type"in r){const i=r.type,s=this.listeners.get(i);s&&s.forEach(n=>n(r))}}send(e){this.port&&this.port.postMessage(e)}}class g{constructor(e,r,i){o(this,"_url");o(this,"_value");o(this,"_options");o(this,"_errors",[]);o(this,"iframe");o(this,"eventManager");o(this,"modal");this._url=e,this._value=r,this._options=i,this.eventManager=new b,this.on(a.INVALID,s=>{s.type===a.INVALID&&(this._errors=s.errors,this._value=s.value)}),this.on(a.RESIZE,s=>{s.type===a.RESIZE&&this.iframe&&(this.iframe.style.height=`${s.height}px`)})}get url(){return this._url}get value(){return this._value}get options(){return this._options}get errors(){return this._errors}open(){document.location.href=this.url}mount(e){const r=document.querySelector(e);if(!r)throw new Error(`parentID ${e} not found`);this.embed(r)}embed(e,r=!1){var i,s;this.removeEmbed(),this.iframe=document.createElement("iframe"),this.iframe.src=this.url+(r?"":"&embedded=true"),this.iframe.allow="web-share; clipboard-write; hid; bluetooth;",this.iframe.style.width="100%",this.iframe.style.height="0px",this.iframe.style.border="none",this.iframe.style.overflow="hidden",this.iframe.scrolling="no",e.appendChild(this.iframe),window.addEventListener("message",n=>{var l,h;n.source===((l=this.iframe)==null?void 0:l.contentWindow)&&((h=this.eventManager)==null||h.setPort(n.ports[0]))}),(s=(i=this.iframe)==null?void 0:i.contentWindow)==null||s.focus()}removeEmbed(){this.iframe&&this.iframe.remove()}send(e){this.eventManager.send(e)}on(e,r){return this.eventManager.on(e,r)}off(e,r){this.eventManager.off(e,r)}update(e,r){this._value=e,r&&(this._options=r),this.send({type:d.UPDATE,value:e,options:this._options})}completion(){return new Promise((e,r)=>{let i,s,n;function l(){i&&i(),s&&s(),n&&n()}i=this.on(a.COMPLETE,h=>{e(h.response),l()}),s=this.on(a.CANCEL,()=>{r(new Error("User cancelled")),l()}),n=this.on("error",h=>{r(new Error(h.message)),l()})})}async openModal(){this.modal&&this.closeModal(),this.modal=document.createElement("dialog"),this.modal.style.border="none",this.modal.style.backgroundColor="white",this.modal.style.maxWidth="100vw",this.modal.style.maxHeight="100vh",this.modal.style.width="600px",this.modal.style.height="600px",document.body.appendChild(this.modal),this.embed(this.modal,!0);const e=this.on(a.CANCEL,()=>{this.closeModal()}),r=this.on(a.COMPLETE,()=>{this.closeModal()});return this.modal.showModal(),this.modal.addEventListener("click",()=>{this.closeModal()}),this.completion().finally(()=>{e(),r()})}closeModal(){var e;this.modal&&((e=this.modal)==null||e.close(),this.modal.remove(),this.modal=void 0)}async popup(){const e=window.open(this.url,"_blank","popup=true,width=600,height=600");window.addEventListener("message",s=>{var n;s.source===e&&(console.log("received message from popup",s.data),(n=this.eventManager)==null||n.setPort(s.ports[0]))});const r=this.on(a.CANCEL,()=>{e==null||e.close()}),i=this.on(a.COMPLETE,()=>{e==null||e.close()});return this.completion().finally(()=>{r(),i()})}}function C(t){return Object.entries(t).map(([e,r])=>{if(r==null)return;const i=encodeURIComponent(e),s=encodeURIComponent(typeof r=="object"?JSON.stringify(r):String(r));return`${i}=${s}`}).filter(e=>e!==void 0).join("&")}function A(t){const e=t.slice(1);return e?e.split("&").filter(Boolean).reduce((i,s)=>{const[n,l]=s.split("=");return n&&(i[decodeURIComponent(n)]=l?decodeURIComponent(l):""),i},{}):{}}class U{constructor(e){o(this,"nodeUrl");o(this,"authToken");o(this,"uxUrl");o(this,"theme");o(this,"locale");this.uxUrl=e.uxUrl||"https://connect.notabene.id",this.nodeUrl=e.nodeUrl,this.authToken=e.authToken,this.theme=e.theme,this.locale=e.locale}componentUrl(e,r,i,s){const n=new URL(this.uxUrl);n.pathname=e;const l=C({authToken:this.authToken,value:r,configuration:i});return n.hash=l,this.nodeUrl&&n.searchParams.set("nodeUrl",this.nodeUrl),this.theme&&n.searchParams.set("theme",JSON.stringify(this.theme)),this.locale&&n.searchParams.set("locale",this.locale),s&&(s.callback&&n.searchParams.set("callback_url",s.callback),s.redirectUri&&n.searchParams.set("redirect_uri",s.redirectUri)),n.toString()}createComponent(e,r,i,s){return new g(this.componentUrl(e,r,i,s),r,i)}createWithdrawalAssist(e,r,i){return this.createComponent("withdrawal-assist",e,r,i)}createConnectWallet(e,r,i){return this.createComponent("connect",e,r,i)}createDepositRequest(e,r,i){return this.createComponent("deposit-request",e,r,i)}createDepositAssist(e,r,i){return this.createComponent("deposit-assist",e,r,i)}}exports.AgentType=c;exports.CMType=a;exports.EmbeddedComponent=g;exports.HMType=d;exports.PersonType=m;exports.ProofStatus=p;exports.ProofTypes=v;exports.Status=u;exports.VASPSearchControl=E;exports.ValidationSections=f;exports.decodeFragmentToObject=A;exports.default=U;
@@ -550,7 +550,7 @@ declare type Error_2 = {
550
550
  };
551
551
  export { Error_2 as Error }
552
552
 
553
- declare enum ErrorIdentifierCode {
553
+ export declare enum ErrorIdentifierCode {
554
554
  SERVICE_UNAVAILABLE = "SERVICE_UNAVAILABLE",
555
555
  WALLET_CONNECTION_FAILED = "WALLET_CONNECTION_FAILED",
556
556
  WALLET_NOT_SUPPORTED = "WALLET_NOT_SUPPORTED",
@@ -1002,6 +1002,16 @@ declare class Notabene {
1002
1002
  * @public
1003
1003
  */
1004
1004
  createDepositRequest(value: DepositRequest, options?: DepositRequestOptions, callbacks?: CallbackOptions): EmbeddedComponent<DepositRequest, DepositRequestOptions>;
1005
+ /**
1006
+ * Creates a deposit assist component
1007
+ *
1008
+ * @param value - Partial deposit transaction data
1009
+ * @param options - Optional transaction options
1010
+ * @param callbacks - Optional callback configuration
1011
+ * @returns A new EmbeddedComponent instance for deposit assistance
1012
+ * @public
1013
+ */
1014
+ createDepositAssist(value: Partial<Deposit>, options?: TransactionOptions, callbacks?: CallbackOptions): EmbeddedComponent<Deposit, TransactionOptions>;
1005
1015
  }
1006
1016
  export default Notabene;
1007
1017
 
@@ -1401,6 +1411,7 @@ export declare interface TransactionOptions {
1401
1411
  * - ivms101: IVMS 101 travel rule data for the transaction
1402
1412
  * - proof: Optional ownership proof details if required
1403
1413
  * - txCreate: Optional V1 transaction payload for legacy API compatibility
1414
+ * - txUpdate: Optional V1 transaction payload for legacy API compatibility
1404
1415
  *
1405
1416
  * @typeParam V - Type of the transaction value being returned
1406
1417
  *
@@ -1415,6 +1426,7 @@ export declare interface TransactionResponse<V> extends ComponentResponse {
1415
1426
  ivms101: IVMS101;
1416
1427
  proof?: OwnershipProof;
1417
1428
  txCreate?: V1Transaction;
1429
+ txUpdate?: V1Transaction;
1418
1430
  }
1419
1431
 
1420
1432
  /**
@@ -1524,6 +1536,7 @@ export declare type V1Transaction = {
1524
1536
  originatorVASPdid: DID;
1525
1537
  beneficiaryVASPdid: DID;
1526
1538
  beneficiaryProof?: OwnershipProof;
1539
+ originatorProof?: OwnershipProof;
1527
1540
  originator?: Originator;
1528
1541
  beneficiary: Beneficiary;
1529
1542
  };
package/dist/notabene.js CHANGED
@@ -68,7 +68,7 @@ class I {
68
68
  this.port && this.port.postMessage(e);
69
69
  }
70
70
  }
71
- class U {
71
+ class C {
72
72
  /**
73
73
  * Creates an instance of EmbeddedComponent.
74
74
  * @param url - The URL of the embedded component
@@ -237,7 +237,7 @@ class U {
237
237
  });
238
238
  }
239
239
  }
240
- function b(t) {
240
+ function U(t) {
241
241
  return Object.entries(t).map(([e, r]) => {
242
242
  if (r == null) return;
243
243
  const i = encodeURIComponent(e), s = encodeURIComponent(
@@ -284,7 +284,7 @@ class A {
284
284
  componentUrl(e, r, i, s) {
285
285
  const n = new URL(this.uxUrl);
286
286
  n.pathname = e;
287
- const a = b({
287
+ const a = U({
288
288
  authToken: this.authToken,
289
289
  value: r,
290
290
  configuration: i
@@ -302,7 +302,7 @@ class A {
302
302
  * @internal
303
303
  */
304
304
  createComponent(e, r, i, s) {
305
- return new U(
305
+ return new C(
306
306
  this.componentUrl(e, r, i, s),
307
307
  r,
308
308
  i
@@ -358,11 +358,28 @@ class A {
358
358
  i
359
359
  );
360
360
  }
361
+ /**
362
+ * Creates a deposit assist component
363
+ *
364
+ * @param value - Partial deposit transaction data
365
+ * @param options - Optional transaction options
366
+ * @param callbacks - Optional callback configuration
367
+ * @returns A new EmbeddedComponent instance for deposit assistance
368
+ * @public
369
+ */
370
+ createDepositAssist(e, r, i) {
371
+ return this.createComponent(
372
+ "deposit-assist",
373
+ e,
374
+ r,
375
+ i
376
+ );
377
+ }
361
378
  }
362
379
  export {
363
380
  u as AgentType,
364
381
  h as CMType,
365
- U as EmbeddedComponent,
382
+ C as EmbeddedComponent,
366
383
  d as HMType,
367
384
  E as PersonType,
368
385
  g as ProofStatus,
package/docs/README.md CHANGED
@@ -24,32 +24,50 @@ This library is the JavaScript SDK for loading the Notabene UX components in the
24
24
 
25
25
  ## Table of Contents
26
26
 
27
- - [Installation](#installation)
28
- - [Quick Start](#quick-start)
29
- - [Core Concepts](#core-concepts)
30
- - [Authentication](#authentication)
31
- - [General Component Usage](#general-component-usage)
32
- - [Embedded Component](#embedded-component)
33
- - [Dynamic updates](#dynamic-updates)
34
- - [Modal](#modal)
35
- - [Linked Component](#linked-component)
36
- - [Components](#components)
27
+ - [Notabene SafeConnect Components JavaScript SDK](#notabene-safeconnect-components-javascript-sdk)
28
+ - [Table of Contents](#table-of-contents)
29
+ - [Installation](#installation)
30
+ - [Quick Start](#quick-start)
31
+ - [Core Concepts](#core-concepts)
32
+ - [Authentication](#authentication)
33
+ - [General Component Usage](#general-component-usage)
34
+ - [Embedded Component](#embedded-component)
35
+ - [Dynamic updates](#dynamic-updates)
36
+ - [Modal](#modal)
37
+ - [Popup](#popup)
38
+ - [Linked Component](#linked-component)
39
+ - [Components](#components)
37
40
  - [Assisted Withdrawal](#assisted-withdrawal)
41
+ - [Parameters](#parameters)
42
+ - [Configuration Options](#configuration-options)
38
43
  - [Connect Wallet](#connect-wallet)
44
+ - [Parameters](#parameters-1)
45
+ - [Configuration Options](#configuration-options-1)
39
46
  - [Deposit Request](#deposit-request)
40
- - [Error handling](#error-handling)
41
- - [Transaction parameters](#transaction-parameters)
42
- - [Asset specification](#asset-specification)
43
- - [Transaction amount](#transaction-amount)
44
- - [Destination](#destination)
45
- - [Asset Price](#asset-price)
46
- - [Configuration](#configuration)
47
- - [Transaction Options](#transaction-options)
48
- - [Common use cases](#common-use-cases)
49
- - [Configuring ownership proofs](#configuring-ownership-proofs)
50
- - [Counterparty Field Properties](#counterparty-field-properties)
51
- - [Locales](#locales)
52
- - [License](#license)
47
+ - [Parameters](#parameters-2)
48
+ - [Deposit Assist](#deposit-assist)
49
+ - [Parameters](#parameters-3)
50
+ - [Error handling](#error-handling)
51
+ - [Transaction parameters](#transaction-parameters)
52
+ - [Asset specification](#asset-specification)
53
+ - [Transaction amount](#transaction-amount)
54
+ - [Destination](#destination)
55
+ - [Origin](#origin)
56
+ - [Asset Price](#asset-price)
57
+ - [Configuration](#configuration)
58
+ - [Transaction Options](#transaction-options)
59
+ - [Common use cases](#common-use-cases)
60
+ - [Only allow first party transactions](#only-allow-first-party-transactions)
61
+ - [Only VASP to VASP transactions](#only-vasp-to-vasp-transactions)
62
+ - [Only Self-hosted wallet transactions](#only-self-hosted-wallet-transactions)
63
+ - [Configuring ownership proofs](#configuring-ownership-proofs)
64
+ - [Supporting Micro Transactions (aka Satoshi tests)](#supporting-micro-transactions-aka-satoshi-tests)
65
+ - [Fallback Proof Options](#fallback-proof-options)
66
+ - [Counterparty Field Properties](#counterparty-field-properties)
67
+ - [Full Example](#full-example)
68
+ - [Field reference](#field-reference)
69
+ - [Locales](#locales)
70
+ - [License](#license)
53
71
 
54
72
  ## Installation
55
73
 
@@ -375,6 +393,33 @@ const withdrawal = notabene.createDepositRequest({
375
393
 
376
394
  If any of the required parameters are missing the component will just show the Notabene badge.
377
395
 
396
+ ## Deposit Assist
397
+
398
+ The Deposit Assist component helps you collect missing Travel Rule data after a deposit has already been recorded on-chain. For example, if the deposit arrived with incomplete originator information, you can use Deposit Assist to request this information from your end-user.
399
+
400
+ ```js
401
+ const deposit = notabene.createDepositAssist(
402
+ {
403
+ asset: 'ETH',
404
+ amountDecimal: 1.23,
405
+ origin: '0x...',
406
+ destination: '0x...',
407
+ },
408
+ {
409
+ // Optional transaction options
410
+ },
411
+ );
412
+ ```
413
+
414
+ ### Parameters
415
+
416
+ - `asset`: The cryptocurrency or token being transferred. See [Asset Specification](#asset-specification)
417
+ - `origin`: The origin or blockchain address for the deposit. See [Origin](#origin)
418
+ - `destination`: The destination or blockchain address for the deposit. See [Destination](#destination)
419
+ - `amountDecimal`: Optional amount to deposit in decimal format. See [Transaction Amount](#transaction-amount)
420
+
421
+ If any of the required parameters are missing the component will just show the Notabene badge.
422
+
378
423
  ---
379
424
 
380
425
  ## Error handling
@@ -410,6 +455,15 @@ Specify the beneficiary address as `destination` using one of the following form
410
455
  - [BIP-21](https://en.bitcoin.it/wiki/BIP_0021) Bitcoin URI
411
456
  - Native blockchain address
412
457
 
458
+ ### Origin
459
+
460
+ Specify the originator address as `origin` using one of the following formats:
461
+
462
+ - [CAIP-10](https://github.com/ChainAgnostic/CAIPs/blob/main/CAIPs/caip-10.md_) is a chain agnostic format allows you to specify the specific blockchain and address
463
+ - [EIP-3770](https://eips.ethereum.org/EIPS/eip-3770) EVM URI
464
+ - [BIP-21](https://en.bitcoin.it/wiki/BIP_0021) Bitcoin URI
465
+ - Native blockchain address
466
+
413
467
  ### Asset Price
414
468
 
415
469
  The price of the asset is used to determine certain rules based on thresholds. We recommond you pass in your price like this:
@@ -483,8 +537,8 @@ const options: TransactionOptions = {
483
537
  onlyActive: true, // Only list active VASPs - Default false
484
538
  searchable: [
485
539
  VASPSearchControl.ALLOWED, // JS: 'allowed'
486
- VASPSearchControl.PENDING // JS: 'pending'
487
- ] // Control searches for VASPs - Defaults to undefined
540
+ VASPSearchControl.PENDING, // JS: 'pending'
541
+ ], // Control searches for VASPs - Defaults to undefined
488
542
  },
489
543
  hide: [ValidationSections.ASSET, ValidationSections.DESTINATION], // Don't show specific sections of component
490
544
  },
@@ -15,6 +15,7 @@ Extends ComponentResponse to add transaction-specific response data:
15
15
  - ivms101: IVMS 101 travel rule data for the transaction
16
16
  - proof: Optional ownership proof details if required
17
17
  - txCreate: Optional V1 transaction payload for legacy API compatibility
18
+ - txUpdate: Optional V1 transaction payload for legacy API compatibility
18
19
 
19
20
  ## See
20
21
 
@@ -32,6 +32,10 @@ Transaction payload suitable for calling Notabene v1 tx/create
32
32
 
33
33
  > `optional` **originatorEqualsBeneficiary**: `boolean`
34
34
 
35
+ ### originatorProof?
36
+
37
+ > `optional` **originatorProof**: [`OwnershipProof`](../interfaces/OwnershipProof.md)
38
+
35
39
  ### originatorVASPdid
36
40
 
37
41
  > **originatorVASPdid**: [`DID`](DID.md)
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "author": "Notabene <developers@notabene.id>",
11
11
  "license": "MIT",
12
12
  "packageManager": "yarn@4.5.1",
13
- "version": "2.4.1",
13
+ "version": "2.5.0",
14
14
  "source": "src/notabene.ts",
15
15
  "main": "dist/notabene.js",
16
16
  "types": "dist/notabene.d.ts",
@@ -6,6 +6,7 @@ import {
6
6
  arbitraryComponent,
7
7
  arbitraryConnectionOptions,
8
8
  arbitraryConnectionRequest,
9
+ arbitraryDeposit,
9
10
  arbitraryDepositRequest,
10
11
  arbitraryDepositRequestOptions,
11
12
  arbitraryLocale,
@@ -267,4 +268,39 @@ describe('Notabene', () => {
267
268
  },
268
269
  );
269
270
  });
271
+ describe('createDepositAssist', () => {
272
+ test.prop([
273
+ fc.string({ minLength: 3 }), // authToken
274
+ fc.webUrl(), // nodeUrl
275
+ arbitraryDeposit(),
276
+ arbitraryTransactionOptions(), // options
277
+ abitraryCallbackOptions(), // callbacks
278
+ ])(
279
+ 'Should create deposit assist component with correct URL',
280
+ (authToken, nodeUrl, value, options, callbacks) => {
281
+ const notabene = new Notabene({
282
+ nodeUrl,
283
+ authToken,
284
+ });
285
+
286
+ const component = notabene.createDepositAssist(
287
+ value,
288
+ options,
289
+ callbacks,
290
+ );
291
+ const url = new URL(component.url);
292
+
293
+ return (
294
+ url.pathname === '/deposit-assist' &&
295
+ url.hash ===
296
+ `#authToken=${encodeURIComponent(authToken)}&value=${encodeURIComponent(
297
+ JSON.stringify(value),
298
+ )}&configuration=${encodeURIComponent(JSON.stringify(options))}` &&
299
+ url.searchParams.get('nodeUrl') === nodeUrl &&
300
+ url.searchParams.get('callback_url') === callbacks.callback &&
301
+ url.searchParams.get('redirect_uri') === callbacks.redirectUri
302
+ );
303
+ },
304
+ );
305
+ });
270
306
  });
package/src/notabene.ts CHANGED
@@ -22,6 +22,7 @@ import type {
22
22
  DID,
23
23
  DTI,
24
24
  Error,
25
+ ErrorIdentifierCode,
25
26
  FieldTypes,
26
27
  HostMessage,
27
28
  InvalidValue,
@@ -100,6 +101,7 @@ export type {
100
101
  DID,
101
102
  DTI,
102
103
  Error,
104
+ ErrorIdentifierCode,
103
105
  FieldTypes,
104
106
  HostMessage,
105
107
  InvalidValue,
@@ -321,4 +323,26 @@ export default class Notabene {
321
323
  callbacks,
322
324
  );
323
325
  }
326
+
327
+ /**
328
+ * Creates a deposit assist component
329
+ *
330
+ * @param value - Partial deposit transaction data
331
+ * @param options - Optional transaction options
332
+ * @param callbacks - Optional callback configuration
333
+ * @returns A new EmbeddedComponent instance for deposit assistance
334
+ * @public
335
+ */
336
+ public createDepositAssist(
337
+ value: Partial<Deposit>,
338
+ options?: TransactionOptions,
339
+ callbacks?: CallbackOptions,
340
+ ) {
341
+ return this.createComponent<Deposit, TransactionOptions>(
342
+ 'deposit-assist',
343
+ value,
344
+ options,
345
+ callbacks,
346
+ );
347
+ }
324
348
  }
package/src/types.ts CHANGED
@@ -616,6 +616,7 @@ export type V1Transaction = {
616
616
  originatorVASPdid: DID;
617
617
  beneficiaryVASPdid: DID;
618
618
  beneficiaryProof?: OwnershipProof;
619
+ originatorProof?: OwnershipProof;
619
620
  originator?: Originator;
620
621
  beneficiary: Beneficiary;
621
622
  };
@@ -655,6 +656,7 @@ export interface ComponentResponse {
655
656
  * - ivms101: IVMS 101 travel rule data for the transaction
656
657
  * - proof: Optional ownership proof details if required
657
658
  * - txCreate: Optional V1 transaction payload for legacy API compatibility
659
+ * - txUpdate: Optional V1 transaction payload for legacy API compatibility
658
660
  *
659
661
  * @typeParam V - Type of the transaction value being returned
660
662
  *
@@ -669,6 +671,7 @@ export interface TransactionResponse<V> extends ComponentResponse {
669
671
  ivms101: IVMS101;
670
672
  proof?: OwnershipProof;
671
673
  txCreate?: V1Transaction;
674
+ txUpdate?: V1Transaction;
672
675
  }
673
676
 
674
677
  /**
@@ -11,6 +11,7 @@ import type {
11
11
  ConnectionRequest,
12
12
  Counterparty,
13
13
  CryptoCredential,
14
+ Deposit,
14
15
  DepositRequest,
15
16
  DepositRequestOptions,
16
17
  DID,
@@ -242,3 +243,13 @@ export const arbitraryConnectionOptions =
242
243
  proofs: transactionOptions.map((opt) => opt.proofs),
243
244
  });
244
245
  };
246
+
247
+ export const arbitraryDeposit = (): fc.Arbitrary<Deposit> =>
248
+ fc.record({
249
+ agent: arbitraryAgent(),
250
+ counterparty: arbitraryCounterparty(),
251
+ asset: arbitraryTransactionAsset(),
252
+ amountDecimal: fc.float({ min: 0, max: 1e6 }),
253
+ origin: fc.oneof(arbitraryBlockchainAddress(), arbitraryCAIP10()),
254
+ destination: fc.oneof(arbitraryBlockchainAddress(), arbitraryCAIP10()),
255
+ });