@notabene/javascript-sdk 2.13.0 → 2.14.0-next.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/README.md +4 -4
- package/dist/cjs/notabene.cjs +1 -1
- package/dist/cjs/notabene.d.ts +223 -0
- package/dist/cjs/package.json +6 -2
- package/dist/esm/notabene.d.ts +223 -0
- package/dist/esm/notabene.js +470 -151
- package/dist/esm/package.json +6 -2
- package/dist/notabene.d.ts +223 -0
- package/dist/notabene.js +470 -151
- package/package.json +6 -2
- package/src/ivms/index.ts +5 -0
- package/src/ivms/v2Types.ts +35 -0
- package/src/notabene.ts +12 -0
- package/src/responseTransformer/README.md +164 -0
- package/src/responseTransformer/index.ts +21 -0
- package/src/responseTransformer/mappers.ts +301 -0
- package/src/responseTransformer/transformer.ts +278 -0
- package/src/responseTransformer/types.ts +60 -0
- package/src/responseTransformer/utils.ts +61 -0
- package/src/types.ts +1 -0
package/README.md
CHANGED
|
@@ -410,7 +410,6 @@ const deposit = notabene.createDepositAssist(
|
|
|
410
410
|
asset: 'ETH',
|
|
411
411
|
amountDecimal: 1.23,
|
|
412
412
|
source: '0x...',
|
|
413
|
-
destination: '0x...',
|
|
414
413
|
transactionId: "UUID"
|
|
415
414
|
},
|
|
416
415
|
{
|
|
@@ -423,7 +422,6 @@ const deposit = notabene.createDepositAssist(
|
|
|
423
422
|
|
|
424
423
|
- `asset`: The cryptocurrency or token being transferred. See [Asset Specification](#asset-specification)
|
|
425
424
|
- `source`: The source or blockchain address for the deposit. See [Origin](#origin)
|
|
426
|
-
- `destination`: The destination or blockchain address for the deposit. See [Destination](#destination)
|
|
427
425
|
- `amountDecimal`: Optional amount to deposit in decimal format. See [Transaction Amount](#transaction-amount)
|
|
428
426
|
- `transactionId`: Optional transactionId of a Notabene transaction. Will be returned with the payload to assist updating the Transaction
|
|
429
427
|
|
|
@@ -794,7 +792,6 @@ const options: TransactionOptions = {
|
|
|
794
792
|
nationalIdentification: false,
|
|
795
793
|
countryOfRegistration: true,
|
|
796
794
|
},
|
|
797
|
-
hide: [ValidationSections.ASSET, ValidationSections.DESTINATION], // Don't show specific sections of component
|
|
798
795
|
},
|
|
799
796
|
vasps: {
|
|
800
797
|
addUnknown: true, // Allow users to add a missing VASP - Defaults to false
|
|
@@ -810,8 +807,11 @@ const options: TransactionOptions = {
|
|
|
810
807
|
PersonType.NATURAL, // JS: 'natural'
|
|
811
808
|
PersonType.SELF, // JS: 'self'
|
|
812
809
|
],
|
|
813
|
-
}
|
|
810
|
+
},
|
|
811
|
+
hide: [ValidationSections.ASSET, ValidationSections.DESTINATION], // Don't show specific sections of component
|
|
812
|
+
autoSubmit: false // Automatically sends the complete event and hides the complete button - Default false
|
|
814
813
|
};
|
|
814
|
+
|
|
815
815
|
const withdrawal = notabene.createWithdrawalAssist(tx, options);
|
|
816
816
|
```
|
|
817
817
|
|
package/dist/cjs/notabene.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var O=Object.defineProperty;var S=(e,t,n)=>t in e?O(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var a=(e,t,n)=>S(e,typeof t!="symbol"?t+"":t,n);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var A=(e=>(e.PRIVATE="WALLET",e.VASP="VASP",e))(A||{}),f=(e=>(e.NATURAL="natural",e.LEGAL="legal",e.SELF="self",e))(f||{}),w=(e=>(e.EMPTY="empty",e.VERIFY="verify",e.PENDING="pending",e.VERIFIED="verified",e.BANNED="banned",e))(w||{}),L=(e=>(e.ALLOWED="allowed",e.PENDING="pending",e))(L||{}),N=(e=>(e.SMS="sms",e.EMAIL="email",e))(N||{}),v=(e=>(e.PENDING="pending",e.APPROVED="approved",e.FAILED="failed",e.EXPIRED="expired",e.MAX_ATTEMPTS_REACHED="max_attempts_reached",e.UNREACHABLE="unreachable",e))(v||{}),I=(e=>(e.COINBASE="coinbase",e))(I||{}),g=(e=>(e.ASSET="asset",e.DESTINATION="destination",e.COUNTERPARTY="counterparty",e.AGENT="agent",e))(g||{}),l=(e=>(e.COMPLETE="complete",e.RESIZE="resize",e.RESULT="result",e.READY="ready",e.INVALID="invalid",e.ERROR="error",e.CANCEL="cancel",e.WARNING="warning",e.INFO="info",e))(l||{}),_=(e=>(e.SERVICE_UNAVAILABLE="SERVICE_UNAVAILABLE",e.WALLET_CONNECTION_FAILED="WALLET_CONNECTION_FAILED",e.WALLET_NOT_SUPPORTED="WALLET_NOT_SUPPORTED",e.TOKEN_INVALID="TOKEN_INVALID",e))(_||{}),C=(e=>(e.WALLET_ADDRESS_NOT_CONNECTED="WALLET_ADDRESS_NOT_CONNECTED",e.WALLET_LOCKED="WALLET_LOCKED",e.WALLET_UNREACHABLE="WALLET_UNREACHABLE",e.JURISDICTIONAL_REQUIREMENTS_UNAVAILABLE="JURISDICTIONAL_REQUIREMENTS_UNAVAILABLE",e.IDV_UNAVAILABLE="IDV_UNAVAILABLE",e))(C||{}),m=(e=>(e.UPDATE="update",e.REQUEST_RESPONSE="requestResponse",e))(m||{}),y=(e=>(e.PENDING="pending",e.FAILED="rejected",e.FLAGGED="flagged",e.VERIFIED="verified",e))(y||{}),D=(e=>(e.SelfDeclaration="self-declaration",e.SIWE="siwe",e.SIWX="siwx",e.SOL_SIWX="sol-siwx",e.EIP191="eip-191",e.EIP712="eip-712",e.EIP1271="eip-1271",e.BIP137="bip-137",e.BIP322="bip-322",e.BIP137_XPUB="xpub",e.TIP191="tip-191",e.ED25519="ed25519",e.XRP_ED25519="xrp-ed25519",e.XLM_ED25519="xlm-ed25519",e.CIP8="cip-8",e.COSMOS="cosmos-ecdsa",e.MicroTransfer="microtransfer",e.Screenshot="screenshot",e.Connect="connect",e.CONCORDIUM="concordium",e))(D||{});class T{constructor(){a(this,"listeners",new Map);a(this,"port");this.handleMessage=this.handleMessage.bind(this)}setPort(t){this.port=t,this.port.onmessage=this.handleMessage,this.port.start()}on(t,n){return this.listeners.has(t)||this.listeners.set(t,new Set),this.listeners.get(t).add(n),()=>this.off(t,n)}off(t,n){const r=this.listeners.get(t);r&&(r.delete(n),r.size===0&&this.listeners.delete(t))}handleMessage(t){const n=t.data;if(typeof n=="object"&&n!==null&&"type"in n){const r=n.type,s=this.listeners.get(r);s&&s.forEach(o=>o(n))}}send(t){this.port&&this.port.postMessage(t)}}class R{constructor(t,n,r){a(this,"_url");a(this,"_value");a(this,"_options");a(this,"_errors",[]);a(this,"iframe");a(this,"eventManager");a(this,"modal");this._url=t,this._value=n,this._options=r,this.eventManager=new T,this.on(l.INVALID,s=>{s.type===l.INVALID&&(this._errors=s.errors,this._value=s.value)}),this.on(l.RESIZE,s=>{s.type===l.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(t){const n=document.querySelector(t);if(!n)throw new Error(`parentID ${t} not found`);this.embed(n)}embed(t,n=!1){var r,s;this.removeEmbed(),this.iframe=document.createElement("iframe"),this.iframe.src=this.url+(n?"":"&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",t.appendChild(this.iframe),window.addEventListener("message",o=>{var i,c;o.source===((i=this.iframe)==null?void 0:i.contentWindow)&&((c=this.eventManager)==null||c.setPort(o.ports[0]))}),(s=(r=this.iframe)==null?void 0:r.contentWindow)==null||s.focus()}removeEmbed(){this.iframe&&this.iframe.remove()}send(t){this.eventManager.send(t)}on(t,n){return this.eventManager.on(t,n)}off(t,n){this.eventManager.off(t,n)}update(t,n){this._value=t,n&&(this._options=n),this.send({type:m.UPDATE,value:t,options:this._options})}completion(){return new Promise((t,n)=>{let r,s,o;function i(){r&&r(),s&&s(),o&&o()}r=this.on(l.COMPLETE,c=>{t(c.response),i()}),s=this.on(l.CANCEL,()=>{n(new Error("User cancelled")),i()}),o=this.on("error",c=>{n(new Error(c.message)),i()})})}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 t=this.on(l.CANCEL,()=>{this.closeModal()}),n=this.on(l.COMPLETE,()=>{this.closeModal()});return this.modal.showModal(),this.modal.addEventListener("click",()=>{this.closeModal()}),this.completion().finally(()=>{t(),n()})}closeModal(){var t;this.modal&&((t=this.modal)==null||t.close(),this.modal.remove(),this.modal=void 0)}async popup(){const t=window.open(this.url,"_blank","popup=true,width=600,height=600");window.addEventListener("message",s=>{var o;s.source===t&&(console.log("received message from popup",s.data),(o=this.eventManager)==null||o.setPort(s.ports[0]))});const n=this.on(l.CANCEL,()=>{t==null||t.close()}),r=this.on(l.COMPLETE,()=>{t==null||t.close()});return this.completion().finally(()=>{n(),r()})}}function M(e){return Object.entries(e).map(([t,n])=>{if(n==null)return;const r=encodeURIComponent(t),s=encodeURIComponent(typeof n=="object"?JSON.stringify(n):String(n));return`${r}=${s}`}).filter(t=>t!==void 0).join("&")}function x(e){const t=e.slice(1);return t?t.split("&").filter(Boolean).reduce((r,s)=>{const[o,i]=s.split("=");return o&&(r[decodeURIComponent(o)]=i?decodeURIComponent(i):""),r},{}):{}}async function p(e,t){const n=JSON.stringify(e),r=new TextEncoder,s=t?E(t):crypto.getRandomValues(new Uint8Array(32)),o=await crypto.subtle.importKey("raw",s,{name:"AES-GCM"},!1,["encrypt"]),i=crypto.getRandomValues(new Uint8Array(12)),c=await crypto.subtle.encrypt({name:"AES-GCM",iv:i},o,r.encode(n));return{ciphertext:`${u(i)}-${u(c)}`,key:u(s)}}async function U({ciphertext:e,key:t}){const[n,r]=e.split("-"),s=new Uint8Array(atob(t).split("").map(b=>b.charCodeAt(0))),o=E(n),i=E(r),c=await crypto.subtle.importKey("raw",s,{name:"AES-GCM"},!1,["decrypt"]),h=new TextDecoder,d=await crypto.subtle.decrypt({name:"AES-GCM",iv:new Uint8Array(o)},c,i);return JSON.parse(h.decode(d))}function u(e){const t=new Uint8Array(e);let n="";for(let r=0;r<t.length;r++)n+=String.fromCharCode(t[r]);return btoa(n)}function E(e){const t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}async function P(e){const t=await fetch(e.url,{method:"GET"});if(!t.ok)throw new Error(`Failed to get connection: ${await t.text()}`);const n=await t.json();if(!n.id||!n.metadata||!n.status||!n.sealed)throw new Error("Data missing from server response");const r={id:n.id,metadata:n.metadata,status:n.status};if(n.status==="closed")return r;const s=n.sealed[n.sealed.length-1],o=await U({ciphertext:s,key:e.key});return n.status==="completed"?{...r,result:o.result}:{...r,tx:o.tx}}class B{constructor(t){a(this,"endpoint");this.endpoint=t}async create(t,n){const r=await p(t),s={metadata:n,sealed:r.ciphertext},o=await fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!o.ok)throw new Error(`Failed to create connection: ${await o.text()}`);const i=await o.json();return{id:i.id,version:i.version,status:i.status,metadata:n,data:t,key:r.key}}async update(t,n,r,s,o){const i=await p(n,o),c={sealed:i.ciphertext,version:r,status:s},h=await fetch(`${this.endpoint}/${t}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});if(!h.ok)throw new Error(`Failed to update connection: ${await h.text()}`);const d=await h.json();return{id:d.id,metadata:d.metadata,version:d.version,status:d.status,data:n,key:i.key}}async get(t,n){const r=await fetch(`${this.endpoint}/${t}`,{method:"GET"});if(!r.ok)throw new Error(`Failed to get connection: ${await r.text()}`);const s=await r.json(),o=s.sealed[s.sealed.length-1],i=await U({ciphertext:o,key:n});return{id:s.id,status:s.status,version:s.version,metadata:s.metadata,data:i,key:n}}async close(t){const n=await fetch(`${this.endpoint}/${t}`,{method:"DELETE"});if(!n.ok)throw new Error(`Failed to close connection: ${await n.text()}`)}}class k{constructor(t){a(this,"nodeUrl");a(this,"authToken");a(this,"uxUrl");a(this,"theme");a(this,"locale");this.uxUrl=t.uxUrl||"https://connect.notabene.id",this.nodeUrl=t.nodeUrl,this.authToken=t.authToken,this.theme=t.theme,this.locale=t.locale}componentUrl(t,n,r,s){const o=new URL(this.uxUrl);o.pathname=t;const i=M({authToken:this.authToken,value:n,configuration:r});return o.hash=i,this.nodeUrl&&o.searchParams.set("nodeUrl",this.nodeUrl),this.theme&&o.searchParams.set("theme",JSON.stringify(this.theme)),this.locale&&o.searchParams.set("locale",this.locale),s&&(s.callback&&o.searchParams.set("callback_url",s.callback),s.redirectUri&&o.searchParams.set("redirect_uri",s.redirectUri)),o.toString()}createComponent(t,n,r,s){return new R(this.componentUrl(t,n,r,s),n,r)}createWithdrawalAssist(t,n,r){return this.createComponent("withdrawal-assist",t,n,r)}createConnectWallet(t,n,r){return this.createComponent("connect",t,n,r)}createDepositRequest(t,n,r){return this.createComponent("deposit-request",t,n,r)}createDepositAssist(t,n,r){return this.createComponent("deposit-assist",t,n,r)}}exports.AgentType=A;exports.CMType=l;exports.CodeVerificationStatus=v;exports.ConnectionManager=B;exports.EmbeddedComponent=R;exports.ErrorIdentifierCode=_;exports.HMType=m;exports.IdentityVerificationMethod=N;exports.OAuthProvider=I;exports.PersonType=f;exports.ProofStatus=y;exports.ProofTypes=D;exports.Status=w;exports.VASPSearchControl=L;exports.ValidationSections=g;exports.WarningIdentifierCode=C;exports.decodeFragmentToObject=x;exports.default=k;exports.getRefreshResult=P;
|
|
1
|
+
"use strict";var W=Object.defineProperty;var k=(e,t,n)=>t in e?W(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var c=(e,t,n)=>k(e,typeof t!="symbol"?t+"":t,n);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var N=(e=>(e.PRIVATE="WALLET",e.VASP="VASP",e))(N||{}),m=(e=>(e.NATURAL="natural",e.LEGAL="legal",e.SELF="self",e))(m||{}),w=(e=>(e.EMPTY="empty",e.VERIFY="verify",e.PENDING="pending",e.VERIFIED="verified",e.BANNED="banned",e))(w||{}),C=(e=>(e.ALLOWED="allowed",e.PENDING="pending",e))(C||{}),L=(e=>(e.SMS="sms",e.EMAIL="email",e))(L||{}),P=(e=>(e.PENDING="pending",e.APPROVED="approved",e.FAILED="failed",e.EXPIRED="expired",e.MAX_ATTEMPTS_REACHED="max_attempts_reached",e.UNREACHABLE="unreachable",e))(P||{}),R=(e=>(e.COINBASE="coinbase",e))(R||{}),S=(e=>(e.ASSET="asset",e.DESTINATION="destination",e.COUNTERPARTY="counterparty",e.AGENT="agent",e))(S||{}),l=(e=>(e.COMPLETE="complete",e.RESIZE="resize",e.RESULT="result",e.READY="ready",e.INVALID="invalid",e.ERROR="error",e.CANCEL="cancel",e.WARNING="warning",e.INFO="info",e))(l||{}),v=(e=>(e.SERVICE_UNAVAILABLE="SERVICE_UNAVAILABLE",e.WALLET_CONNECTION_FAILED="WALLET_CONNECTION_FAILED",e.WALLET_NOT_SUPPORTED="WALLET_NOT_SUPPORTED",e.TOKEN_INVALID="TOKEN_INVALID",e))(v||{}),T=(e=>(e.WALLET_ADDRESS_NOT_CONNECTED="WALLET_ADDRESS_NOT_CONNECTED",e.WALLET_LOCKED="WALLET_LOCKED",e.WALLET_UNREACHABLE="WALLET_UNREACHABLE",e.JURISDICTIONAL_REQUIREMENTS_UNAVAILABLE="JURISDICTIONAL_REQUIREMENTS_UNAVAILABLE",e.IDV_UNAVAILABLE="IDV_UNAVAILABLE",e))(T||{}),b=(e=>(e.UPDATE="update",e.REQUEST_RESPONSE="requestResponse",e))(b||{}),_=(e=>(e.PENDING="pending",e.FAILED="rejected",e.FLAGGED="flagged",e.VERIFIED="verified",e))(_||{}),O=(e=>(e.SelfDeclaration="self-declaration",e.SIWE="siwe",e.SIWX="siwx",e.SOL_SIWX="sol-siwx",e.EIP191="eip-191",e.EIP712="eip-712",e.EIP1271="eip-1271",e.BIP137="bip-137",e.BIP322="bip-322",e.BIP137_XPUB="xpub",e.TIP191="tip-191",e.ED25519="ed25519",e.XRP_ED25519="xrp-ed25519",e.XLM_ED25519="xlm-ed25519",e.CIP8="cip-8",e.COSMOS="cosmos-ecdsa",e.MicroTransfer="microtransfer",e.Screenshot="screenshot",e.Connect="connect",e.CONCORDIUM="concordium",e))(O||{});class j{constructor(){c(this,"listeners",new Map);c(this,"port");this.handleMessage=this.handleMessage.bind(this)}setPort(t){this.port=t,this.port.onmessage=this.handleMessage,this.port.start()}on(t,n){return this.listeners.has(t)||this.listeners.set(t,new Set),this.listeners.get(t).add(n),()=>this.off(t,n)}off(t,n){const r=this.listeners.get(t);r&&(r.delete(n),r.size===0&&this.listeners.delete(t))}handleMessage(t){const n=t.data;if(typeof n=="object"&&n!==null&&"type"in n){const r=n.type,o=this.listeners.get(r);o&&o.forEach(i=>i(n))}}send(t){this.port&&this.port.postMessage(t)}}class D{constructor(t,n,r){c(this,"_url");c(this,"_value");c(this,"_options");c(this,"_errors",[]);c(this,"iframe");c(this,"eventManager");c(this,"modal");this._url=t,this._value=n,this._options=r,this.eventManager=new j,this.on(l.INVALID,o=>{o.type===l.INVALID&&(this._errors=o.errors,this._value=o.value)}),this.on(l.RESIZE,o=>{o.type===l.RESIZE&&this.iframe&&(this.iframe.style.height=`${o.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(t){const n=document.querySelector(t);if(!n)throw new Error(`parentID ${t} not found`);this.embed(n)}embed(t,n=!1){var r,o;this.removeEmbed(),this.iframe=document.createElement("iframe"),this.iframe.src=this.url+(n?"":"&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",t.appendChild(this.iframe),window.addEventListener("message",i=>{var s,a;i.source===((s=this.iframe)==null?void 0:s.contentWindow)&&((a=this.eventManager)==null||a.setPort(i.ports[0]))}),(o=(r=this.iframe)==null?void 0:r.contentWindow)==null||o.focus()}removeEmbed(){this.iframe&&this.iframe.remove()}send(t){this.eventManager.send(t)}on(t,n){return this.eventManager.on(t,n)}off(t,n){this.eventManager.off(t,n)}update(t,n){this._value=t,n&&(this._options=n),this.send({type:b.UPDATE,value:t,options:this._options})}completion(){return new Promise((t,n)=>{let r,o,i;function s(){r&&r(),o&&o(),i&&i()}r=this.on(l.COMPLETE,a=>{t(a.response),s()}),o=this.on(l.CANCEL,()=>{n(new Error("User cancelled")),s()}),i=this.on("error",a=>{n(new Error(a.message)),s()})})}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 t=this.on(l.CANCEL,()=>{this.closeModal()}),n=this.on(l.COMPLETE,()=>{this.closeModal()});return this.modal.showModal(),this.modal.addEventListener("click",()=>{this.closeModal()}),this.completion().finally(()=>{t(),n()})}closeModal(){var t;this.modal&&((t=this.modal)==null||t.close(),this.modal.remove(),this.modal=void 0)}async popup(){const t=window.open(this.url,"_blank","popup=true,width=600,height=600");window.addEventListener("message",o=>{var i;o.source===t&&(console.log("received message from popup",o.data),(i=this.eventManager)==null||i.setPort(o.ports[0]))});const n=this.on(l.CANCEL,()=>{t==null||t.close()}),r=this.on(l.COMPLETE,()=>{t==null||t.close()});return this.completion().finally(()=>{n(),r()})}}function F(e){return Object.entries(e).map(([t,n])=>{if(n==null)return;const r=encodeURIComponent(t),o=encodeURIComponent(typeof n=="object"?JSON.stringify(n):String(n));return`${r}=${o}`}).filter(t=>t!==void 0).join("&")}function J(e){const t=e.slice(1);return t?t.split("&").filter(Boolean).reduce((r,o)=>{const[i,s]=o.split("=");return i&&(r[decodeURIComponent(i)]=s?decodeURIComponent(s):""),r},{}):{}}new TextEncoder;const E=new TextDecoder;function q(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(e);const t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}function G(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(typeof e=="string"?e:E.decode(e),{alphabet:"base64url"});let t=e;t instanceof Uint8Array&&(t=E.decode(t)),t=t.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"");try{return q(t)}catch{throw new TypeError("The input to be decoded is not correctly encoded.")}}class U extends Error{constructor(n,r){var o;super(n,r);c(this,"code","ERR_JOSE_GENERIC");this.name=this.constructor.name,(o=Error.captureStackTrace)==null||o.call(Error,this,this.constructor)}}c(U,"code","ERR_JOSE_GENERIC");class u extends U{constructor(){super(...arguments);c(this,"code","ERR_JWT_INVALID")}}c(u,"code","ERR_JWT_INVALID");function $(e){return typeof e=="object"&&e!==null}const H=e=>{if(!$(e)||Object.prototype.toString.call(e)!=="[object Object]")return!1;if(Object.getPrototypeOf(e)===null)return!0;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t};function K(e){if(typeof e!="string")throw new u("JWTs must use Compact JWS serialization, JWT must be a string");const{1:t,length:n}=e.split(".");if(n===5)throw new u("Only JWTs using Compact JWS serialization can be decoded");if(n!==3)throw new u("Invalid JWT");if(!t)throw new u("JWTs must contain a payload");let r;try{r=G(t)}catch{throw new u("Failed to base64url decode the payload")}let o;try{o=JSON.parse(E.decode(r))}catch{throw new u("Failed to parse the decoded payload as JSON")}if(!H(o))throw new u("Invalid JWT Claims Set");return o}function p(e,t){if(t!=null&&t.email)return`did:email:${t.email}`;if(t!=null&&t.name)return`did:name:${encodeURIComponent(t.name.replace(/\s+/g,"-"))}`;throw new Error(`Unable to generate ${e} ID: missing required ${e} information`)}function X(e){const{nameIdentifier:t,...n}=e;return{...n,nameIdentifier:t==null?void 0:t.map(({nameIdentifierType:r,...o})=>({...o,naturalPersonNameIdentifierType:r}))}}function z(e,t){return{naturalPerson:e.naturalPerson?{...e.naturalPerson,name:X(e.naturalPerson.name)}:void 0,legalPerson:e.legalPerson,accountNumber:[t]}}const A=[{addressType:"GEOG",addressLine:["1234 Main Street"],townName:"Unknown",country:"US"}];function Y(e){const t=e.trim();if(!t)return{primaryIdentifier:"",secondaryIdentifier:""};const n=t.split(/\s+/),r=n[n.length-1],o=n.slice(0,-1),i=o.length>0?o.join(" "):r;return{primaryIdentifier:r,secondaryIdentifier:i}}function Q(e,t,n=["1234567890"]){const r=t==null?void 0:t.map(o=>{const i={...o};return i.naturalPerson&&(i.naturalPerson={...i.naturalPerson,geographicAddress:A}),i.legalPerson&&(i.legalPerson={...i.legalPerson,geographicAddress:A}),i});return e==="originator"?{originatorPersons:r,accountNumber:n}:{beneficiaryPersons:r,accountNumber:n}}function Z(e,t="John Doe"){const{primaryIdentifier:n,secondaryIdentifier:r}=Y(t),o={naturalPerson:{name:[{nameIdentifier:[{primaryIdentifier:n,...r?{secondaryIdentifier:r}:{},nameIdentifierType:"LEGL"}]}],geographicAddress:A}};return e==="originator"?{originatorPersons:[o],accountNumber:["1234567890"]}:{beneficiaryPersons:[o],accountNumber:["1234567890"]}}const ee=e=>({...e,name:e.name?[e.name]:void 0}),te=e=>({...e,naturalPerson:e.naturalPerson?ee(e.naturalPerson):void 0}),ne=({beneficiary:e,originator:t},n,r,o,i)=>{var s;{const a=e&&{...e,...o&&{accountNumber:[o]},beneficiaryPersons:(s=e.beneficiaryPersons)==null?void 0:s.map(te)};if(r&&(a!=null&&a.beneficiaryPersons)){const d=Q("originator",a==null?void 0:a.beneficiaryPersons);return{beneficiary:{accountNumber:d.accountNumber,beneficiaryPersons:d.originatorPersons},originator:d}}return{beneficiary:a,originator:Z("originator",n)}}};function re(e,t,n){var i,s;const{beneficiary:r,originator:o}=ne(n,(i=e.customer)==null?void 0:i.name,t.originatorEqualsBeneficiary,e.destination);return{transactionAsset:t.transactionAsset,transactionAmount:t.transactionAmount,beneficiaryDid:(s=e.counterparty)==null?void 0:s.did,originatorVASPdid:t.originatorVASPdid,...t.beneficiaryVASPdid&&!t.beneficiaryProof?{beneficiaryVASPdid:t.beneficiaryVASPdid}:{},transactionBlockchainInfo:{...(o==null?void 0:o.accountNumber)&&{origin:o.accountNumber[0]},...e.destination&&{destination:e.destination}},...t.beneficiaryProof&&{beneficiaryProof:t.beneficiaryProof},...r&&{beneficiary:r},...o&&{originator:o},...t.originatorEqualsBeneficiary&&{originatorEqualsBeneficiary:t.originatorEqualsBeneficiary}}}function x(e,t,n={}){var a,d;const r=(n==null?void 0:n.originatorId)||p("originator",e.customer),o=(n==null?void 0:n.beneficiaryId)||p("beneficiary",e.counterparty),i=(n==null?void 0:n.referenceId)||Math.random().toString(36).substring(2,15),s=[];return t.originatorVASPdid&&s.push({"@id":t.originatorVASPdid,for:r,role:"VASP"}),t.beneficiaryVASPdid&&s.push({"@id":t.beneficiaryVASPdid,for:o,role:"VASP"}),e.destination&&((a=e==null?void 0:e.account)!=null&&a.did)&&s.push({"@id":e.account.did,for:t.beneficiaryVASPdid||o,role:"SettlementAddress"}),{originator:{"@id":r},beneficiary:{"@id":o},asset:e.asset,amount:((d=e.amountDecimal)==null?void 0:d.toString())||t.transactionAmount,agents:s,ref:i}}function M(e,t,n={}){var i,s,a;const r=n.beneficiaryId||p("beneficiary",e.counterparty),o=((i=e.counterparty)==null?void 0:i.type)===m.SELF&&n.originator?n.originator.originatorPerson:((a=(s=t.beneficiary)==null?void 0:s.beneficiaryPersons)==null?void 0:a.map(d=>z(d,r)))||[];return{ivms101:{originator:n.originator,beneficiary:{beneficiaryPerson:o}}}}function y(e,t,n){var o;const r={...e};if(!r.originatorId)try{const i=K(t);i!=null&&i.sub&&(r.originatorId=i.sub)}catch{}return r.beneficiaryId||(((o=n.counterparty)==null?void 0:o.type)===m.SELF?r.beneficiaryId=r.originatorId:n.destination&&(r.beneficiaryId=`did:key:${n.destination}`)),r}function oe(e){var s;if(!e.txCreate||!e.ivms101)throw new Error("Invalid response: missing required txCreate or ivms101 data");const{value:t,ivms101:n,proof:r,txCreate:o}=e,i={destination:(t==null?void 0:t.destination)||"",counterparty:(t==null?void 0:t.counterparty)||{},agent:t==null?void 0:t.agent,account:t==null?void 0:t.account,proof:r,asset:(t==null?void 0:t.asset)||(typeof o.transactionAsset=="string"?o.transactionAsset:(s=o.transactionAsset)==null?void 0:s.caip19)||"",amountDecimal:(t==null?void 0:t.amountDecimal)||(o.transactionAmount?parseFloat(o.transactionAmount):0),customer:t==null?void 0:t.customer};return re(i,o,n)}function ie(e,t,n={}){if(!e.txCreate||!e.ivms101)throw new Error("Invalid response: missing required txCreate or ivms101 data");const{value:r,txCreate:o,ivms101:i,proof:s}=e,a=y(n,t,r);return{createTx:x(r,o,a),ivms101:M(r,i,a),...s&&{confirmRelationship:{proof:s}}}}function se(e,t,n={}){if(!e.txCreate||!e.ivms101)throw new Error("Invalid response: missing required txCreate or ivms101 data");const{value:r,txCreate:o}=e,i=y(n,t,r);return x(r,o,i)}function ae(e,t,n={}){if(!e.ivms101)throw new Error("Invalid response: missing required ivms101 data");const{value:r,ivms101:o}=e,i=y(n,t,r);return M(r,o,i)}async function I(e,t){const n=JSON.stringify(e),r=new TextEncoder,o=t?g(t):crypto.getRandomValues(new Uint8Array(32)),i=await crypto.subtle.importKey("raw",o,{name:"AES-GCM"},!1,["encrypt"]),s=crypto.getRandomValues(new Uint8Array(12)),a=await crypto.subtle.encrypt({name:"AES-GCM",iv:s},i,r.encode(n));return{ciphertext:`${f(s)}-${f(a)}`,key:f(o)}}async function V({ciphertext:e,key:t}){const[n,r]=e.split("-"),o=new Uint8Array(atob(t).split("").map(B=>B.charCodeAt(0))),i=g(n),s=g(r),a=await crypto.subtle.importKey("raw",o,{name:"AES-GCM"},!1,["decrypt"]),d=new TextDecoder,h=await crypto.subtle.decrypt({name:"AES-GCM",iv:new Uint8Array(i)},a,s);return JSON.parse(d.decode(h))}function f(e){const t=new Uint8Array(e);let n="";for(let r=0;r<t.length;r++)n+=String.fromCharCode(t[r]);return btoa(n)}function g(e){const t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}async function ce(e){const t=await fetch(e.url,{method:"GET"});if(!t.ok)throw new Error(`Failed to get connection: ${await t.text()}`);const n=await t.json();if(!n.id||!n.metadata||!n.status||!n.sealed)throw new Error("Data missing from server response");const r={id:n.id,metadata:n.metadata,status:n.status};if(n.status==="closed")return r;const o=n.sealed[n.sealed.length-1],i=await V({ciphertext:o,key:e.key});return n.status==="completed"?{...r,result:i.result}:{...r,tx:i.tx}}class de{constructor(t){c(this,"endpoint");this.endpoint=t}async create(t,n){const r=await I(t),o={metadata:n,sealed:r.ciphertext},i=await fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)});if(!i.ok)throw new Error(`Failed to create connection: ${await i.text()}`);const s=await i.json();return{id:s.id,version:s.version,status:s.status,metadata:n,data:t,key:r.key}}async update(t,n,r,o,i){const s=await I(n,i),a={sealed:s.ciphertext,version:r,status:o},d=await fetch(`${this.endpoint}/${t}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!d.ok)throw new Error(`Failed to update connection: ${await d.text()}`);const h=await d.json();return{id:h.id,metadata:h.metadata,version:h.version,status:h.status,data:n,key:s.key}}async get(t,n){const r=await fetch(`${this.endpoint}/${t}`,{method:"GET"});if(!r.ok)throw new Error(`Failed to get connection: ${await r.text()}`);const o=await r.json(),i=o.sealed[o.sealed.length-1],s=await V({ciphertext:i,key:n});return{id:o.id,status:o.status,version:o.version,metadata:o.metadata,data:s,key:n}}async close(t){const n=await fetch(`${this.endpoint}/${t}`,{method:"DELETE"});if(!n.ok)throw new Error(`Failed to close connection: ${await n.text()}`)}}class le{constructor(t){c(this,"nodeUrl");c(this,"authToken");c(this,"uxUrl");c(this,"theme");c(this,"locale");this.uxUrl=t.uxUrl||"https://connect.notabene.id",this.nodeUrl=t.nodeUrl,this.authToken=t.authToken,this.theme=t.theme,this.locale=t.locale}componentUrl(t,n,r,o){const i=new URL(this.uxUrl);i.pathname=t;const s=F({authToken:this.authToken,value:n,configuration:r});return i.hash=s,this.nodeUrl&&i.searchParams.set("nodeUrl",this.nodeUrl),this.theme&&i.searchParams.set("theme",JSON.stringify(this.theme)),this.locale&&i.searchParams.set("locale",this.locale),o&&(o.callback&&i.searchParams.set("callback_url",o.callback),o.redirectUri&&i.searchParams.set("redirect_uri",o.redirectUri)),i.toString()}createComponent(t,n,r,o){return new D(this.componentUrl(t,n,r,o),n,r)}createWithdrawalAssist(t,n,r){return this.createComponent("withdrawal-assist",t,n,r)}createConnectWallet(t,n,r){return this.createComponent("connect",t,n,r)}createDepositRequest(t,n,r){return this.createComponent("deposit-request",t,n,r)}createDepositAssist(t,n,r){return this.createComponent("deposit-assist",t,n,r)}}exports.AgentType=N;exports.CMType=l;exports.CodeVerificationStatus=P;exports.ConnectionManager=de;exports.EmbeddedComponent=D;exports.ErrorIdentifierCode=v;exports.HMType=b;exports.IdentityVerificationMethod=L;exports.OAuthProvider=R;exports.PersonType=m;exports.ProofStatus=_;exports.ProofTypes=O;exports.Status=w;exports.VASPSearchControl=C;exports.ValidationSections=S;exports.WarningIdentifierCode=T;exports.componentResponseToIVMS101=ae;exports.componentResponseToTxCreateRequest=se;exports.componentResponseToTxRequests=ie;exports.componentResponseToV1TxCreateRequest=oe;exports.decodeFragmentToObject=J;exports.default=le;exports.getRefreshResult=ce;
|
package/dist/cjs/notabene.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import type { Agent as Agent_2 } from '@taprsvp/types';
|
|
2
|
+
import type { DID as DID_2 } from '@taprsvp/types';
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
5
|
* A blockchain account
|
|
3
6
|
* @public
|
|
@@ -99,6 +102,11 @@ declare type BeneficiaryFields = {
|
|
|
99
102
|
destination?: Destination;
|
|
100
103
|
};
|
|
101
104
|
|
|
105
|
+
declare type BeneficiaryV2 = {
|
|
106
|
+
beneficiaryPerson: PersonV2[];
|
|
107
|
+
customerIdentification?: string;
|
|
108
|
+
};
|
|
109
|
+
|
|
102
110
|
/**
|
|
103
111
|
* Beneficiary VASP
|
|
104
112
|
* Represents the VASP which receives the VA transfer
|
|
@@ -320,6 +328,151 @@ export declare interface ComponentResponse {
|
|
|
320
328
|
errors: ValidationError[];
|
|
321
329
|
}
|
|
322
330
|
|
|
331
|
+
/**
|
|
332
|
+
* Transforms a Notabene component response to IVMS101 format
|
|
333
|
+
*
|
|
334
|
+
* @param response - The response from the Notabene Embedded Component
|
|
335
|
+
* @param delegateToken - The JWT delegate token for extracting the originator ID
|
|
336
|
+
* @param config - Configuration object with optional IDs
|
|
337
|
+
* @param config.originatorId - Optional originator ID (auto-extracted from delegateToken if not provided)
|
|
338
|
+
* @param config.beneficiaryId - Optional beneficiary ID (auto-generated if not provided)
|
|
339
|
+
* @param config.referenceId - Optional reference ID for the transaction
|
|
340
|
+
* @param config.originator - Optional originator data in V2 format
|
|
341
|
+
* @returns The transformed request body in IVMS101 format
|
|
342
|
+
*
|
|
343
|
+
* @example
|
|
344
|
+
* ```typescript
|
|
345
|
+
* import { componentResponseToIVMS101 } from '$lib/notabene-tx-transformer';
|
|
346
|
+
*
|
|
347
|
+
* const requestBody = componentResponseToIVMS101(
|
|
348
|
+
* result.response,
|
|
349
|
+
* session.user.token,
|
|
350
|
+
* { originator: myOriginatorData }
|
|
351
|
+
* );
|
|
352
|
+
*
|
|
353
|
+
* await fetch('/entity/${vaspDid}/tx/${txId}/append', {
|
|
354
|
+
* method: 'POST',
|
|
355
|
+
* body: JSON.stringify(requestBody)
|
|
356
|
+
* });
|
|
357
|
+
* ```
|
|
358
|
+
*/
|
|
359
|
+
export declare function componentResponseToIVMS101(response: TransactionResponse<Withdrawal>, delegateToken: string, config?: ResponseToTxRequestConfig): TransactionIVMS101Request;
|
|
360
|
+
|
|
361
|
+
/**
|
|
362
|
+
* Transforms a Notabene component response to a Version 2 transaction create API request body
|
|
363
|
+
*
|
|
364
|
+
* @param response - The response from the Notabene Embedded Component
|
|
365
|
+
* @param delegateToken - The JWT delegate token for extracting the originator ID
|
|
366
|
+
* @param config - Configuration object with optional IDs
|
|
367
|
+
* @param config.originatorId - Optional originator ID (auto-extracted from delegateToken if not provided)
|
|
368
|
+
* @param config.beneficiaryId - Optional beneficiary ID (auto-generated if not provided)
|
|
369
|
+
* @param config.referenceId - Optional reference ID for the transaction
|
|
370
|
+
* @returns The transformed request body ready for the Version 2 transaction create API
|
|
371
|
+
*
|
|
372
|
+
* @example
|
|
373
|
+
* ```typescript
|
|
374
|
+
* import { componentResponseToTxCreateRequest } from '$lib/notabene-tx-transformer';
|
|
375
|
+
*
|
|
376
|
+
* withdrawal.on('complete', async (result) => {
|
|
377
|
+
* const requestBody = componentResponseToTxCreateRequest(
|
|
378
|
+
* result.response,
|
|
379
|
+
* {
|
|
380
|
+
* originatorId: 'mailto:user@example.com',
|
|
381
|
+
* beneficiaryId: 'urn:beneficiary:recipient',
|
|
382
|
+
* referenceId: 'tx-12345'
|
|
383
|
+
* }
|
|
384
|
+
* );
|
|
385
|
+
*
|
|
386
|
+
* await fetch('/entity/${vaspDid}/tx', {
|
|
387
|
+
* method: 'POST',
|
|
388
|
+
* body: JSON.stringify(requestBody)
|
|
389
|
+
* });
|
|
390
|
+
* });
|
|
391
|
+
* ```
|
|
392
|
+
*/
|
|
393
|
+
export declare function componentResponseToTxCreateRequest(response: TransactionResponse<Withdrawal>, delegateToken: string, config?: Omit<ResponseToTxRequestConfig, 'originator'>): TransactionCreateRequestV2;
|
|
394
|
+
|
|
395
|
+
/**
|
|
396
|
+
* Transforms a Notabene component response into txCreate, IVMS101, and confirmRelationship request bodies
|
|
397
|
+
*
|
|
398
|
+
* This is a convenience function that generates the transaction creation request,
|
|
399
|
+
* the IVMS101 data, and optionally the relationship confirmation proof in a single call,
|
|
400
|
+
* which is useful for V2 workflows where you need to create a transaction first,
|
|
401
|
+
* then append IVMS101 data to it, and finally confirm the relationship.
|
|
402
|
+
*
|
|
403
|
+
* @param response - The response from the Notabene Embedded Component
|
|
404
|
+
* @param delegateToken - The JWT delegate token for extracting the originator ID
|
|
405
|
+
* @param config - Optional configuration for IDs and reference
|
|
406
|
+
* @param config.originatorId - Optional originator ID (auto-extracted from delegateToken if not provided)
|
|
407
|
+
* @param config.beneficiaryId - Optional beneficiary ID (auto-generated if not provided)
|
|
408
|
+
* @param config.referenceId - Optional reference ID (auto-generated if not provided)
|
|
409
|
+
* @param config.originator - Optional originator data in V2 format
|
|
410
|
+
* @returns Object with `createTx`, `ivms101`, and optional `confirmRelationship` properties containing the respective request bodies
|
|
411
|
+
*
|
|
412
|
+
* @example
|
|
413
|
+
* ```typescript
|
|
414
|
+
* import { componentResponseToTxRequests } from '$lib/notabene-tx-transformer';
|
|
415
|
+
*
|
|
416
|
+
* withdrawal.on('complete', async (result) => {
|
|
417
|
+
* const { createTx, ivms101, confirmRelationship } = componentResponseToTxRequests(
|
|
418
|
+
* result.response,
|
|
419
|
+
* session.user.token,
|
|
420
|
+
* { originator: originatorData }
|
|
421
|
+
* );
|
|
422
|
+
*
|
|
423
|
+
* // First, create the transaction
|
|
424
|
+
* const txResponse = await fetch('/entity/${vaspDid}/tx', {
|
|
425
|
+
* method: 'POST',
|
|
426
|
+
* body: JSON.stringify(createTx)
|
|
427
|
+
* });
|
|
428
|
+
*
|
|
429
|
+
* // Then, append IVMS101 data
|
|
430
|
+
* const txId = txResponse.transfer['@id'];
|
|
431
|
+
* await fetch(`/entity/${vaspDid}/tx/${txId}/append`, {
|
|
432
|
+
* method: 'POST',
|
|
433
|
+
* body: JSON.stringify(ivms101)
|
|
434
|
+
* });
|
|
435
|
+
*
|
|
436
|
+
* // Finally, confirm relationship
|
|
437
|
+
* if (confirmRelationship) {
|
|
438
|
+
* await fetch(`/entity/${vaspDid}/relationship?to=${to}&from=${from}`, {
|
|
439
|
+
* method: 'PATCH',
|
|
440
|
+
* body: JSON.stringify({ proof: confirmRelationship.proof })
|
|
441
|
+
* });
|
|
442
|
+
* }
|
|
443
|
+
* });
|
|
444
|
+
* ```
|
|
445
|
+
*/
|
|
446
|
+
export declare function componentResponseToTxRequests(response: TransactionResponse<Withdrawal>, delegateToken: string, config?: ResponseToTxRequestConfig): {
|
|
447
|
+
createTx: TransactionCreateRequestV2;
|
|
448
|
+
ivms101: TransactionIVMS101Request;
|
|
449
|
+
confirmRelationship?: {
|
|
450
|
+
proof: OwnershipProof;
|
|
451
|
+
};
|
|
452
|
+
};
|
|
453
|
+
|
|
454
|
+
/**
|
|
455
|
+
* Transforms a Notabene component response to a Version 1 API request body
|
|
456
|
+
*
|
|
457
|
+
* @param response - The response from the Notabene TX Create component
|
|
458
|
+
* @returns The transformed request body ready for the Version 1 API
|
|
459
|
+
*
|
|
460
|
+
* @example
|
|
461
|
+
* ```typescript
|
|
462
|
+
* import { componentResponseToV1TxCreateRequest } from '$lib/notabene-tx-transformer';
|
|
463
|
+
*
|
|
464
|
+
* withdrawal.on('complete', async (result) => {
|
|
465
|
+
* const requestBody = componentResponseToV1TxCreateRequest(result.response);
|
|
466
|
+
*
|
|
467
|
+
* await fetch(endpointUrl, {
|
|
468
|
+
* method: 'POST',
|
|
469
|
+
* body: JSON.stringify(requestBody)
|
|
470
|
+
* });
|
|
471
|
+
* });
|
|
472
|
+
* ```
|
|
473
|
+
*/
|
|
474
|
+
export declare function componentResponseToV1TxCreateRequest(response: TransactionResponse<Withdrawal>): TransactionCreateRequest;
|
|
475
|
+
|
|
323
476
|
export declare interface ConnectionData<T extends ComponentRequest> {
|
|
324
477
|
readonly tx: T;
|
|
325
478
|
readonly authToken?: string;
|
|
@@ -1132,6 +1285,12 @@ declare type NaturalPersonNameID = {
|
|
|
1132
1285
|
nameIdentifierType?: NaturalPersonNameTypeCode;
|
|
1133
1286
|
};
|
|
1134
1287
|
|
|
1288
|
+
declare type NaturalPersonNameIDV2 = {
|
|
1289
|
+
primaryIdentifier?: string;
|
|
1290
|
+
secondaryIdentifier?: string;
|
|
1291
|
+
naturalPersonNameIdentifierType?: NaturalPersonNameTypeCode;
|
|
1292
|
+
};
|
|
1293
|
+
|
|
1135
1294
|
/**
|
|
1136
1295
|
* Natural Person Name Type Code
|
|
1137
1296
|
* Specifies the type of name for a natural person
|
|
@@ -1140,6 +1299,14 @@ declare type NaturalPersonNameID = {
|
|
|
1140
1299
|
*/
|
|
1141
1300
|
declare type NaturalPersonNameTypeCode = 'ALIA' | 'BIRT' | 'MAID' | 'LEGL' | 'MISC';
|
|
1142
1301
|
|
|
1302
|
+
declare type NaturalPersonNameV2 = Omit<NaturalPersonName, 'nameIdentifier'> & {
|
|
1303
|
+
nameIdentifier?: NaturalPersonNameIDV2[];
|
|
1304
|
+
};
|
|
1305
|
+
|
|
1306
|
+
declare type NaturalPersonV2 = Omit<NaturalPerson_2, 'name'> & {
|
|
1307
|
+
name: NaturalPersonNameV2;
|
|
1308
|
+
};
|
|
1309
|
+
|
|
1143
1310
|
/**
|
|
1144
1311
|
* Primary constructor for Notabene UX elements
|
|
1145
1312
|
*
|
|
@@ -1311,6 +1478,11 @@ declare type OriginatorFields = {
|
|
|
1311
1478
|
source?: Source | Source[];
|
|
1312
1479
|
};
|
|
1313
1480
|
|
|
1481
|
+
declare type OriginatorV2 = {
|
|
1482
|
+
originatorPerson: PersonV2[];
|
|
1483
|
+
customerIdentification?: string;
|
|
1484
|
+
};
|
|
1485
|
+
|
|
1314
1486
|
/**
|
|
1315
1487
|
* Base interface for proving ownership of an account or address
|
|
1316
1488
|
*
|
|
@@ -1399,6 +1571,11 @@ export declare enum PersonType {
|
|
|
1399
1571
|
SELF = "self"
|
|
1400
1572
|
}
|
|
1401
1573
|
|
|
1574
|
+
declare type PersonV2 = Omit<Person, 'naturalPerson'> & {
|
|
1575
|
+
naturalPerson?: NaturalPersonV2;
|
|
1576
|
+
accountNumber?: string[];
|
|
1577
|
+
};
|
|
1578
|
+
|
|
1402
1579
|
/**
|
|
1403
1580
|
* Status of the ownership proof verification process
|
|
1404
1581
|
*
|
|
@@ -1497,6 +1674,13 @@ export declare type ResizeRequest = {
|
|
|
1497
1674
|
height: number;
|
|
1498
1675
|
};
|
|
1499
1676
|
|
|
1677
|
+
export declare interface ResponseToTxRequestConfig {
|
|
1678
|
+
originatorId?: DID_2;
|
|
1679
|
+
beneficiaryId?: DID_2;
|
|
1680
|
+
referenceId?: string;
|
|
1681
|
+
originator?: OriginatorV2;
|
|
1682
|
+
}
|
|
1683
|
+
|
|
1500
1684
|
/**
|
|
1501
1685
|
* Ownership Proof using Screenshot
|
|
1502
1686
|
* @public
|
|
@@ -1680,6 +1864,44 @@ export declare interface Transaction extends ComponentRequest {
|
|
|
1680
1864
|
*/
|
|
1681
1865
|
export declare type TransactionAsset = NotabeneAsset | CAIP19 | DTI;
|
|
1682
1866
|
|
|
1867
|
+
export declare interface TransactionCreateRequest {
|
|
1868
|
+
transactionAsset: any;
|
|
1869
|
+
transactionAmount: string;
|
|
1870
|
+
beneficiaryDid?: string;
|
|
1871
|
+
originatorVASPdid: string;
|
|
1872
|
+
beneficiaryVASPdid?: string;
|
|
1873
|
+
beneficiaryVASPname?: string;
|
|
1874
|
+
beneficiaryVASPwebsite?: string;
|
|
1875
|
+
transactionBlockchainInfo: {
|
|
1876
|
+
origin?: string;
|
|
1877
|
+
destination?: string;
|
|
1878
|
+
};
|
|
1879
|
+
beneficiaryProof?: any;
|
|
1880
|
+
beneficiary?: any;
|
|
1881
|
+
originator?: any;
|
|
1882
|
+
originatorEqualsBeneficiary?: boolean;
|
|
1883
|
+
}
|
|
1884
|
+
|
|
1885
|
+
export declare interface TransactionCreateRequestV2 {
|
|
1886
|
+
originator: {
|
|
1887
|
+
'@id': string;
|
|
1888
|
+
};
|
|
1889
|
+
beneficiary: {
|
|
1890
|
+
'@id': string;
|
|
1891
|
+
};
|
|
1892
|
+
asset: string;
|
|
1893
|
+
amount: string;
|
|
1894
|
+
agents: Agent_2[];
|
|
1895
|
+
ref: string;
|
|
1896
|
+
}
|
|
1897
|
+
|
|
1898
|
+
export declare interface TransactionIVMS101Request {
|
|
1899
|
+
ivms101: {
|
|
1900
|
+
originator?: OriginatorV2;
|
|
1901
|
+
beneficiary?: BeneficiaryV2;
|
|
1902
|
+
};
|
|
1903
|
+
}
|
|
1904
|
+
|
|
1683
1905
|
/**
|
|
1684
1906
|
* Configuration options for Transaction components
|
|
1685
1907
|
* @public
|
|
@@ -1701,6 +1923,7 @@ export declare interface TransactionOptions {
|
|
|
1701
1923
|
vasps?: VASPOptions;
|
|
1702
1924
|
hide?: ValidationSections[];
|
|
1703
1925
|
counterpartyAssist?: CounterpartyAssistConfig;
|
|
1926
|
+
autoSubmit?: boolean;
|
|
1704
1927
|
}
|
|
1705
1928
|
|
|
1706
1929
|
/**
|
package/dist/cjs/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.
|
|
13
|
+
"version": "2.14.0-next.4",
|
|
14
14
|
"source": "src/notabene.ts",
|
|
15
15
|
"main": "dist/cjs/notabene.cjs",
|
|
16
16
|
"module": "dist/esm/notabene.js",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"import": "./dist/esm/notabene.js",
|
|
33
33
|
"require": "./dist/cjs/notabene.cjs"
|
|
34
34
|
},
|
|
35
|
-
"./src/ivms/types": "./src/ivms/
|
|
35
|
+
"./src/ivms/types": "./src/ivms/index.ts"
|
|
36
36
|
},
|
|
37
37
|
"browserslist": "> 0.5%, last 2 versions, not dead",
|
|
38
38
|
"publishConfig": {
|
|
@@ -104,5 +104,9 @@
|
|
|
104
104
|
"extends": [
|
|
105
105
|
"@commitlint/config-conventional"
|
|
106
106
|
]
|
|
107
|
+
},
|
|
108
|
+
"dependencies": {
|
|
109
|
+
"@taprsvp/types": "^1.13.0",
|
|
110
|
+
"jose": "^6.1.0"
|
|
107
111
|
}
|
|
108
112
|
}
|