@agoric/pegasus 0.7.12-dev-69236fd.0 → 0.7.12
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/CHANGELOG.md +8 -0
- package/package.json +11 -11
- package/src/courier.js +1 -2
- package/src/ics20.js +1 -11
- package/src/pegasus.js +2 -3
- package/src/types.js +1 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
### [0.7.12](https://github.com/Agoric/agoric-sdk/compare/@agoric/pegasus@0.7.11...@agoric/pegasus@0.7.12) (2023-06-09)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @agoric/pegasus
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
### [0.7.11](https://github.com/Agoric/agoric-sdk/compare/@agoric/pegasus@0.7.10...@agoric/pegasus@0.7.11) (2023-06-02)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @agoric/pegasus
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/pegasus",
|
|
3
|
-
"version": "0.7.12
|
|
3
|
+
"version": "0.7.12",
|
|
4
4
|
"description": "Peg-as-us contract",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/pegasus.js",
|
|
@@ -29,14 +29,14 @@
|
|
|
29
29
|
},
|
|
30
30
|
"homepage": "https://github.com/Agoric/agoric-sdk#readme",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@agoric/assert": "0.6.
|
|
33
|
-
"@agoric/ertp": "0.16.
|
|
34
|
-
"@agoric/internal": "0.3.
|
|
35
|
-
"@agoric/notifier": "0.6.
|
|
36
|
-
"@agoric/store": "0.9.
|
|
37
|
-
"@agoric/swingset-vat": "0.32.
|
|
38
|
-
"@agoric/vats": "0.15.1
|
|
39
|
-
"@agoric/zoe": "0.26.
|
|
32
|
+
"@agoric/assert": "^0.6.0",
|
|
33
|
+
"@agoric/ertp": "^0.16.2",
|
|
34
|
+
"@agoric/internal": "^0.3.2",
|
|
35
|
+
"@agoric/notifier": "^0.6.2",
|
|
36
|
+
"@agoric/store": "^0.9.2",
|
|
37
|
+
"@agoric/swingset-vat": "^0.32.2",
|
|
38
|
+
"@agoric/vats": "^0.15.1",
|
|
39
|
+
"@agoric/zoe": "^0.26.2",
|
|
40
40
|
"@endo/bundle-source": "^2.5.1",
|
|
41
41
|
"@endo/captp": "^3.1.1",
|
|
42
42
|
"@endo/far": "^0.2.18",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@endo/promise-kit": "^0.2.56"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@agoric/deploy-script-support": "0.10.3
|
|
48
|
+
"@agoric/deploy-script-support": "^0.10.3",
|
|
49
49
|
"ava": "^5.2.0",
|
|
50
50
|
"c8": "^7.13.0",
|
|
51
51
|
"import-meta-resolve": "^2.2.1"
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"publishConfig": {
|
|
66
66
|
"access": "public"
|
|
67
67
|
},
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "ba3b776444425bbcb275ce918794d9259f8e15da"
|
|
69
69
|
}
|
package/src/courier.js
CHANGED
|
@@ -56,14 +56,13 @@ export const makeCourierMaker =
|
|
|
56
56
|
transferProtocol,
|
|
57
57
|
}) => {
|
|
58
58
|
/** @type {Sender} */
|
|
59
|
-
const send = async (zcfSeat, depositAddress
|
|
59
|
+
const send = async (zcfSeat, depositAddress) => {
|
|
60
60
|
const tryToSend = async () => {
|
|
61
61
|
const amount = zcfSeat.getAmountAllocated('Transfer', localBrand);
|
|
62
62
|
const transferPacket = await E(transferProtocol).makeTransferPacket({
|
|
63
63
|
value: amount.value,
|
|
64
64
|
remoteDenom: sendDenom,
|
|
65
65
|
depositAddress,
|
|
66
|
-
memo,
|
|
67
66
|
});
|
|
68
67
|
|
|
69
68
|
// Retain the payment. We must not proceed on failure.
|
package/src/ics20.js
CHANGED
|
@@ -10,7 +10,6 @@ import { assert, details as X, Fail } from '@agoric/assert';
|
|
|
10
10
|
* @property {Denom} denom The denomination of the amount
|
|
11
11
|
* @property {string} sender The sender address
|
|
12
12
|
* @property {DepositAddress} receiver The receiver deposit address
|
|
13
|
-
* @property {string} memo The packet memo
|
|
14
13
|
*/
|
|
15
14
|
|
|
16
15
|
// As specified in ICS20, the success result is a base64-encoded '\0x1' byte.
|
|
@@ -51,16 +50,10 @@ const safeJSONParseObject = s => {
|
|
|
51
50
|
*/
|
|
52
51
|
export const parseICS20TransferPacket = async packet => {
|
|
53
52
|
const ics20Packet = safeJSONParseObject(packet);
|
|
54
|
-
const { amount, denom, receiver
|
|
53
|
+
const { amount, denom, receiver } = ics20Packet;
|
|
55
54
|
|
|
56
55
|
assert.typeof(denom, 'string', X`Denom ${denom} must be a string`);
|
|
57
56
|
assert.typeof(receiver, 'string', X`Receiver ${receiver} must be a string`);
|
|
58
|
-
memo === undefined ||
|
|
59
|
-
assert.typeof(
|
|
60
|
-
memo,
|
|
61
|
-
'string',
|
|
62
|
-
X`Memo ${memo} must be a string or 'undefined'`,
|
|
63
|
-
);
|
|
64
57
|
|
|
65
58
|
// amount is a string in JSON.
|
|
66
59
|
assert.typeof(amount, 'string', X`Amount ${amount} must be a string`);
|
|
@@ -73,7 +66,6 @@ export const parseICS20TransferPacket = async packet => {
|
|
|
73
66
|
depositAddress: receiver,
|
|
74
67
|
remoteDenom: denom,
|
|
75
68
|
value,
|
|
76
|
-
memo,
|
|
77
69
|
});
|
|
78
70
|
};
|
|
79
71
|
|
|
@@ -88,7 +80,6 @@ export const makeICS20TransferPacket = async ({
|
|
|
88
80
|
value,
|
|
89
81
|
remoteDenom,
|
|
90
82
|
depositAddress,
|
|
91
|
-
memo,
|
|
92
83
|
}) => {
|
|
93
84
|
// We're using Nat as a dynamic check for overflow.
|
|
94
85
|
const stringValue = String(Nat(value));
|
|
@@ -100,7 +91,6 @@ export const makeICS20TransferPacket = async ({
|
|
|
100
91
|
denom: remoteDenom,
|
|
101
92
|
receiver: depositAddress,
|
|
102
93
|
sender: DUMMY_SENDER_ADDRESS,
|
|
103
|
-
memo,
|
|
104
94
|
};
|
|
105
95
|
|
|
106
96
|
return JSON.stringify(ics20);
|
package/src/pegasus.js
CHANGED
|
@@ -458,10 +458,9 @@ const makePegasus = (zcf, board, namesByAddress) => {
|
|
|
458
458
|
*
|
|
459
459
|
* @param {ERef<Peg>} pegP the peg over which to transfer
|
|
460
460
|
* @param {DepositAddress} depositAddress the remote receiver's address
|
|
461
|
-
* @param {string} [memo] the memo to attach to ics transfer packet
|
|
462
461
|
* @returns {Promise<Invitation>} to transfer, make an offer of { give: { Transfer: pegAmount } } to this invitation
|
|
463
462
|
*/
|
|
464
|
-
async makeInvitationToTransfer(pegP, depositAddress
|
|
463
|
+
async makeInvitationToTransfer(pegP, depositAddress) {
|
|
465
464
|
// Verify the peg.
|
|
466
465
|
const peg = await pegP;
|
|
467
466
|
const denomState = pegToDenomState.get(peg);
|
|
@@ -483,7 +482,7 @@ const makePegasus = (zcf, board, namesByAddress) => {
|
|
|
483
482
|
*/
|
|
484
483
|
const offerHandler = zcfSeat => {
|
|
485
484
|
assertProposalShape(zcfSeat, TRANSFER_PROPOSAL_SHAPE);
|
|
486
|
-
send(zcfSeat, depositAddress
|
|
485
|
+
send(zcfSeat, depositAddress);
|
|
487
486
|
};
|
|
488
487
|
|
|
489
488
|
return zcf.makeInvitation(offerHandler, `pegasus ${sendDenom} transfer`);
|
package/src/types.js
CHANGED
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
* @property {AmountValue} value
|
|
13
13
|
* @property {Denom} remoteDenom
|
|
14
14
|
* @property {DepositAddress} depositAddress
|
|
15
|
-
* @property {string} memo
|
|
16
15
|
*/
|
|
17
16
|
|
|
18
17
|
/**
|
|
@@ -47,7 +46,7 @@
|
|
|
47
46
|
*/
|
|
48
47
|
|
|
49
48
|
/**
|
|
50
|
-
* @typedef {(zcfSeat: ZCFSeat, depositAddress: DepositAddress
|
|
49
|
+
* @typedef {(zcfSeat: ZCFSeat, depositAddress: DepositAddress) => Promise<void>} Sender
|
|
51
50
|
* Successive transfers are not guaranteed to be processed in the order in which they were sent.
|
|
52
51
|
* @typedef {(parts: PacketParts) => Promise<Bytes>} Receiver
|
|
53
52
|
* @typedef {object} Courier
|