@owneraio/finp2p-sdk-js 0.24.3 → 0.24.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/lib/core/intents/createIntent/createPrivateIntentReq.js +8 -3
- package/lib/core/intents/createIntent/createPrivateIntentReq.js.map +1 -1
- package/lib/core/intents/createIntent/helpers.d.ts +5 -5
- package/lib/core/intents/createIntent/helpers.js +11 -12
- package/lib/core/intents/createIntent/helpers.js.map +1 -1
- package/lib/types/Oss/ExecutionPlan/OssSchemas.js.map +1 -1
- package/package.json +1 -1
|
@@ -6,15 +6,20 @@ const createPrivateIntentReq = (req) => {
|
|
|
6
6
|
const intentRequestBase = (0, helpers_1.getCreateIntentReqBase)(req);
|
|
7
7
|
const { createIntentRequest, userId } = req;
|
|
8
8
|
const { settlement, subType } = createIntentRequest;
|
|
9
|
+
const noSettlement = !settlement.unitValue;
|
|
9
10
|
let intentRequest;
|
|
10
11
|
// currently we handle the private offer trade type, what has two additional types "buy" | "sell"
|
|
11
12
|
// here we handle trade "buy" and trade "sell" similar way as buying and selling intents
|
|
12
13
|
if ('destinationAccount' in settlement) {
|
|
13
14
|
const { destinationAccount, buyer } = settlement;
|
|
14
15
|
if (subType === 'issuance') {
|
|
15
|
-
intentRequest = Object.assign(Object.assign({}, intentRequestBase), { buyer: buyer, seller: userId,
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
intentRequest = Object.assign(Object.assign(Object.assign({}, intentRequestBase), { buyer: buyer, seller: userId }), (noSettlement
|
|
17
|
+
? {}
|
|
18
|
+
: {
|
|
19
|
+
settlementInstruction: {
|
|
20
|
+
destinationAccounts: destinationAccount,
|
|
21
|
+
},
|
|
22
|
+
}));
|
|
18
23
|
}
|
|
19
24
|
else {
|
|
20
25
|
intentRequest = Object.assign(Object.assign({}, intentRequestBase), { buyer: buyer, seller: userId, settlementInstruction: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createPrivateIntentReq.js","sourceRoot":"","sources":["../../../../src/core/intents/createIntent/createPrivateIntentReq.ts"],"names":[],"mappings":";;;AAaA,uCAAmD;AAI5C,MAAM,sBAAsB,GAAG,CAAC,GAAwB,EAAE,EAAE;IACjE,MAAM,iBAAiB,GAAG,IAAA,gCAAsB,EAAC,GAAG,CAAgC,CAAC;IAErF,MAAM,EAAE,mBAAmB,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC;IAC5C,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"createPrivateIntentReq.js","sourceRoot":"","sources":["../../../../src/core/intents/createIntent/createPrivateIntentReq.ts"],"names":[],"mappings":";;;AAaA,uCAAmD;AAI5C,MAAM,sBAAsB,GAAG,CAAC,GAAwB,EAAE,EAAE;IACjE,MAAM,iBAAiB,GAAG,IAAA,gCAAsB,EAAC,GAAG,CAAgC,CAAC;IAErF,MAAM,EAAE,mBAAmB,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC;IAC5C,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,mBAAmB,CAAC;IACpD,MAAM,YAAY,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC;IAE3C,IAAI,aAAwC,CAAC;IAE7C,iGAAiG;IACjG,wFAAwF;IACxF,IAAI,oBAAoB,IAAI,UAAU,EAAE,CAAC;QACvC,MAAM,EAAE,kBAAkB,EAAE,KAAK,EAAE,GAAG,UAAkE,CAAC;QAEzG,IAAI,OAAO,KAAK,UAAU,EAAE,CAAC;YAC3B,aAAa,GAAG,8CACX,iBAAiB,KACpB,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,KACX,CAAC,YAAY;gBACd,CAAC,CAAC,EAAE;gBACJ,CAAC,CAAC;oBACE,qBAAqB,EAAE;wBACrB,mBAAmB,EAAE,kBAAkB;qBACF;iBACxC,CAAC,CAC8B,CAAC;QACzC,CAAC;aAAM,CAAC;YACN,aAAa,GAAG,gCACX,iBAAiB,KACpB,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,qBAAqB,EAAE;oBACrB,mBAAmB,EAAE,kBAAkB;iBACF,GACN,CAAC;YAEpC,aAAa,CAAC,gBAAgB,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,GAC5D,kBAAkB,CAAC,CAAC,CAAC,CAAC,OACvB,CAAC,SAAS,CAAC,KAAK,CAAC;QACpB,CAAC;IACH,CAAC;SAAM,CAAC;QACN,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,GAAG,UAAiE,CAAC;QAEpG,aAAa,GAAG,gCACX,iBAAiB,KACpB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,qBAAqB,EAAE;gBACrB,aAAa;aACuB,GACL,CAAC;QACpC,aAAa,CAAC,gBAAgB,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,GAAG,aAAa,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC;IACzG,CAAC;IAED,OAAO,aAAa,CAAC;AACvB,CAAC,CAAC;AAxDW,QAAA,sBAAsB,0BAwDjC"}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { CreateIntentPayload } from './createIntent';
|
|
2
2
|
export declare const getCreateIntentReqBase: ({ createIntentRequest, publicKey }: CreateIntentPayload) => {
|
|
3
|
+
signaturePolicy: import("../../..").ManualSignaturePolicy;
|
|
4
|
+
settlementTerm?: {
|
|
5
|
+
asset: import("../../..").SettlementAssetTerm;
|
|
6
|
+
unitValue: string;
|
|
7
|
+
} | undefined;
|
|
3
8
|
type: "buyingIntent" | "sellingIntent" | "privateOfferIntent";
|
|
4
9
|
assetTerm: {
|
|
5
10
|
asset: {
|
|
@@ -24,9 +29,4 @@ export declare const getCreateIntentReqBase: ({ createIntentRequest, publicKey }
|
|
|
24
29
|
} | undefined;
|
|
25
30
|
};
|
|
26
31
|
};
|
|
27
|
-
settlementTerm: {
|
|
28
|
-
asset: import("../../..").SettlementAssetTerm;
|
|
29
|
-
unitValue: string;
|
|
30
|
-
};
|
|
31
|
-
signaturePolicy: import("../../..").ManualSignaturePolicy;
|
|
32
32
|
};
|
|
@@ -4,13 +4,11 @@ exports.getCreateIntentReqBase = void 0;
|
|
|
4
4
|
const utils_1 = require("../../utils");
|
|
5
5
|
const getCreateIntentReqBase = ({ createIntentRequest, publicKey }) => {
|
|
6
6
|
const { amount, type, settlement, assetId, signaturePolicy, subType } = createIntentRequest;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
assetTerm: {
|
|
7
|
+
const noSettlement = !settlement.unitValue;
|
|
8
|
+
return Object.assign(Object.assign({ type, assetTerm: {
|
|
10
9
|
asset: { type: 'finp2p', resourceId: assetId },
|
|
11
10
|
amount,
|
|
12
|
-
},
|
|
13
|
-
assetInstruction: {
|
|
11
|
+
}, assetInstruction: {
|
|
14
12
|
account: {
|
|
15
13
|
asset: { type: 'finp2p', resourceId: assetId },
|
|
16
14
|
account: subType && subType === 'issuance'
|
|
@@ -24,13 +22,14 @@ const getCreateIntentReqBase = ({ createIntentRequest, publicKey }) => {
|
|
|
24
22
|
},
|
|
25
23
|
},
|
|
26
24
|
},
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
25
|
+
} }, (noSettlement
|
|
26
|
+
? {}
|
|
27
|
+
: {
|
|
28
|
+
settlementTerm: {
|
|
29
|
+
asset: settlement.asset,
|
|
30
|
+
unitValue: settlement.unitValue,
|
|
31
|
+
},
|
|
32
|
+
})), { signaturePolicy });
|
|
34
33
|
};
|
|
35
34
|
exports.getCreateIntentReqBase = getCreateIntentReqBase;
|
|
36
35
|
//# sourceMappingURL=helpers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../src/core/intents/createIntent/helpers.ts"],"names":[],"mappings":";;;AAAA,uCAAmD;A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,CAAC;AAtCW,QAAA,sBAAsB,0BAsCjC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OssSchemas.js","sourceRoot":"","sources":["../../../../src/types/Oss/ExecutionPlan/OssSchemas.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"OssSchemas.js","sourceRoot":"","sources":["../../../../src/types/Oss/ExecutionPlan/OssSchemas.ts"],"names":[],"mappings":";;;AAyHA,IAAY,mBASX;AATD,WAAY,mBAAmB;IAC7B,0CAAmB,CAAA;IACnB,0CAAmB,CAAA;IACnB,4CAAqB,CAAA;IACrB,8CAAuB,CAAA;IACvB,wCAAiB,CAAA;IACjB,wCAAiB,CAAA;IACjB,4CAAqB,CAAA;IACrB,gDAAyB,CAAA;AAC3B,CAAC,EATW,mBAAmB,mCAAnB,mBAAmB,QAS9B"}
|