@streamflow/common 6.5.0 → 7.0.0-alpha.10
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/dist/{index.js → cjs/index.js} +2 -2
- package/dist/{solana → cjs/solana}/index.js +3 -3
- package/dist/cjs/solana/instructions.js +22 -0
- package/dist/cjs/solana/types.js +11 -0
- package/dist/cjs/solana/utils.js +443 -0
- package/dist/cjs/types.js +40 -0
- package/dist/cjs/utils.js +57 -0
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/solana/index.d.ts +3 -0
- package/dist/esm/solana/index.js +3 -0
- package/dist/{solana → esm/solana}/instructions.d.ts +2 -2
- package/dist/esm/solana/instructions.js +18 -0
- package/dist/esm/solana/types.js +7 -0
- package/dist/{solana → esm/solana}/utils.d.ts +1 -1
- package/dist/esm/solana/utils.js +416 -0
- package/dist/{types.d.ts → esm/types.d.ts} +1 -2
- package/dist/esm/types.js +38 -0
- package/dist/{utils.d.ts → esm/utils.d.ts} +9 -9
- package/dist/esm/utils.js +47 -0
- package/package.json +20 -20
- package/dist/index.d.ts +0 -2
- package/dist/solana/index.d.ts +0 -3
- package/dist/solana/instructions.js +0 -92
- package/dist/solana/types.js +0 -29
- package/dist/solana/utils.js +0 -754
- package/dist/types.js +0 -58
- package/dist/utils.js +0 -107
- /package/dist/{solana → esm/solana}/types.d.ts +0 -0
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
39
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
40
|
-
if (!m) return o;
|
|
41
|
-
var i = m.call(o), r, ar = [], e;
|
|
42
|
-
try {
|
|
43
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
44
|
-
}
|
|
45
|
-
catch (error) { e = { error: error }; }
|
|
46
|
-
finally {
|
|
47
|
-
try {
|
|
48
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
49
|
-
}
|
|
50
|
-
finally { if (e) throw e.error; }
|
|
51
|
-
}
|
|
52
|
-
return ar;
|
|
53
|
-
};
|
|
54
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
55
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
56
|
-
if (ar || !(i in from)) {
|
|
57
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
58
|
-
ar[i] = from[i];
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
62
|
-
};
|
|
63
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
64
|
-
exports.prepareWrappedAccount = void 0;
|
|
65
|
-
var spl_token_1 = require("@solana/spl-token");
|
|
66
|
-
var web3_js_1 = require("@solana/web3.js");
|
|
67
|
-
var prepareWrappedAccount = function (connection, senderAddress, amount) { return __awaiter(void 0, void 0, void 0, function () {
|
|
68
|
-
var tokenAccount, accInfo, instructions;
|
|
69
|
-
var _a, _b;
|
|
70
|
-
return __generator(this, function (_c) {
|
|
71
|
-
switch (_c.label) {
|
|
72
|
-
case 0: return [4 /*yield*/, (0, spl_token_1.getAssociatedTokenAddress)(spl_token_1.NATIVE_MINT, senderAddress, true)];
|
|
73
|
-
case 1:
|
|
74
|
-
tokenAccount = _c.sent();
|
|
75
|
-
return [4 /*yield*/, connection.getParsedAccountInfo(tokenAccount)];
|
|
76
|
-
case 2:
|
|
77
|
-
accInfo = _c.sent();
|
|
78
|
-
instructions = ((_b = (_a = accInfo.value) === null || _a === void 0 ? void 0 : _a.lamports) !== null && _b !== void 0 ? _b : 0) > 0
|
|
79
|
-
? []
|
|
80
|
-
: [(0, spl_token_1.createAssociatedTokenAccountInstruction)(senderAddress, tokenAccount, senderAddress, spl_token_1.NATIVE_MINT)];
|
|
81
|
-
return [2 /*return*/, __spreadArray(__spreadArray([], __read(instructions), false), [
|
|
82
|
-
web3_js_1.SystemProgram.transfer({
|
|
83
|
-
fromPubkey: senderAddress,
|
|
84
|
-
toPubkey: tokenAccount,
|
|
85
|
-
lamports: amount.toNumber(),
|
|
86
|
-
}),
|
|
87
|
-
(0, spl_token_1.createSyncNativeInstruction)(tokenAccount),
|
|
88
|
-
], false)];
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
}); };
|
|
92
|
-
exports.prepareWrappedAccount = prepareWrappedAccount;
|
package/dist/solana/types.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.TransactionFailedError = void 0;
|
|
19
|
-
var TransactionFailedError = /** @class */ (function (_super) {
|
|
20
|
-
__extends(TransactionFailedError, _super);
|
|
21
|
-
function TransactionFailedError(m) {
|
|
22
|
-
var _this = _super.call(this, m) || this;
|
|
23
|
-
Object.setPrototypeOf(_this, TransactionFailedError.prototype);
|
|
24
|
-
_this.name = "TransactionFailedError";
|
|
25
|
-
return _this;
|
|
26
|
-
}
|
|
27
|
-
return TransactionFailedError;
|
|
28
|
-
}(Error));
|
|
29
|
-
exports.TransactionFailedError = TransactionFailedError;
|