@notabene/javascript-sdk
Advanced tools
Comparing version 2.0.0-next.20 to 2.0.0-next.21
@@ -765,4 +765,5 @@ /** | ||
type: ProofTypes.MicroTransfer; | ||
txhash: string; | ||
proof: string; | ||
chain: CAIP2; | ||
asset: CAIP19; | ||
destination: BlockchainAddress; | ||
@@ -1175,7 +1176,7 @@ amountSubunits: string; | ||
* - SelfDeclaration: User self-declares ownership without cryptographic proof | ||
* - PersonalSignEIP191: Ethereum personal signature following EIP-191 standard | ||
* - EIP191: Ethereum personal signature following EIP-191 standard | ||
* - SIWE: Sign-In with Ethereum message signature (EIP-4361) | ||
* - PersonalSignEIP712: Ethereum typed data signature following EIP-712 standard | ||
* - PersonalSignBIP137: Bitcoin message signature following BIP-137 | ||
* - PersonalSignXPUB: Extended public key signature for HD wallets | ||
* - EIP712: Ethereum typed data signature following EIP-712 standard | ||
* - BIP137: Bitcoin message signature following BIP-137 | ||
* - XPUB: Extended public key signature for HD wallets | ||
* - MicroTransfer: Proof via small blockchain transaction | ||
@@ -1192,7 +1193,10 @@ * - Screenshot: Image proof of ownership/access | ||
SelfDeclaration = "self-declaration", | ||
PersonalSignEIP191 = "eip-191", | ||
SIWE = "siwe", | ||
PersonalSignEIP712 = "eip-712", | ||
PersonalSignBIP137 = "bip-137", | ||
PersonalSignXPUB = "xpub", | ||
SIWX = "siwx", | ||
EIP191 = "eip-191", | ||
EIP712 = "eip-712", | ||
EIP1271 = "eip-1271", | ||
BIP137 = "bip-137", | ||
BIP137_XPUB = "xpub", | ||
ED25519 = "ed25519", | ||
MicroTransfer = "microtransfer", | ||
@@ -1248,3 +1252,3 @@ Screenshot = "screenshot" | ||
export declare interface SignatureProof extends OwnershipProof { | ||
type: ProofTypes.PersonalSignEIP191 | ProofTypes.PersonalSignEIP712 | ProofTypes.PersonalSignBIP137 | ProofTypes.SIWE | ProofTypes.PersonalSignXPUB; | ||
type: ProofTypes.EIP191 | ProofTypes.EIP712 | ProofTypes.EIP1271 | ProofTypes.BIP137 | ProofTypes.BIP137_XPUB | ProofTypes.ED25519 | ProofTypes.SIWX | ProofTypes.SIWE; | ||
proof: string; | ||
@@ -1285,2 +1289,19 @@ attestation: string; | ||
/** | ||
* Specify what to do under the provided threshold. | ||
* | ||
* Eg. to allow self-declaration for all transactions under 1000 EUR | ||
* | ||
* Note to support threshold you MUST include the Asset Price in the Transaction | ||
* | ||
* @see {@link Transaction} Transaction object | ||
* | ||
* @public | ||
*/ | ||
export declare interface ThresholdOptions { | ||
threshold: number; | ||
currency: ISOCurrency; | ||
proofTypes?: ProofTypes[]; | ||
} | ||
/** | ||
* Core transaction interface representing a crypto asset transfer between parties | ||
@@ -1338,2 +1359,3 @@ * | ||
fallbacks?: ProofTypes[]; | ||
deminimis?: ThresholdOptions; | ||
}; | ||
@@ -1344,2 +1366,3 @@ allowedAgentTypes?: AgentType[]; | ||
vasps?: VASPOptions; | ||
hide?: ValidationSections[]; | ||
} | ||
@@ -1493,2 +1516,14 @@ | ||
/** | ||
* Sections in a WithdrawalAssist screen | ||
* | ||
* @alpha | ||
*/ | ||
export declare enum ValidationSections { | ||
ASSET = "asset", | ||
DESTINATION = "destination", | ||
COUNTERPARTY = "counterparty", | ||
AGENT = "agent" | ||
} | ||
/** | ||
* A VASP agent acting on behalf of the counterparty | ||
@@ -1495,0 +1530,0 @@ * @public |
var c = Object.defineProperty; | ||
var m = (t, e, s) => e in t ? c(t, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[e] = s; | ||
var o = (t, e, s) => m(t, typeof e != "symbol" ? e + "" : e, s); | ||
var u = /* @__PURE__ */ ((t) => (t.PRIVATE = "WALLET", t.VASP = "VASP", t))(u || {}), f = /* @__PURE__ */ ((t) => (t.NATURAL = "natural", t.LEGAL = "legal", t.SELF = "self", t))(f || {}), E = /* @__PURE__ */ ((t) => (t.EMPTY = "empty", t.VERIFY = "verify", t.PENDING = "pending", t.VERIFIED = "verified", t.BANNED = "banned", t))(E || {}), a = /* @__PURE__ */ ((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 = /* @__PURE__ */ ((t) => (t.UPDATE = "update", t.REQUEST_RESPONSE = "requestResponse", t))(d || {}), p = /* @__PURE__ */ ((t) => (t.PENDING = "pending", t.FAILED = "rejected", t.FLAGGED = "flagged", t.VERIFIED = "verified", t))(p || {}), g = /* @__PURE__ */ ((t) => (t.SelfDeclaration = "self-declaration", t.PersonalSignEIP191 = "eip-191", t.SIWE = "siwe", t.PersonalSignEIP712 = "eip-712", t.PersonalSignBIP137 = "bip-137", t.PersonalSignXPUB = "xpub", t.MicroTransfer = "microtransfer", t.Screenshot = "screenshot", t))(g || {}); | ||
class v { | ||
var m = (t, e, r) => e in t ? c(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r; | ||
var o = (t, e, r) => m(t, typeof e != "symbol" ? e + "" : e, r); | ||
var u = /* @__PURE__ */ ((t) => (t.PRIVATE = "WALLET", t.VASP = "VASP", t))(u || {}), E = /* @__PURE__ */ ((t) => (t.NATURAL = "natural", t.LEGAL = "legal", t.SELF = "self", t))(E || {}), p = /* @__PURE__ */ ((t) => (t.EMPTY = "empty", t.VERIFY = "verify", t.PENDING = "pending", t.VERIFIED = "verified", t.BANNED = "banned", t))(p || {}), f = /* @__PURE__ */ ((t) => (t.ASSET = "asset", t.DESTINATION = "destination", t.COUNTERPARTY = "counterparty", t.AGENT = "agent", t))(f || {}), a = /* @__PURE__ */ ((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 = /* @__PURE__ */ ((t) => (t.UPDATE = "update", t.REQUEST_RESPONSE = "requestResponse", t))(d || {}), g = /* @__PURE__ */ ((t) => (t.PENDING = "pending", t.FAILED = "rejected", t.FLAGGED = "flagged", t.VERIFIED = "verified", t))(g || {}), v = /* @__PURE__ */ ((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.BIP137_XPUB = "xpub", t.ED25519 = "ed25519", t.MicroTransfer = "microtransfer", t.Screenshot = "screenshot", t))(v || {}); | ||
class I { | ||
constructor() { | ||
@@ -31,4 +31,4 @@ o(this, "listeners", /* @__PURE__ */ new Map()); | ||
*/ | ||
on(e, s) { | ||
this.listeners.has(e) || this.listeners.set(e, /* @__PURE__ */ new Set()), this.listeners.get(e).add(s); | ||
on(e, r) { | ||
this.listeners.has(e) || this.listeners.set(e, /* @__PURE__ */ new Set()), this.listeners.get(e).add(r); | ||
} | ||
@@ -44,5 +44,5 @@ /** | ||
*/ | ||
off(e, s) { | ||
const r = this.listeners.get(e); | ||
r && (r.delete(s), r.size === 0 && this.listeners.delete(e)); | ||
off(e, r) { | ||
const s = this.listeners.get(e); | ||
s && (s.delete(r), s.size === 0 && this.listeners.delete(e)); | ||
} | ||
@@ -58,6 +58,6 @@ /** | ||
handleMessage(e) { | ||
const s = e.data; | ||
if (typeof s == "object" && s !== null && "type" in s) { | ||
const r = s.type, i = this.listeners.get(r); | ||
i && i.forEach((n) => n(s)); | ||
const r = e.data; | ||
if (typeof r == "object" && r !== null && "type" in r) { | ||
const s = r.type, i = this.listeners.get(s); | ||
i && i.forEach((n) => n(r)); | ||
} | ||
@@ -73,3 +73,3 @@ } | ||
} | ||
class I { | ||
class w { | ||
/** | ||
@@ -80,3 +80,3 @@ * Creates an instance of EmbeddedComponent. | ||
*/ | ||
constructor(e, s, r) { | ||
constructor(e, r, s) { | ||
o(this, "_url"); | ||
@@ -89,3 +89,3 @@ o(this, "_value"); | ||
o(this, "modal"); | ||
this._url = e, this._value = s, this._options = r, this.eventManager = new v(), this.on(a.INVALID, (i) => { | ||
this._url = e, this._value = r, this._options = s, this.eventManager = new I(), this.on(a.INVALID, (i) => { | ||
i.type === a.INVALID && (this._errors = i.errors, this._value = i.value); | ||
@@ -128,5 +128,5 @@ }), this.on(a.RESIZE, (i) => { | ||
mount(e) { | ||
const s = document.querySelector(e); | ||
if (!s) throw new Error(`parentID ${e} not found`); | ||
this.embed(s); | ||
const r = document.querySelector(e); | ||
if (!r) throw new Error(`parentID ${e} not found`); | ||
this.embed(r); | ||
} | ||
@@ -137,8 +137,8 @@ /** | ||
*/ | ||
embed(e, s = !1) { | ||
var r, i; | ||
this.removeEmbed(), this.iframe = document.createElement("iframe"), this.iframe.src = this.url + (s ? "" : "&embedded=true"), this.iframe.allow = "web-share", this.iframe.style.width = "100%", this.iframe.style.height = "100px", this.iframe.style.border = "none", this.iframe.style.overflow = "hidden", e.appendChild(this.iframe), window.addEventListener("message", (n) => { | ||
embed(e, r = !1) { | ||
var s, i; | ||
this.removeEmbed(), this.iframe = document.createElement("iframe"), this.iframe.src = this.url + (r ? "" : "&embedded=true"), this.iframe.allow = "web-share", this.iframe.style.width = "100%", this.iframe.style.height = "100px", this.iframe.style.border = "none", this.iframe.style.overflow = "hidden", e.appendChild(this.iframe), window.addEventListener("message", (n) => { | ||
var h, l; | ||
n.source === ((h = this.iframe) == null ? void 0 : h.contentWindow) && ((l = this.eventManager) == null || l.setPort(n.ports[0])); | ||
}), (i = (r = this.iframe) == null ? void 0 : r.contentWindow) == null || i.focus(); | ||
}), (i = (s = this.iframe) == null ? void 0 : s.contentWindow) == null || i.focus(); | ||
} | ||
@@ -160,4 +160,4 @@ removeEmbed() { | ||
*/ | ||
on(e, s) { | ||
this.eventManager.on(e, s); | ||
on(e, r) { | ||
this.eventManager.on(e, r); | ||
} | ||
@@ -169,4 +169,4 @@ /** | ||
*/ | ||
off(e, s) { | ||
this.eventManager.off(e, s); | ||
off(e, r) { | ||
this.eventManager.off(e, r); | ||
} | ||
@@ -177,4 +177,4 @@ /** | ||
*/ | ||
update(e, s) { | ||
this._value = e, s && (this._options = s), this.send({ type: d.UPDATE, value: e, options: this._options }); | ||
update(e, r) { | ||
this._value = e, r && (this._options = r), this.send({ type: d.UPDATE, value: e, options: this._options }); | ||
} | ||
@@ -186,7 +186,7 @@ /** | ||
completion() { | ||
return new Promise((e, s) => { | ||
this.on(a.COMPLETE, (r) => { | ||
e(r.response); | ||
}), this.on("error", (r) => { | ||
s(new Error(r.message)); | ||
return new Promise((e, r) => { | ||
this.on(a.COMPLETE, (s) => { | ||
e(s.response); | ||
}), this.on("error", (s) => { | ||
r(new Error(s.message)); | ||
}); | ||
@@ -216,9 +216,9 @@ }); | ||
} | ||
function w(t) { | ||
return Object.entries(t).map(([e, s]) => { | ||
if (!(e && s)) return; | ||
const r = encodeURIComponent(e), i = encodeURIComponent( | ||
typeof s == "object" ? JSON.stringify(s) : s | ||
function U(t) { | ||
return Object.entries(t).map(([e, r]) => { | ||
if (!(e && r)) return; | ||
const s = encodeURIComponent(e), i = encodeURIComponent( | ||
typeof r == "object" ? JSON.stringify(r) : r | ||
); | ||
return `${r}=${i}`; | ||
return `${s}=${i}`; | ||
}).filter((e) => !!e).join("&"); | ||
@@ -250,9 +250,9 @@ } | ||
*/ | ||
componentUrl(e, s, r, i) { | ||
componentUrl(e, r, s, i) { | ||
const n = new URL(this.uxUrl); | ||
n.pathname = e; | ||
const h = w({ | ||
const h = U({ | ||
authToken: this.authToken, | ||
value: s, | ||
configuration: r | ||
value: r, | ||
configuration: s | ||
}); | ||
@@ -271,7 +271,7 @@ return n.hash = h, 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), i && (i.callback && n.searchParams.set("callback_url", i.callback), i.redirectUri && n.searchParams.set("redirect_uri", i.redirectUri)), n.toString(); | ||
*/ | ||
createComponent(e, s, r, i) { | ||
return new I( | ||
this.componentUrl(e, s, r, i), | ||
s, | ||
r | ||
createComponent(e, r, s, i) { | ||
return new w( | ||
this.componentUrl(e, r, s, i), | ||
r, | ||
s | ||
); | ||
@@ -287,8 +287,8 @@ } | ||
*/ | ||
createWithdrawalAssist(e, s, r) { | ||
createWithdrawalAssist(e, r, s) { | ||
return this.createComponent( | ||
"withdrawal-assist", | ||
e, | ||
s, | ||
r | ||
r, | ||
s | ||
); | ||
@@ -305,8 +305,8 @@ } | ||
*/ | ||
createDepositAssist(e, s, r) { | ||
createDepositAssist(e, r, s) { | ||
return this.createComponent( | ||
"deposit-assist", | ||
e, | ||
s, | ||
r | ||
r, | ||
s | ||
); | ||
@@ -323,8 +323,8 @@ } | ||
*/ | ||
createConnectWallet(e, s, r) { | ||
createConnectWallet(e, r, s) { | ||
return this.createComponent( | ||
"connect", | ||
e, | ||
s, | ||
r | ||
r, | ||
s | ||
); | ||
@@ -341,8 +341,8 @@ } | ||
*/ | ||
createDepositRequest(e, s, r) { | ||
createDepositRequest(e, r, s) { | ||
return this.createComponent( | ||
"deposit-request", | ||
e, | ||
s, | ||
r | ||
r, | ||
s | ||
); | ||
@@ -358,5 +358,5 @@ } | ||
return e.slice(1).split("&").reduce( | ||
(r, i) => { | ||
(s, i) => { | ||
const [n, h] = i.split("="); | ||
return r[decodeURIComponent(n)] = decodeURIComponent(h), r; | ||
return s[decodeURIComponent(n)] = decodeURIComponent(h), s; | ||
}, | ||
@@ -370,9 +370,10 @@ {} | ||
a as CMType, | ||
I as EmbeddedComponent, | ||
w as EmbeddedComponent, | ||
d as HMType, | ||
f as PersonType, | ||
p as ProofStatus, | ||
g as ProofTypes, | ||
E as Status, | ||
E as PersonType, | ||
g as ProofStatus, | ||
v as ProofTypes, | ||
p as Status, | ||
f as ValidationSections, | ||
b as default | ||
}; |
@@ -12,3 +12,3 @@ { | ||
"license": "MIT", | ||
"version": "2.0.0-next.20", | ||
"version": "2.0.0-next.21", | ||
"source": "src/notabene.ts", | ||
@@ -15,0 +15,0 @@ "main": "dist/notabene.js", |
@@ -199,3 +199,3 @@ <div align="center"> | ||
### Destination address | ||
### Asset Price | ||
@@ -286,2 +286,7 @@ The price of the asset is used to determine certain rules based on thresholds. We recommond you pass in your price like this: | ||
fallbacks: [ProofTypes.Screenshot, ProofTypes.SelfDeclaration], // js ['screenshot','self_declaration'] | ||
deminimis: { | ||
threshold: 1000, | ||
currency: 'EUR', | ||
proofTypes: [ProofTypes.SelfDeclaration] | ||
} | ||
}, | ||
@@ -320,2 +325,3 @@ allowedAgentTypes: [AgentType.PRIVATE, AgentType.VASP], // js ['WALLET','VASP'] | ||
}, | ||
hide: [ValidationSections.ASSET, ValidationSections.DESTINATION] // Don't show specific sections of component | ||
}, | ||
@@ -322,0 +328,0 @@ }; |
@@ -39,2 +39,3 @@ import EmbeddedComponent from './components/EmbeddedComponent'; | ||
Theme, | ||
ThresholdOptions, | ||
Transaction, | ||
@@ -61,2 +62,3 @@ TransactionAsset, | ||
Status, | ||
ValidationSections, | ||
} from './types'; | ||
@@ -107,2 +109,3 @@ import { type MessageCallback } from './utils/MessageEventManager'; | ||
Theme, | ||
ThresholdOptions, | ||
Transaction, | ||
@@ -127,2 +130,3 @@ TransactionAsset, | ||
AgentType, | ||
ValidationSections, | ||
}; | ||
@@ -129,0 +133,0 @@ |
@@ -691,2 +691,30 @@ import { | ||
/** | ||
* Sections in a WithdrawalAssist screen | ||
* | ||
* @alpha | ||
*/ | ||
export enum ValidationSections { | ||
ASSET = 'asset', | ||
DESTINATION = 'destination', | ||
COUNTERPARTY = 'counterparty', | ||
AGENT = 'agent', | ||
} | ||
/** | ||
* Specify what to do under the provided threshold. | ||
* | ||
* Eg. to allow self-declaration for all transactions under 1000 EUR | ||
* | ||
* Note to support threshold you MUST include the Asset Price in the Transaction | ||
* | ||
* @see {@link Transaction} Transaction object | ||
* | ||
* @public | ||
*/ | ||
export interface ThresholdOptions { | ||
threshold: number; // The threshold amount eg 1000 | ||
currency: ISOCurrency; // Currency of threshold | ||
proofTypes?: ProofTypes[]; // If left empty no proof will be required under threshold | ||
} | ||
/** | ||
* Configuration options for Transaction components | ||
@@ -703,2 +731,3 @@ * @public | ||
fallbacks?: ProofTypes[]; | ||
deminimis?: ThresholdOptions; | ||
}; | ||
@@ -709,2 +738,3 @@ allowedAgentTypes?: AgentType[]; // Defaults to All | ||
vasps?: VASPOptions; | ||
hide?: ValidationSections[]; // You can hide a specific section of the component by listing it here | ||
} | ||
@@ -917,7 +947,7 @@ | ||
* - SelfDeclaration: User self-declares ownership without cryptographic proof | ||
* - PersonalSignEIP191: Ethereum personal signature following EIP-191 standard | ||
* - EIP191: Ethereum personal signature following EIP-191 standard | ||
* - SIWE: Sign-In with Ethereum message signature (EIP-4361) | ||
* - PersonalSignEIP712: Ethereum typed data signature following EIP-712 standard | ||
* - PersonalSignBIP137: Bitcoin message signature following BIP-137 | ||
* - PersonalSignXPUB: Extended public key signature for HD wallets | ||
* - EIP712: Ethereum typed data signature following EIP-712 standard | ||
* - BIP137: Bitcoin message signature following BIP-137 | ||
* - XPUB: Extended public key signature for HD wallets | ||
* - MicroTransfer: Proof via small blockchain transaction | ||
@@ -934,7 +964,10 @@ * - Screenshot: Image proof of ownership/access | ||
SelfDeclaration = 'self-declaration', | ||
PersonalSignEIP191 = 'eip-191', | ||
SIWE = 'siwe', | ||
PersonalSignEIP712 = 'eip-712', | ||
PersonalSignBIP137 = 'bip-137', | ||
PersonalSignXPUB = 'xpub', | ||
SIWX = 'siwx', | ||
EIP191 = 'eip-191', | ||
EIP712 = 'eip-712', | ||
EIP1271 = 'eip-1271', | ||
BIP137 = 'bip-137', | ||
BIP137_XPUB = 'xpub', | ||
ED25519 = 'ed25519', | ||
MicroTransfer = 'microtransfer', | ||
@@ -991,7 +1024,11 @@ Screenshot = 'screenshot', | ||
type: | ||
| ProofTypes.PersonalSignEIP191 | ||
| ProofTypes.PersonalSignEIP712 | ||
| ProofTypes.PersonalSignBIP137 | ||
| ProofTypes.SIWE | ||
| ProofTypes.PersonalSignXPUB; | ||
| ProofTypes.EIP191 | ||
| ProofTypes.EIP712 | ||
| ProofTypes.EIP1271 | ||
| ProofTypes.BIP137 | ||
| ProofTypes.BIP137_XPUB | ||
| ProofTypes.ED25519 | ||
| ProofTypes.SIWX | ||
| ProofTypes.SIWE; | ||
proof: string; | ||
@@ -1018,4 +1055,5 @@ attestation: string; | ||
type: ProofTypes.MicroTransfer; | ||
txhash: string; | ||
proof: string; | ||
chain: CAIP2; | ||
asset: CAIP19; | ||
destination: BlockchainAddress; | ||
@@ -1022,0 +1060,0 @@ amountSubunits: string; |
Sorry, the diff of this file is not supported yet
277187
4354
518